text stringlengths 475 200k |
|---|
from django.conf import settings
from django.core.paginator import InvalidPage, Paginator
from django.http import Http404
from django.shortcuts import render
from ..product.utils import products_with_details
from ..product.utils.availability import products_with_availability
from .forms import SearchForm
def paginat... |
__author__ = 'Vincenzo Deriu'
from sketch import Sketch
from db_extraction import *
SKETCH_DELTA = 10 ** -9
SKETCH_EPSILON = 0.010181
SKETCH_WINDOW = 10000
db = DBextraction()
# domain_total_downloads = Sketch(SKETCH_DELTA, SKETCH_EPSILON, SKETCH_WINDOW, 0)
#
# s_new = db.insert_host_total(domain_total_downloads, S... |
# -*- coding: utf-8 -*-
"""
Qt4's inputhook support function
Author: Christian Boos
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, d... |
#
# Copyright (C) 2009, 2012-2014 Red Hat, Inc.
# Copyright (C) 2009 Cole Robinson <[EMAIL]>
#
# 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... |
import sys
import os
import subprocess
import time
import shlex
import re
from subprocess import call
from subprocess import CalledProcessError, check_output
re_asrresult = re.compile(r'.*?({"result.*)', re.DOTALL)
re_asrAlternative = re.compile(r'{"transcript":".*?".*?}', re.DOTALL)
filename = "temp.flac"
... |
# This file is part of MyPaint.
# Copyright (C) 2013 by Andrew Chadwick <[EMAIL]>
#
# 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
"""Flood fill tool"""
##... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, math, time
import threading
from PyQt4 import QtGui, QtCore
import processing_ui
import vidGen
DELAY = 100 # 1 second in milli-seconds
# Shows the preview window showcasing the changes made in the editor window
class Processing(QtGui.QWidget) :
closeApp = Q... |
from math import pi, cos, sin, sqrt, acos
import numpy as np
from ase.data import chemical_symbols
from ase.atoms import Atoms
from ase.parallel import paropen
iwm_symbols = {'1' : 'C',
'2' : 'Au',
'5' : 'Ag'}
def read_iwm(fileobj, index=-1):
if isinstance(fileobj, str):
fil... |
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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
... |
"""Support for Android IP Webcam settings."""
from homeassistant.components.switch import SwitchEntity
from . import (
CONF_HOST,
CONF_NAME,
CONF_SWITCHES,
DATA_IP_WEBCAM,
ICON_MAP,
KEY_MAP,
AndroidIPCamEntity,
)
async def async_setup_platform(hass, config, async_add_entities, discovery_i... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import url, include
from .auth import urls as auth_urls
from . import views
urlpatterns = [
url(r'^$', views.update, name='update'),
url(r'^password-change/$', views.password_change, name='password-change'),
url(r'^em... |
# Copyright 2013 Nebula, 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 ... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
test_qgsblendmodes.py
---------------------
Date : May 2013
Copyright : (C) 2013 by Nyall Dawson, Massimo Endrighi
Email : nyall dot dawson at gmail.com
... |
from django.core.files.uploadedfile import InMemoryUploadedFile
import re
import six
from django import forms
from django.forms.util import flatatt
from django.forms.widgets import FileInput
from django.template import Context
from django.template.loader import render_to_string
from django.utils.encoding import force_... |
"""
Twitter OAuth support.
This adds support for Twitter OAuth service. An application must
be registered first on twitter and the settings TWITTER_CONSUMER_KEY
and TWITTER_CONSUMER_SECRET must be defined with they corresponding
values.
User screen name is used to generate username.
By default account id is stored i... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
# Library to add EoS common functionality
###############################################################################
from scipy import exp, log, sqrt
from scipy import r_
from scipy.optimize ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Czech National Corpus
#
# 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; version 2
# dated June, 1991.
#
# This program is distributed in the hope tha... |
# call_neal1998_from_list.py
#
# (c)2015 S. King, STFC RAL
#
# Example of how to run neal1998.py using input values stored in Python lists
# Run this module from the Python command shell or IDLE.
#
# A text file will be created containing all the input data and the computed values from the model
##### ENTER YOUR OBSE... |
# This file is part of xrayutilities.
#
# xrayutilities 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 distributed... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/ResearchStudy) on 2019-05-07.
# 2019, SMART Health IT.
from . import domainresource
class ResearchStudy(domainresource.DomainResource):
""" Investigation to increase healthcare-relate... |
"""
A Python Singleton mixin class that makes use of some of the ideas
found at http://c2.com/cgi/wiki?PythonSingleton. Just inherit
from it and you have a singleton. No code is required in
subclasses to create singleton behavior -- inheritance from
Singleton is all that is needed.
Singleton creation is threadsafe.
U... |
#!/bin/env python
""" Example for a simulation with external, real-world devices.
- works like any simulation, mostly
- persons are not routed, but receive coordinates from real-world devices
- basic logic (mainly in Person.think() can still be implemented
- an external data manager is used to receive ... |
# pd_helper.py : simple demonstration of invoking a Python object from within Pd.
import socket
import wiringpi2 as wp
import time
################################################################
# Python class to instantiate
class Helper:
def __init__(self):
pass
def lookup_host( self, name ):
... |
"""
# Copyright (c) 04 2015 | surya
# 06/04/15 [EMAIL]
# 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 ... |
#######################################
# Copyright 2019 PMP SA. #
# SPDX-License-Identifier: Apache-2.0 #
#######################################
import argparse
import logging
import time
from ..json_serializer import JSONSerializer
from ..providers.cran import CRAN
# logging.basicConfig(format='[%(le... |
#!/usr/bin/env python3.1
# -*- coding: utf-8 -*-
#
# Import ranking values into the ranking collection.
#
# A cpe regex is use to match vulnerable configuration
# and a ranking value is assigned per a group name.
#
# The idea is to set a specific weight for a vulnerability
# when it's of a specific interest of a group/... |
import pytest
import sys
import os
import subprocess
from .util import get_data, get_main_output
import tempfile
import shutil
from psutil.tests import TRAVIS
LINUX = sys.platform in ('linux', 'linux2')
@pytest.mark.skipif(not LINUX, reason="LINUX only")
class TestUdocker:
udocker_path = None
@classmethod
... |
"""!cp see checkpoint in Asia/Jakarta timezone"""
from datetime import datetime, timedelta
from pytz import timezone
import pytz
import time
import re
# Ingress game constants; do not change
sclen = 175 * 60 * 60 # 175 hours = 630000
cplen = 5 * 60 * 60 # 5 hours = 18000
# Time constants; do not change
def day(n):... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.mail.controllers.main import MailController
from odoo import http
class CrmController(http.Controller):
@http.route('/lead/case_mark_won', type='http', auth='user', methods=['GET'])
def crm_le... |
from distutils.core import setup
import os
# compile the list of packages available, because distutils doesn't have an easy way to do this
packages, data_files = [], []
root_dir = os.path.dirname(__file__)
if root_dir:
os.chdir(root_dir)
for dirpath, dirnames, filenames in os.walk('simple_history'):
# ignore ... |
import unittest
from ropetest import testutils
from ropeide.templates import Template
class TemplateTest(unittest.TestCase):
def test_template_get_variables(self):
template = Template('Name = ${name}')
self.assertEquals(['name'], template.variables())
def test_template_get_variables_multip... |
"""
For each IP compute the HTTP error rate for a given set of requests
AUTHORS::
- Bill ([EMAIL]) 2012: Initial version
"""
from learn2ban_feature import Learn2BanFeature
import operator
class FeatureHTTPResponseCodeRate(Learn2BanFeature):
def __init__(self, ip_recs, ip_feature_db):
"""
... |
# Majority of code taken from reference implementation:
# https://github.com/sipa/bech32/blob/master/ref/python/segwit_addr.py
# Copyright (c) 2017 Pieter Wuille
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Ethan Zhang<http://github.com/Ethan-Zhang>
#
# 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/licen... |
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.conf.urls import patterns, url
from invoice.models import Invoice, InvoiceItem, Currency, InvoicePayment,\
Export
from invoice.views import pdf_dl_view, pdf_gen_view, export_view,\
export_test_view
from invoice.forms import InvoiceAdminForm
f... |
#!/usr/bin/python3
# -*- coding:utf-8 -*-
"""
"""
import __future__
import parser
import sys
import matplotlib.pyplot as plt
#plt.style.use('ggplot')
import numpy as np
import operator
from collections import *
# make point
caseSize = (2048, 2048)
res = 64
if parser.args.x and parser.args.y:
caseSize = (parser.a... |
#!/usr/bin/python3
from copy import copy, deepcopy
import configparser
import mysql.connector
import os
import pygit2
import re
import sys
import aurinfo
config = configparser.RawConfigParser()
config.read(os.path.dirname(os.path.realpath(__file__)) + "/../conf/config")
aur_db_host = config.get('database', 'host')
... |
# -*- coding: utf-8 -*-
# Authors: Matti Hämäläinen <[EMAIL]>
# Alexandre Gramfort <[EMAIL]>
# Eric Larson <[EMAIL]>
# The computations in this code were primarily derived from Matti Hämäläinen's
# C code.
from copy import deepcopy
import numpy as np
from scipy import linalg
from ..io.constants im... |
# -*- coding: utf-8 -*-
"""Contains classes and functions related to bipartite graphs.
The `BipartiteGraph` class is used to represent a bipartite graph as a dictionary. In particular,
`BipartiteGraph.find_matching()` can be used to find a maximum matching in such a graph.
The function `enum_maximum_matchings_iter` c... |
#! /usr/bin/env python2.6
# -*- coding: utf-8 -*-
import seq_sat_portfolio
# NOTE: when using iterated search included, we must include the option
# "plan_counter=PLANCOUNTER"
CONFIGS = [
# eager_greedy_ff
(330, ["--heuristic", "h=ff(cost_type=H_COST_TYPE)",
"--search",
"eager_greed... |
# EVE-Central.com Codebase
# Copyright (C) 2006-2009 StackFoundry LLC and Yann Ramin
#
# 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 3 of the License, or
#... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... |
def find_g_quartet(mol):
'''find the residues comprise the G-quartet or G-triple, G-base pair based on
the distance bewteen O6 and N1 atom of guanine residues'''
g_res = []
for res in mol.get_residue():
if res.name in ['DG','DG3','DG5','BGM']: #BGM is a bromide guanine base
g_res.ap... |
# Copyright (c) 2013 eBay Inc.
# Copyright (c) 2013 OpenStack Foundation
#
# 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
#
# ... |
# -*- coding: utf-8 -*-
import re
import os
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinxcontrib.napoleon'
]
if os.getenv('SPELLCHECK'):
extensions += 'sphinxcontrib.spelling'... |
import logging
import uuid
import jsonschema
import newrelic.agent
import slugid
from treeherder.etl.common import to_timestamp
from treeherder.etl.exceptions import MissingPushException
from treeherder.etl.jobs import store_job_data
from treeherder.etl.schema import get_json_schema
from treeherder.model.models impor... |
# -*- coding: utf-8 -*-
# pylint: disable=C,R,W
"""Utility functions used across Superset"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import object
from datetime import date, datetime, time, timede... |
# Copyright (C) 2015 ycmd contributors
# encoding: utf-8
#
# This file is part of ycmd.
#
# ycmd 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... |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distribut... |
# Copyright (c) 2009 Advanced Micro Devices, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions... |
try:
import uerrno
import uos
except ImportError:
print("SKIP")
raise SystemExit
try:
uos.VfsFat
except AttributeError:
print("SKIP")
raise SystemExit
class RAMFS_OLD:
SEC_SIZE = 512
def __init__(self, blocks):
self.data = bytearray(blocks * self.SEC_SIZE)
def readb... |
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from rest_framework.viewsets import GenericViewSet
from rest_framework import status
from authentication import SimpleTokenAuthentication
from serializers import SimpleTokenAuthSe... |
import re
import sys
import unittest
import pytest
from . import include_code
if 'nosetests' in sys.argv[0]:
raise unittest.SkipTest('Those tests are pytest-compatible only')
@pytest.mark.parametrize(
'input,expected', [
(
'test_data/main.c',
('test_data/main.... |
"""
Read and write ZIP files.
"""
import struct, os, time, sys
import binascii, cStringIO
try:
import zlib # We may need its compression method
except ImportError:
zlib = None
__all__ = ["BadZipfile", "error", "ZIP_STORED", "ZIP_DEFLATED", "is_zipfile",
"ZipInfo", "ZipFile", "PyZipFile"... |
from .x_module import XModuleDescriptor, DescriptorSystem
class MakoDescriptorSystem(DescriptorSystem):
def __init__(self, load_item, resources_fs, error_tracker,
render_template, **kwargs):
super(MakoDescriptorSystem, self).__init__(
load_item, resources_fs, error_tracker, **... |
# 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 (c) 2012 University of Oxford
#
# 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, incl... |
import sys
import csv
import pandas
import numpy as np
try:
from sknn.mlp import Regressor, Layer, Classifier
except ImportError:
pass
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import MinMaxScaler
from sklearn import tree
NAMES = {'Tree': 'Decision Tree',
'NN': 'Neural Networ... |
from tkinter import filedialog
from tkinter import *
from tkinter import ttk
import os, sys
import random
def popup():
popup = Tk()
popup.title("Done!")
root.minsize()
label = ttk.Label(popup, text="all files in ( {} ) are renamed".format(root.directory))
label.pack(side="top", fill="x", padx=5, pa... |
# -*- coding: utf-8 -*-
#
# 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 i... |
##
# Copyright 2016 DECaF Project Group, University of Paderborn
# This file is part of the decaf orchestration framework
# All Rights Reserved.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at htt... |
from .optimizer import Optimizer
import numpy as np
import time
from multiprocessing import Pool
class ParticleBFGS(Optimizer):
"""
BFGS
"""
def __init__(self, alpha=0.01, beta=0.0, gamma=0.9, n_epochs=1, mini_batch_size=1, verbosity=2, weight_update="sd",
cost_freq=2, position_gra... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible 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 o... |
from pycp2k.inputsection import InputSection
class _each263(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Just_energy = None
self.Powell_opt = None
self.Qs_scf = None
self.Xas_scf = None
self.Md = None
self.Pint = None
self.Meta... |
""" A neural chatbot using sequence to sequence model with
attentional decoder.
This is based on Google Translate Tensorflow model
https://github.com/tensorflow/models/blob/master/tutorials/rnn/translate/
Sequence to sequence model by Cho et al.(2014)
Created by Chip Huyen as the starter code for assignment 3,
cla... |
""" Cisco_IOS_XR_ipv4_telnet_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR ipv4\-telnet package configuration.
This module contains definitions
for the following management objects\:
ipv6\-telnet\: IPv6 telnet configuration
ipv4\-telnet\: ipv4 telnet
Copyright (c) 2013\-2016 by Cis... |
import vivisect.exc as viv_exc
class VivColorMap:
'''
An easier to use color map object.
'''
def __init__(self, vw):
self.vw = vw
self.cmap = {}
def colorVa(self, va, color):
'''
Set the color for a particular virtual memory location
when viewed with this ... |
# Copyright (C) 2013 Adam Stokes <[EMAIL]>
#
# 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 distrib... |
"""
Implementation of the CyberSource credit card processor using the newer "Secure Acceptance API".
The previous Hosted Order Page API is being deprecated as of 9/14.
For now, we're keeping the older implementation in the code-base so we can
quickly roll-back by updating the configuration. Eventually, we should repl... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
# @author: Emanuel Cino <[EMAIL]>
#
# The licence is in the file __manifest__.py
#
#############################################################... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'TVALogging'
db.create_table(u'accounting_core_tvalogging'... |
"""
EM example: Gaussian Mixture Models
-----------------------------------
Figure 6.6
A two-dimensional mixture of Gaussians for the stellar metallicity data. The
left panel shows the number density of stars as a function of two measures of
their chemical composition: metallicity ([Fe/H]) and alpha-element abundance
... |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
class GithubSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# scrapy ac... |
"""
POLL APP
This module provides an interface for users to interact
with the poll model.
Classes:
PollAnswer
PollQuestion
PollResults
Functions:
n/a
Created on 05 Mar 2013
@author: michael
"""
from django.conf import settings
from django.template.loader import render_to_string
from django.templat... |
from functools import *
from .nabar import *
from .form import *
from .auth import *
from .box import *
from .page import *
from .hook import *
from .email import *
from .action import *
from .access import *
from .ws_action import *
from .admin import *
class AccountExceptionBase(Exception):
''... |
import pyblish.api
import pymel
@pyblish.api.log
class CollectModel(pyblish.api.Collector):
"""Inject all models from the scene into the context"""
def process(self, context):
sets = pymel.core.ls(sets=True)
for obj in sets:
extensions = ['geo', 'geh', 'gep']
if any... |
'''Kivy Language
=============
The Kivy language is a language dedicated to describing user interface and
interactions. You could compare this language to Qt's QML
(http://qt.nokia.com), but we included new concepts such as rule definitions
(which are somewhat akin to what you may know from CSS), templating and so on.... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
"""
Views for OCL Sources and Source Versions.
"""
import re
import requests
import logging
import json
from django.http import HttpResponse
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from django.http import (HttpResponseRedirect, Http404, QueryDict)
from django.view... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
"""The Odoo API module defines Odoo Environments and method decorators.
.. todo:: Document this module
"""
__all__ = [
'Environment',
'Meta',
'model',
'constrains', 'depends', 'onchange', 'returns',
... |
'''
Created on 4 Sep 2015
@author: maxz
'''
import unittest
import numpy as np
import GPy
class BGPLVMTest(unittest.TestCase):
def setUp(self):
np.random.seed(12345)
X, W = np.random.normal(0,1,(100,6)), np.random.normal(0,1,(6,13))
Y = X.dot(W) + np.random.normal(0, .1, (X.shape[0], W.s... |
#coding:utf-8
import tempfile
import shutil
import os
import unittest2 as unittest
import django.conf
from cactus import Site
from cactus.bootstrap import bootstrap
from cactus.config.router import ConfigRouter
from cactus.utils.parallel import PARALLEL_DISABLED
class BaseTestCase(unittest.TestCase):
def setUp... |
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from mousestyles import data
from mousestyles.classification import clustering
def test_prep_data():
# Check prep_data return the correct dimension
mouse_data = data.load_all_features()
preped_dat... |
#!/usr/bin/env python3
# Copyright © 2012-13 Qtrac Ltd. All rights reserved.
# This program or module 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 ... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2009, Roboterclub Aachen e.V.
# 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 ... |
from django.core.exceptions import PermissionDenied
from django.http import Http404
def get_object_for_view_or_404(klass, request, *args, select_related=None, with_subclasses=False, **kwargs):
objs = klass.get_view_qs(request.user).filter(*args, **kwargs)
if select_related:
objs = objs.select_related(*select_rela... |
"""The tests for the hassio component."""
import aiohttp
import pytest
from homeassistant.components.hassio.handler import HassioAPIError
async def test_api_ping(hassio_handler, aioclient_mock):
"""Test setup with API ping."""
aioclient_mock.get(
"http://127.0.0.1/supervisor/ping", json={'result': '... |
import logging
import requests
from django.conf import settings
from django.core.cache import cache
from treeherder.client import TreeherderResultSetCollection
from treeherder.etl.common import generate_revision_hash, get_not_found_onhold_push
from .mixins import JsonExtractorMixin, OAuthLoaderMixin
logger = loggin... |
# Copyright (c) 2016 RIPE NCC
#
# 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 h... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2010-2012 Elico Corp. All Rights Reserved.
# Author: Yannick Gouin <[EMAIL]>
#
# This program is free software: you can redistribute it and/or m... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009 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 ... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright 2016 sadikovi
#
# 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 requir... |
# Copyright 2015 NEC 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
#!/usr/bin/env python3
# Quantopian, Inc. licenses this file to you 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 ... |
# -*- coding: utf-8 -*-
# legume. Copyright 2009-2013 Dale Reidy. All rights reserved.
# See LICENSE for details.
__docformat__ = 'restructuredtext'
class Metrics(object):
@property
def latency(self):
'''Round-trip latency in ms'''
return 0
@property
def out_buffer_bytes(self):
... |
# coding=utf8
## ChainedXML module
#
# Wraps ELementTree classes into a more easily usable interface
#
# @author Chris Nasr
# @copyright FUEL for the FIRE
# @created 2015-09-10
# Import python core modules
import xml.etree.ElementTree as ET
from StringIO import StringIO
## New
#
# Starts a new XML document and return... |
from __future__ import unicode_literals
from .grammar import COMMAND_GRAMMAR
__all__ = (
'CommandPreviewer',
)
class CommandPreviewer(object):
"""
Already show the effect of Vi commands before enter is pressed.
"""
def __init__(self, editor):
self.editor = editor
def save(self):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.