text
stringlengths
475
200k
from math import sqrt,cos,sin,atan2,ceil,floor,log10,pi,atan,tan from log import Warn try: from math import fsum except ImportError: from mymath import fsum ## MISC MATH FUNCTIONS ## def Mean(numbers): "Returns the arithmetic mean of a numeric list." return fsum(numbers) / len(numbers) def InBound...
""" A testcase which accesses *values* in a dll. """ import unittest from ctypes import * import _ctypes_test class ValuesTestCase(unittest.TestCase): def test_an_integer(self): # This test checks and changes an integer stored inside the # _ctypes_test dll/shared lib. ctdll...
#!/usr/bin/env python """ This example illustrates the sudden appearance of a giant connected component in a binomial random graph. Requires pygraphviz and matplotlib to draw. """ # Copyright (C) 2006-2008 # Aric Hagberg <[EMAIL]> # Dan Schult <[EMAIL]> # Pieter Swart <[EMAIL]> # All rights reserved. ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # *************************************************************************** # * * # * Copyright (c) 2016 execuc * # * ...
""" Code for plotting curves with tangent lines. """ __author__ = "Ian Goodfellow" try: from matplotlib import pyplot except Exception: pyplot = None from theano.compat.six.moves import xrange def tangent_plot(x, y, s): """ Plots a curve with tangent lines. Parameters ---------- x : lis...
# sqlite/pysqlite.py # Copyright (C) 2005-2014 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """ .. dialect:: sqlite+pysqlite :name: pysqlite :dbapi: sqlite3 :con...
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
from __future__ import absolute_import import logging from flask import request # TODO right now we are only logging exceptions. We should probably # add support for some INFO and maybe DEBUG level logging (like, log each time # a endpoint is hit, etc.) class RequestFilter(logging.Filter): """ Adds Flask's requ...
""" ============================================= A demo of the Spectral Biclustering algorithm ============================================= This example demonstrates how to generate a checkerboard dataset and bicluster it using the Spectral Biclustering algorithm. The data is generated with the ``make_checkerboard`...
# -*-python-*- # GemRB - Infinity Engine Emulator # Copyright (C) 2003 The GemRB Project # # 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) ...
"""Support for Aqualink pool feature switches.""" from homeassistant.components.switch import DOMAIN, SwitchEntity from homeassistant.config_entries import ConfigEntry from homeassistant.helpers.typing import HomeAssistantType from . import AqualinkEntity, refresh_system from .const import DOMAIN as AQUALINK_DOMAIN P...
# -*- coding: utf-8 -*- ########################## Copyrights and license ############################ # # # Copyright 2011-2015 Christian Lupien <[EMAIL]> # # # # T...
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import os import shutil import tempfile import unittest import mock import sys import run_gpu_integration_test import gpu_project_config from gp...
# Copyright (c) 2007 The Hewlett-Packard Development Company # All rights reserved. # # The license below extends only to copyright in the software and shall # not be construed as granting a license to any other intellectual # property including but not limited to intellectual property relating # to a hardware implemen...
# (c) 2012-2014, Toshio Kuratomi <[EMAIL]> # # 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....
# -*- encoding: utf-8 -*- # # Copyright © 2012 New Dream Network, LLC (DreamHost) # # Author: Doug Hellmann <[EMAIL]> # # 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.apach...
# -*- coding: utf-8 -*- from django.conf.urls import patterns, url urlpatterns = patterns( 'dnd.spells.views', # spells url( r'^$', 'spell_index', name='spell_index', ), # spells > rulebook url( r'^(?P<rulebook_slug>[^/]+)--(?P<rulebook_id>\d+)/$', 'sp...
""" Adapted from: https://docs.python.org/3.4/howto/sockets.html TODO: Get this based on tornado TCPClient class instead of this half baked thing TODO: Do co-routines *or* callbacks. This goes for the whole thing, not just this class. """ import socket from tornado import ( gen, ) class DriverClient:...
import unittest import os import shutil from penguin.main import newSite, buildSite, publishPosts from penguin.penguin import Penguin class TestContentCreation(unittest.TestCase): def test_build_project(self): newSite('test_site') os.chdir('test_site') site = Penguin() buildSite(s...
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
#!/usr/bin/env python # sorry, this is very ugly, but I'm in python 2.5 import sys sys.path.insert(0,"../..") from dot11 import Dot11, Dot11Types, Dot11ManagementFrame, Dot11ManagementAssociationResponse from ImpactDecoder import RadioTapDecoder from binascii import hexlify import unittest class TestDot11ManagementA...
#!/usr/bin/python3 # # Copyright (C) 2014 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # ...
"""Tests for embargo app views. """ import unittest from mock import patch from django.test import TestCase from django.core.urlresolvers import reverse from django.conf import settings from mako.exceptions import TopLevelLookupException import ddt from util.testing import UrlResetMixin from embargo import messages ...
from __future__ import print_function, division from sympy.tensor.indexed import Idx from sympy.core.mul import Mul from sympy.core.singleton import S from sympy.core.symbol import symbols from sympy.concrete.expr_with_intlimits import ExprWithIntLimits from sympy.functions.elementary.exponential import exp, log from ...
from functions import * """IMAP Fuzzer""" PROPERTY={} PROPERTY['PROTOCOL']="IMAP" PROPERTY['NAME']=": IMAP Fuzzer" PROPERTY['DESC']="Fuzz an IMAP server" PROPERTY['AUTHOR']='localh0t' user_stage = ['. login'] pass_stage = ['. login [EMAIL]'] stage_1 = ['. list ""','. lsub ""', '. status INBOX','. examine','. select','...
from idlelib.WidgetRedirector import WidgetRedirector from idlelib.Delegator import Delegator class Percolator: def __init__(self, text): # XXX would be nice to inherit from Delegator self.text = text self.redir = WidgetRedirector(text) self.top = self.bottom = Delegator(text) ...
import serial import string import math import time from Tkinter import * from threading import Timer comPort = '/dev/ttyACM0' #default com port comPortBaud = 38400 class App: grid_size = 15 num_pixels = 30 image_started = FALSE image_current_row = 0; ser = serial.Serial(comPort,...
import django from django.core.management.base import BaseCommand from django.conf import settings import os import sys class Command(BaseCommand): help = "Runs this project as a uWSGI application. Requires the uwsgi binary in system path." http_port = '8000' socket_addr = None def handle(self, *arg...
from __future__ import absolute_import, division, print_function import sys import pytest from _pytest.compat import is_generator, get_real_func, safe_getattr from _pytest.outcomes import OutcomeException def test_is_generator(): def zap(): yield def foo(): pass assert is_generator(zap...
from django.http import HttpResponse, Http404 from django.template import loader from django.contrib.sites.models import get_current_site from django.core import urlresolvers from django.core.paginator import EmptyPage, PageNotAnInteger from django.contrib.gis.db.models.fields import GeometryField from django.db import...
from __future__ import print_function, division from sympy.core import S, Add, Expr from sympy.assumptions import Q, ask from sympy.core.logic import fuzzy_not def refine(expr, assumptions=True): """ Simplify an expression using assumptions. Gives the form of expr that would be obtained if symbols i...
# -*- coding: utf-8 -*- # test_commit.py # Copyright (C) 2008, 2009 Michael Trier ([EMAIL]) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php from __future__ import print_function from git.test.lib import ( TestBase, ...
from django.template.defaultfilters import striptags from django.test import SimpleTestCase from django.utils.functional import lazystr from django.utils.safestring import mark_safe from ..utils import setup class StriptagsTests(SimpleTestCase): @setup({'striptags01': '{{ a|striptags }} {{ b|striptags }}'}) ...
# -*- encoding:utf-8 -*- from mako import runtime, filters, cache UNDEFINED = runtime.UNDEFINED __M_dict_builtin = dict __M_locals_builtin = locals _magic_number = 6 _modified_time = 1367126126.936375 _template_filename='htdocs/login.mako' _template_uri='login.mako' _template_cache=cache.Cache(__name__, _modified_time)...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2008 Søren Roug, European Environment Agency # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the Licens...
import unittest from quick_sort_concept import quick_sort class QuickSortTest(unittest.TestCase): def test_quick_sort_random_1(self): data = [4, 1, 10, 4, 4, 3, 9, 4, 1, 9] expected = [1, 1, 3, 4, 4, 4, 4, 9, 9, 10] output = quick_sort(data) self.assertEqual(expected, ...
import hashlib import logging import os import shutil from typing import Generator, Optional, Dict, Any from dataclasses import dataclass from opentrons.config import CONFIG from opentrons.system import nmcli log = logging.getLogger(__name__) class ConfigureArgsError(Exception): pass EAP_CONFIG_SHAPE = { ...
import datetime from django.conf import settings from django.contrib.sites.models import get_current_site from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist from django.http import HttpResponse, Http404 from django.template import loader, Template, TemplateDoesNotExist, RequestContext from djan...
""" Blender API for querying mesh data. Animation data is also handled here since Three.js associates the animation (skeletal, morph targets) with the geometry nodes. """ import operator from bpy import data, types, context from . import material, texture, animation from . import object as object_ from .. import const...
#!/usr/bin/env python # -*- coding: utf-8 -*- from runner.koan import * class AboutClasses(Koan): class Dog: "Dogs need regular walkies. Never, ever let them drive." def test_instances_of_classes_can_be_created_adding_parentheses(self): # NOTE: The .__name__ attribute will convert the class ...
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2013 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 your option) a...
""" Tools for memoization of function results. """ from functools import wraps from six import iteritems from weakref import WeakKeyDictionary class lazyval(object): """ Decorator that marks that an attribute should not be computed until needed, and that the value should be memoized. Example ----...
# (c) 2012, Michael DeHaan <[EMAIL]> # # 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. # # A...
""" =========== gaussfitter =========== .. codeauthor:: Adam Ginsburg <[EMAIL]> 3/17/08 Latest version available at <http://code.google.com/p/agpy/source/browse/trunk/agpy/gaussfitter.py> """ import numpy from numpy.ma import median from numpy import pi #from scipy import optimize,stats,pi from scipy.optimize import ...
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ExtractorError class TinyPicIE(InfoExtractor): IE_NAME = 'tinypic' IE_DESC = 'tinypic.com videos' _VALID_URL = r'http://(?:.+?\.)?tinypic\.com/player\.php\?v=(?P<id>[^&]+)&s=\d+' _TESTS = [ ...
"""Soundex algorithm This program is part of "Dive Into Python", a free Python book for experienced programmers. Visit http://diveintopython.org/ for the latest version. """ __author__ = "Mark Pilgrim ([EMAIL])" __version__ = "$Revision: 1.2 $" __date__ = "$Date: 2004/05/06 21:36:36 $" __copyright__ = "Copyright (c)...
from django.db import models from django.core.urlresolvers import reverse from autoslug import AutoSlugField from model_utils.models import TimeStampedModel from django_countries.fields import CountryField class Player(TimeStampedModel): GROUP_UNSPECIFIED = "unspecified" GROUP_FIRST = "first" GROUP_SECOND...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2005-2010 ActiveState Software Inc. # Copyright (c) 2013 Eddy Petrișor """Utilities for determining application-specific dirs. See <http://github.com/ActiveState/appdirs> for details and usage. """ # Dev Notes: # - MSDN on where to store app data files: # ...
#!/usr/bin/env python # Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies that a dependency on a bundle causes the whole bundle to be built. """ import TestGyp import sys if sys.platform == 'darwin'...
# # Module providing various facilities to other parts of the package # # multiprocessing/util.py # # Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt # import itertools import weakref import atexit import threading # we want threading to install it's # cleanup function before mult...
# -*- coding: utf-8 -*- """QGIS Unit tests for QgsMapCanvas .. 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. """ __aut...
#!/usr/bin/env python from __future__ import absolute_import, division, print_function, with_statement import logging import os import signal import subprocess import sys from tornado.httpclient import HTTPClient, HTTPError from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop from tornado.log i...
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2014, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions ...
import random import gym import numpy as np from collections import deque from tensorflow.contrib.keras.python.keras.models import Sequential from tensorflow.contrib.keras.python.keras.layers import Dense from tensorflow.contrib.keras.python.keras.optimizers import Adam from tensorflow.contrib.keras.python.keras...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Business Applications # Copyright (c) 2013-TODAY OpenERP S.A. <http://openerp.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of ...
# Copyright 2013 Dean Gardiner <[EMAIL]> # # 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...
""" A top-level linear programming interface. Currently this interface solves linear programming problems via the Simplex and Interior-Point methods. .. versionadded:: 0.15.0 Functions --------- .. autosummary:: :toctree: generated/ linprog linprog_verbose_callback linprog_terse_callback """ import ...
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2015, John McNamara, [EMAIL] # from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """ Test f...
import numpy as np from perceptron import Perceptron class Adaline(Perceptron): """ Implementation of an Adaptive Linear Neuron, that can be abstracted to various input sizes or dimensions. Displays using pyplot. """ ETA = 1 def __init__(self, grph, eta, max_t): Perceptron.__init__(se...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (c) 2012 Acysos S.L. (http://acysos.com) # Ignacio Ibeas <[EMAIL]> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU ...
# Copyright (C) 2014-2015 Andrey Antukh <[EMAIL]> # Copyright (C) 2014-2015 Jesús Espino <[EMAIL]> # Copyright (C) 2014-2015 David Barragán <[EMAIL]> # 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 F...
#!/usr/bin/env python # Copyright (c) 2013 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies that xctest targets are correctly configured. """ import TestGyp import sys if sys.platform == 'darwin': test = TestGyp.Te...
"""Detect structural variation in genomes using high-throughput sequencing data. """ import collections import copy import operator import toolz as tz from bcbio.pipeline import datadict as dd from bcbio.structural import (battenberg, cn_mops, cnvkit, delly, lumpy, manta, metasv, plot, v...
# Text Drawing # # This example shows off drawing text on the OpenMV Cam. import sensor, image, time, pyb sensor.reset() sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE... sensor.set_framesize(sensor.QVGA) # or QQVGA... sensor.skip_frames(time = 2000) clock = time.clock() while(True): clock.tick() img = ...
# # This file is part of pyasn1 software. # # Copyright (c) 2005-2020, Ilya Etingof <[EMAIL]> # License: http://snmplabs.com/pyasn1/license.html # import sys import unittest from tests.base import BaseTestCase from pyasn1.type import constraint from pyasn1.type import error class SingleValueConstraintTestCase(BaseT...
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2015, Ansible Project # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
"""Heap queue algorithm (a.k.a. priority queue). Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for all k, counting elements from 0. For the sake of comparison, non-existing elements are considered to be infinite. The interesting property of a heap is that a[0] is always its smallest element. Usag...
from django.template.defaultfilters import wordwrap from django.test import SimpleTestCase from django.utils.functional import lazystr from django.utils.safestring import mark_safe from ..utils import setup class WordwrapTests(SimpleTestCase): @setup({'wordwrap01': '{% autoescape off %}{{ a|wordwrap:"3"...
# The MIT License (MIT) # # Copyright (c) 2014 Richard Moore # # 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, mod...
# -*- coding: utf-8 -*- import calendar from bson import ObjectId from datetime import datetime from modularodm import fields, Q from framework.mongo import StoredObject from framework.guid.model import GuidStoredObject from website.settings import DOMAIN from website.util import web_url_for, api_url_for from websi...
#!/usr/bin/env python # # Copyright (C) 2010-2011 Hideo Hattori # Copyright (C) 2011-2013 Hideo Hattori, Steven Myint # Copyright (C) 2013-2015 Hideo Hattori, Steven Myint, Bill Wendling # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation file...
class AppSettings(object): def __init__(self, prefix): self.prefix = prefix def _setting(self, name, dflt): from django.conf import settings getter = getattr(settings, 'ALLAUTH_SETTING_GETTER', lambda name, dflt: getattr(settings, name,...
# 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"); you may not u...
# Copyright (c) 2012 Florian Mounier # Copyright (c) 2012 roger # Copyright (c) 2013 Tao Sauvage # Copyright (c) 2013 Craig Barnes # Copyright (c) 2014 Sean Vig # Copyright (c) 2014 Adi Sieker # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentatio...
from __future__ import unicode_literals import cgi import codecs import logging import sys import warnings from io import BytesIO from threading import Lock from django import http from django.conf import settings from django.core import signals from django.core.handlers import base from django.core.urlresolvers impo...
from django.core.management.base import NoArgsCommand def module_to_dict(module, omittable=lambda k: k.startswith('_')): "Converts a module namespace to a Python dictionary. Used by get_settings_diff." return dict([(k, repr(v)) for k, v in module.__dict__.items() if not omittable(k)]) class Command(NoArgsComm...
# Copyright 2017 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 a...
""" Input module. Contains functions to read element, Slater-Koster and repulsion data. """ def read_element(filename, symbol, format=None): """ Read element data from files. Parameters: ----------- fileobj: filename of file-object to read from symbol: chemical symbol of the element "...
# -*- coding: utf-8 -*- """ pygments.lexers._openedgebuiltins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Builtin list for the OpenEdgeLexer. :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ OPENEDGEKEYWORDS = [ 'ABSOLUTE', 'ABS', 'ABSO', 'A...
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer....
"""Reproduce an Water heater state.""" import asyncio import logging from typing import Any, Dict, Iterable, Optional from homeassistant.const import ( ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_OFF, STATE_ON, ) from homeassistant.core import Context, State from homeassistant.helpers....
# These classes implement a doctest runner plugin for nose, a "known failure" # error class, and a customized TestProgram for NumPy. # Because this module imports nose directly, it should not # be used except by nosetester.py to avoid a general NumPy # dependency on nose. from __future__ import division, absolute_impo...
""" Use BDDs to solve SAT problems from DIMACS files. TODO: try the tableau method too """ import bddsat import dimacs import sat # Some problems from http://toughsat.appspot.com/ filenames = ['problems/trivial.dimacs', 'problems/factoring6.dimacs', 'problems/factoring2.dimacs', ...
# Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redi...
from __future__ import absolute_import """ Tests for the incremental XML serialisation API. From lxml """ from io import BytesIO import unittest import tempfile, os, sys from .common_imports import etree, HelperTestCase, skipIf from .. import xmlfile as etree import pytest from openpyxl.tests.helper import compar...
# Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Class representing instrumentation test apk and jar.""" import os from pylib.instrumentation import test_jar from pylib.utils import apk_helper cl...
from django.forms import ChoiceField, Field, Form, Select from django.test import SimpleTestCase class BasicFieldsTests(SimpleTestCase): def test_field_sets_widget_is_required(self): self.assertTrue(Field(required=True).widget.is_required) self.assertFalse(Field(required=False).widget.is_required...
from django.test import TestCase from django.core.management import call_command from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from userena.models import UserenaSignup from userena.managers import ASSIGNED_PERMISSIONS from userena import settings as useren...
# -*- 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...
def WebIDLTest(parser, harness): threw = False try: parser.parse(""" interface IdentifierConflictAcrossMembers1 { const byte thing1 = 1; readonly attribute long thing1; }; """) results = parser.finish() except: threw = True...
from __future__ import absolute_import import logging from django.db import IntegrityError, transaction from django.db.models import Q from django.utils import timezone from rest_framework.permissions import IsAuthenticated from sentry.api.base import Endpoint from sentry.api.exceptions import ResourceDoesNotExist f...
#!/usr/bin/python # Generate GLib GInterfaces from the Telepathy specification. # The master copy of this program is in the telepathy-glib repository - # please make any changes there. # # Copyright (C) 2006, 2007 Collabora Limited # # This library is free software; you can redistribute it and/or # modify it under the...
""" Utils called from project_root/docs/conf.py when Sphinx documentation is generated. """ from __future__ import division, print_function, unicode_literals from future.builtins import map, open, str from collections import OrderedDict from datetime import datetime import os.path from shutil import copyfile, move fro...
#!/usr/bin/python ## # Copyright 2012-2013 Ghent University # # This file is part of EasyBuild, # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), # with support of Ghent University (http://ugent.be/hpc), # the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en), # the Hercul...
"""Support functions for geographic operations""" def aspect(df): """Return the aspect ratio of a Geopandas dataset""" tb = df.total_bounds return abs((tb[0] - tb[2]) / (tb[1] - tb[3])) def scale(df, x): """Given an x dimension, return the x and y dimensions to maintain the dataframe aspect ratio"""...
# Copyright (c) 2005-2006 The Regents of The University of Michigan # 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 ...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
import sys import mock import pytest from os.path import join, dirname sys.path.insert(0, join(dirname(__file__), "..", "..", "..")) sauce = pytest.importorskip("wptrunner.browsers.sauce") from wptserve.config import ConfigBuilder def test_sauceconnect_success(): with mock.patch.object(sauce.SauceConnect, "u...