code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from .base import ObjectBase
class Capture(ObjectBase):
@classmethod
def get_resource_class(cls, client):
from ..resources.captures import Captures
return Captures(client)
@property
def id(self):
return self._get_property("id")
@property
def mode(self):
retur... | mollie/mollie-api-python | mollie/api/objects/capture.py | Python | bsd-2-clause | 1,458 |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 26 20:17:06 2014
@author: stuart
"""
import os
import tempfile
import datetime
import astropy.table
import astropy.time
import astropy.units as u
import pytest
from sunpy.time import parse_time
from sunpy.net.jsoc import JSOCClient, JSOCResponse
from sunpy.net.vso.vso im... | Alex-Ian-Hamilton/sunpy | sunpy/net/jsoc/tests/test_jsoc.py | Python | bsd-2-clause | 8,635 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
"""
Example:
$ python pydy_double_pendulum.py --plot --nt 200
"""
import numpy as np
from pyodesys.symbolic import SymbolicSys
from pyodesys.util import stack_1d_on_left
def get_equations(m_val, g_val... | bjodah/pyodesys | examples/pydy_double_pendulum.py | Python | bsd-2-clause | 2,949 |
from django.conf import settings
from django.forms import widgets
class GoogleMapsAddressWidget(widgets.TextInput):
"""a widget that will place a google map right after the #id_address field"""
template_name = "django_google_maps/widgets/map_widget.html"
class Media:
css = {
'all': ('... | madisona/django-google-maps | django_google_maps/widgets.py | Python | bsd-2-clause | 671 |
#!/usr/bin/python env
"""
This module contains symbolic implementations of VEX operations.
"""
import re
import sys
import collections
import itertools
import operator
import logging
l = logging.getLogger("angr.engines.vex.irop")
import pyvex
import claripy
#
# The more sane approach
#
def op_attrs(p):
m = re.... | Ruide/angr-dev | angr/angr/engines/vex/irop.py | Python | bsd-2-clause | 34,780 |
from setuptools import setup, find_packages
setup(
name = 'evernote',
version = '1.22',
author = 'Evernote Corporation',
author_email = 'en-support@evernote.com',
url = 'http://www.evernote.com/about/developer/api/',
description = 'Python bindings to the Evernote API.',
packages = find_pack... | zapier/evernote-sdk-python-old | setup.py | Python | bsd-2-clause | 366 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils import timezone
from parler.managers import TranslatableManager, TranslatableQuerySet
class PostQuerySet(TranslatableQuerySet):
def published(self, **kwargs):
return self.filter(date_published__lte=timezone.now(), **kwargs)... | dinoperovic/djangocms-blogit | blogit/managers.py | Python | bsd-3-clause | 1,157 |
from django.db import models
from django.contrib import admin
class Company(models.Model):
company = models.CharField(u'Компания', max_length=100)
logo = models.ImageField(u'Логотип', upload_to='logos/', blank=True)
def __unicode__(self):
return self.company
class Meta:
v... | AlexStarov/site_news | Apps/fuel/models.py | Python | bsd-3-clause | 1,375 |
import os
import glob
import re
import shutil
import sys
import six
import nbgrader.apps
from textwrap import dedent
from clear_docs import run, clear_notebooks
def autogen_command_line(root):
"""Generate command line documentation."""
header = dedent(
"""
``{}``
====================... | dementrock/nbgrader | docs/source/build_docs.py | Python | bsd-3-clause | 3,741 |
from __future__ import print_function, division, absolute_import #, unicode_literals # not casa compatible
from builtins import bytes, dict, object, range, map, input#, str # not casa compatible
from future.utils import itervalues, viewitems, iteritems, listvalues, listitems
from io import open
import os.path
import s... | caseyjlaw/vlart | realfast/elastic.py | Python | bsd-3-clause | 45,120 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Daniel Zhang (張道博)'
__copyright__ = 'Copyright (c) 2013, University of Hawaii Smart Energy Project'
__license__ = 'https://raw.github' \
'.com/Hawaii-Smart-Energy-Project/Maui-Smart-Grid/master/BSD' \
'-LICENSE.txt'
from msg_db_co... | Hawaii-Smart-Energy-Project/Maui-Smart-Grid | src/meco_db_read.py | Python | bsd-3-clause | 2,247 |
from django.utils import timezone
from test_plus import TestCase
from .factories import WineFactory, ReviewFactory
class TestWine(TestCase):
wine = WineFactory()
def test__str__(self):
self.assertEqual(
self.wine.__str__(),
'Alvaro Palacios Finca Dofi 1991'
)
class ... | REBradley/WineArb | winearb/reviews/tests/test_models.py | Python | bsd-3-clause | 569 |
# BSD Licence
# Copyright (c) 2012, Science & Technology Facilities Council (STFC)
# All rights reserved.
#
# See the LICENSE file in the source distribution of this software for
# the full license text.
'''
Functions for manipulating URLs.
Created on 27 Sep 2011
@author: rwilkinson
'''
import urlparse
def get_base... | cedadev/dapbench | dapbench/thredds/lib/url_util.py | Python | bsd-3-clause | 2,448 |
"""Compiler for Netkit"""
import os
import autonetkit
import autonetkit.config
import autonetkit.log as log
import autonetkit.plugins.naming as naming
from autonetkit.compilers.platform.platform_base import PlatformCompiler
import string
import itertools
from autonetkit.ank_utils import alphabetical_sort as alpha_sort
... | sysbot/autonetkit | autonetkit/compilers/platform/netkit.py | Python | bsd-3-clause | 5,735 |
#!/usr/bin/env python2.7
# Copyright 2017, Google 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 lis... | infinit/grpc | tools/run_tests/run_microbenchmark.py | Python | bsd-3-clause | 8,954 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.conf import settings
class Migration(SchemaMigration):
def forwards(self, orm):
db_engine = settings.DATABASES['default']['ENGINE']
if db_engine.r... | praekelt/django-atlas | atlas/migrations/0001_initial.py | Python | bsd-3-clause | 13,923 |
"""Endpoint Device Types Class."""
from fmcapi.api_objects.apiclasstemplate import APIClassTemplate
import logging
class EndPointDeviceTypes(APIClassTemplate):
"""The EndPointDeviceTypes Object in the FMC."""
VALID_JSON_DATA = [
"id",
"name",
"type",
"fqName",
"iseId"... | daxm/fmcapi | fmcapi/api_objects/object_services/endpointdevicetypes.py | Python | bsd-3-clause | 1,425 |
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from django.core.exceptions import ValidationError
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from... | aykut/django-oscar | oscar/apps/promotions/models.py | Python | bsd-3-clause | 6,141 |
from ... import options as opts
optimize_flags = {
opts.OptimizeValue.disable : '-O0',
opts.OptimizeValue.size : '-Osize',
opts.OptimizeValue.speed : '-O3',
opts.OptimizeValue.linktime: '-flto',
}
| jimporter/bfg9000 | bfg9000/tools/cc/flags.py | Python | bsd-3-clause | 219 |
__author__ = "paul.tunison@kitware.com"
import mock
import nose.tools as ntools
import os
import unittest
from smqtk.representation.data_element.file_element import DataFileElement
from smqtk.tests import TEST_DATA_DIR
class TestDataFileElement (unittest.TestCase):
def test_init_filepath_abs(self):
fp ... | kfieldho/SMQTK | python/smqtk/tests/representation/DataElement/test_DataFileElement.py | Python | bsd-3-clause | 4,839 |
"""Sparse accessor"""
import numpy as np
from pandas.compat._optional import import_optional_dependency
from pandas.core.dtypes.cast import find_common_type
from pandas.core.accessor import PandasDelegate, delegate_names
from pandas.core.arrays.sparse.array import SparseArray
from pandas.core.arrays.sparse.dtype im... | jreback/pandas | pandas/core/arrays/sparse/accessor.py | Python | bsd-3-clause | 11,453 |
"""
This class is used by test_pageobjects
"""
from cumulusci.robotframework.pageobjects import BasePage
from cumulusci.robotframework.pageobjects import pageobject
@pageobject(page_type="Test", object_name="Bar__c")
class BarTestPage(BasePage):
def bar_keyword_1(self, message):
self.builtin.log(message)
... | SalesforceFoundation/CumulusCI | cumulusci/core/tests/BarTestPage.py | Python | bsd-3-clause | 479 |
""" test to_datetime """
import calendar
from collections import deque
from datetime import (
datetime,
timedelta,
)
from decimal import Decimal
import locale
from dateutil.parser import parse
from dateutil.tz.tz import tzoffset
import numpy as np
import pytest
import pytz
from pandas._libs import tslib
from... | jorisvandenbossche/pandas | pandas/tests/tools/test_to_datetime.py | Python | bsd-3-clause | 100,614 |
from contextlib import suppress
import logging
import warnings
import weakref
from tornado.httpserver import HTTPServer
import tlz
import dask
from .comm import get_tcp_server_address
from .comm import get_address_host
from .core import Server
from .http.routing import RoutingApplication
from .versions import get_ver... | blaze/distributed | distributed/node.py | Python | bsd-3-clause | 5,452 |
"""
Metrics API module: http://metrics-api.wikimedia.org/
Defines the API which exposes metrics on Wikipedia users. The metrics
are defined at https://meta.wikimedia.org/wiki/Research:Metrics.
"""
from user_metrics.utils import nested_import
from user_metrics.config import settings
from user_metrics.api.... | wikimedia/analytics-user-metrics | user_metrics/api/__init__.py | Python | bsd-3-clause | 1,422 |
"""
resourceview.py
Contains administrative views for working with resources.
"""
from datetime import date
from admin_helpers import *
from sqlalchemy import or_, not_, func
from flask import current_app, redirect, flash, request, url_for
from flask.ext.admin import BaseView, expose
from flask.ext.admin.actions im... | AllieDeford/radremedy | remedy/admin_views/resourceview.py | Python | bsd-3-clause | 17,605 |
# -*- coding: utf-8 -*-
"""
See PEP 386 (http://www.python.org/dev/peps/pep-0386/)
Release logic:
1. Remove "dev" from current.
2. git commit
3. git tag <version>
4. push to pypi + push to github
5. bump the version, append '.dev0'
6. git commit
7. push to github (to avoid confusion)
"""
__version__ = '0.0.1dev0' | adsworth/django-onetomany | onetomany/__init__.py | Python | bsd-3-clause | 315 |
"""
Classes and utilities for extracting haiku from arbitrary text and evaluating them based on some programmatically
defined criteria
"""
import nltk
import string
from nltk.corpus import cmudict
from nltk_util import syllables_en
from haikus.evaluators import DEFAULT_HAIKU_EVALUATORS
global WORD_DICT
try:
WORD_D... | wieden-kennedy/haikus | haikus/haikutext.py | Python | bsd-3-clause | 5,501 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..surface import ProbeVolumeWithModel
def test_ProbeVolumeWithModel_inputs():
input_map = dict(InputModel=dict(argstr='%s',
position=-2,
),
InputVolume=dict(argstr='%s',
position=-3,
),
Outpu... | mick-d/nipype | nipype/interfaces/slicer/tests/test_auto_ProbeVolumeWithModel.py | Python | bsd-3-clause | 1,175 |
'''
Copyright (C) 2012-2015 Diego Torres Milano
Created on Dec 1, 2012
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... | NetEase/airtest | airtest/device/adb/adbclient.py | Python | bsd-3-clause | 39,385 |
from datetime import datetime
import numpy as np
import pytest
from pytz import UTC
from pandas._libs.tslibs import (
OutOfBoundsTimedelta,
conversion,
iNaT,
timezones,
tzconversion,
)
from pandas import Timestamp, date_range
import pandas._testing as tm
def _compare_utc_to_local(tz_didx):
... | jreback/pandas | pandas/tests/tslibs/test_conversion.py | Python | bsd-3-clause | 3,973 |
"""
Here a list of proxy object that can be used when lazy=True at neo.io level.
This idea is to be able to postpone that real in memory loading
for objects that contains big data (AnalogSIgnal, SpikeTrain, Event, Epoch).
The implementation rely on neo.rawio, so it will available only for neo.io that
ineherits neo.ra... | JuliaSprenger/python-neo | neo/io/proxyobjects.py | Python | bsd-3-clause | 25,541 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Creates ERTs and convergence figures for multiple algorithms."""
from __future__ import absolute_import
import os
import matplotlib.pyplot as plt
import numpy
from pdb import set_trace
from .. import toolsdivers, toolsstats, bestalg, pproc, genericsettings, htmldesc, p... | oaelhara/numbbo | code-postprocessing/bbob_pproc/compall/ppfigs.py | Python | bsd-3-clause | 22,256 |
#!/usr/bin/env python
from art.splqueryutils.sessions import *
def output_highly_similar_sessions(threshhold=.5):
out = open('similar_sessions.out', 'w')
jsonfiles = get_json_files(limit=1000*BYTES_IN_MB)
all_sessions = sessionize_searches(jsonfiles)
for (user, user_sessions) in all_sessions.iteritems... | stevedh/queryutils | scripts/print_similar_sessions.py | Python | bsd-3-clause | 1,054 |
"""
Cement core handler module.
"""
import re
from ..core import exc, backend, meta
from ..utils.misc import minimal_logger
LOG = minimal_logger(__name__)
class CementBaseHandler(meta.MetaMixin):
"""Base handler class that all Cement Handlers should subclass from."""
class Meta:
"""
Hand... | rjdp/cement | cement/core/handler.py | Python | bsd-3-clause | 9,853 |
import typing
from ...core import AtomicExpr, Expr, Integer, Symbol, Tuple
from ...core.assumptions import StdFactKB
from ...core.decorators import _sympifyit, call_highest_priority
from ...core.logic import fuzzy_bool
from ...core.sympify import sympify
from ...functions import adjoint, conjugate
from ...logic import... | diofant/diofant | diofant/matrices/expressions/matexpr.py | Python | bsd-3-clause | 13,116 |
# -*- coding: utf-8 -*-
from raw._ebuttlm import *
from raw import _ebuttlm as raw
from raw import _ebuttp as ebuttp
from pyxb.utils.domutils import BindingDOMSupport
namespace_prefix_map = {
'ebuttlm': Namespace,
'ebuttp': ebuttp.Namespace
}
class message_type(raw.message_type):
@classmethod
def _... | ebu/ebu-tt-live-toolkit | ebu_tt_live/bindings/_ebuttlm.py | Python | bsd-3-clause | 1,100 |
from __future__ import unicode_literals
from six import with_metaclass
import django
from django.forms.models import (
BaseModelFormSet, modelformset_factory,
ModelForm, _get_foreign_key, ModelFormMetaclass, ModelFormOptions
)
if django.VERSION >= (1, 8):
# RelatedObject has been replaced with ForeignObj... | thenewguy/django-modelcluster | modelcluster/forms.py | Python | bsd-3-clause | 11,270 |
# *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
# ** Copyright UCAR (c) 1992 - 2014
# ** University Corporation for Atmospheric Research(UCAR)
# ** National Center for Atmospheric Research(NCAR)
# ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA
# ** See LICENSE.TXT for license detai... | ncareol/lrose-soloPy | lrose_solopy/QtVariant.py | Python | bsd-3-clause | 1,876 |
from pyglet.libs.darwin.cocoapy import *
class PygletWindow_Implementation:
PygletWindow = ObjCSubclass('NSWindow', 'PygletWindow')
@PygletWindow.method('B')
def canBecomeKeyWindow(self):
return True
# When the window is being resized, it enters into a mini event loop that
# only looks a... | bitcraft/pyglet | pyglet/window/cocoa/pyglet_window.py | Python | bsd-3-clause | 3,018 |
"""empty message
Revision ID: 5aa994117f07
Revises: 85a1c0888f3d
Create Date: 2017-09-28 04:03:38.834496
"""
# revision identifiers, used by Alembic.
revision = '5aa994117f07'
down_revision = '85a1c0888f3d'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy_utils.... | fake-name/ReadableWebProxy | alembic/versions/00032_5aa994117f07_.py | Python | bsd-3-clause | 1,162 |
DEV_SERVER = True
DEBUG = True
DATABASES = {
"default": {
# "postgresql_psycopg2", "postgresql", "mysql", "sqlite3" or "oracle".
"ENGINE": "sqlite3",
# DB name or path to database file if using sqlite3.
"NAME": "cartridge.db",
# Not used with sqlite3.
"USER": "",
... | pygloo/bewype-mezzanine-project | mezzype/local_settings.py | Python | bsd-3-clause | 558 |
from datetime import datetime
from decimal import Decimal
import os
from django import forms
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.forms.formsets import formset_factory
import commonware.log
import happyforms
from quieter_formset.formset import B... | jpetto/olympia | src/olympia/addons/forms.py | Python | bsd-3-clause | 28,545 |
import django_filters
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext_lazy as _
try:
from django_filters import rest_framework as filters
except ImportError: # Back-ward compatible for django-rest-framework<3.7
from rest_framework import filters
from rest_framework... | ad-m/django-teryt-tree | teryt_tree/rest_framework_ext/viewsets.py | Python | bsd-3-clause | 1,281 |
import warnings
from django.test import TestCase, Client
from django.test.utils import override_settings
from django.http import HttpRequest, Http404
from wagtail.wagtailcore.models import Page, Site
from wagtail.tests.models import EventPage, EventIndex, SimplePage, PageWithOldStyleRouteMethod
class TestSiteRoutin... | thenewguy/wagtail | wagtail/wagtailcore/tests/test_page_model.py | Python | bsd-3-clause | 21,035 |
# coding: utf-8
from __future__ import absolute_import, unicode_literals
from functools import total_ordering
from itertools import chain
from django.db.models.fields import FieldDoesNotExist
from django.utils import six
from django.utils.html import escape
from django.utils.safestring import mark_safe
class Sequen... | vicky2135/lucious | oscar/lib/python2.7/site-packages/django_tables2/utils.py | Python | bsd-3-clause | 17,566 |
#coding=utf-8
from django import template
import random
register = template.Library()
from django.db.models.query import QuerySet
@register.filter
def randomize(values):
if not isinstance(values, QuerySet):
if isinstance(values, list):
return random.shuffle(values)
return values
re... | nickburlett/feincms_gallery | gallery/templatetags/gallery_tags.py | Python | bsd-3-clause | 346 |
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test.client import Client
from easy_split.experiments.models import (AnonymousVisitor, Experiment,
GoalRecord, GoalType)
from easy_split.experiments.t... | Miserlou/django-easy-split | easy_split/tests/test_bug_view.py | Python | bsd-3-clause | 3,944 |
# 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 logging
import os
import shutil
import sys
import tempfile
_SRC_DIR = os.path.abspath(os.path.join(
os.path.dirname(__file__), '..', ... | was4444/chromium.src | tools/android/loading/sandwich_runner.py | Python | bsd-3-clause | 9,630 |
#! /usr/bin/env python3
"Replace CRLF with LF in argument files. Print names of changed files."
import sys, os
def main():
for filename in sys.argv[1:]:
if os.path.isdir(filename):
print(filename, "Directory!")
continue
data = open(filename, "rb").read()
if '\0' in... | mhubig/intelhex | tools/crlf.py | Python | bsd-3-clause | 615 |
"""
Tests for the following offsets:
- CustomBusinessMonthBase
- CustomBusinessMonthBegin
- CustomBusinessMonthEnd
"""
from __future__ import annotations
from datetime import (
date,
datetime,
timedelta,
)
import numpy as np
import pytest
from pandas._libs.tslibs.offsets import (
CBMonthBegin,
CB... | pandas-dev/pandas | pandas/tests/tseries/offsets/test_custom_business_month.py | Python | bsd-3-clause | 14,134 |
from typing import Dict, Optional, Tuple, Union
from autosklearn.pipeline.base import DATASET_PROPERTIES_TYPE, PIPELINE_DATA_DTYPE
from autosklearn.pipeline.constants import DENSE, UNSIGNED_DATA, INPUT, SPARSE
from autosklearn.pipeline.components.data_preprocessing.rescaling.abstract_rescaling \
import Rescaling
f... | automl/auto-sklearn | autosklearn/pipeline/components/data_preprocessing/rescaling/none.py | Python | bsd-3-clause | 1,808 |
# -*- coding: utf-8 -*-
#
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Eric Larson <larson.eric.d@gmail.com>
# Joan Massich <mailsik@gmail.com>
# Guillaume Favelier <guillaume.favelier@gmail.com>
#
# License: Simplified BSD
import collections.abc
from contextlib import contex... | larsoner/mne-python | mne/viz/backends/_utils.py | Python | bsd-3-clause | 5,283 |
# Copyright (c) James Percent, Byron Galbraith and Unlock contributors.
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notic... | NeuralProsthesisLab/unlock | unlock/state/state.py | Python | bsd-3-clause | 11,485 |
"""Defines application models""" | dailymuse/oz | oz/skeleton/plugin/models.py | Python | bsd-3-clause | 32 |
"""
An example usage for`SoloThreadedTask`.
Every time that `MyThreadedList.load` is called,
the previous job is cancelled, before the next job
is allowed to start.
"""
import os
import sys
qconcurrency_path = '/'.join(os.path.realpath(__file__).replace('\\','/').split('/')[:-2])
sys.path.insert(0, qconcurrency_path )... | willjp/pyqconcurrency | examples/threadedlist.py | Python | bsd-3-clause | 3,366 |
__version__ = '3.4.9'
| yakky/django-filebrowser-no-grappelli | filebrowser/__init__.py | Python | bsd-3-clause | 22 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^donate/$', views.donate, name='donate'),
url(r'^thank-you/(?P<donation>[\w]+)/$', views.thank_you, name='thank-you'),
url(r'^manage-donations/(?P<hero>[\w]+)/$', views.manage_donations, n... | xavierdutreilh/djangoproject.com | fundraising/urls.py | Python | bsd-3-clause | 596 |
from os import chmod, environ, path as os_path
from subprocess import call as call_subprocess
from tempfile import NamedTemporaryFile
def generate_pdf(html='', url=''):
# Validate input
if not html and not url:
raise ValueError('Must pass HTML or specify a URL')
if html and url:
raise Valu... | jwmayfield/pywkher | pywkher/__init__.py | Python | bsd-3-clause | 1,022 |
# -*- coding: utf-8 -*-
"""
werkzeug.contrib.profiler
~~~~~~~~~~~~~~~~~~~~~~~~~
This module provides a simple WSGI profiler middleware for finding
bottlenecks in web application. It uses the :mod:`profile` or
:mod:`cProfile` module to do the profiling and writes the stats to the
stream provide... | deadly11ama/werkzeug | werkzeug/contrib/profiler.py | Python | bsd-3-clause | 5,453 |
"""Context library - providing usefull context managers."""
import contextlib
@contextlib.contextmanager
def suppress(*exceptions):
"""Ignore an exception or exception list.
Usage::
with suppress(OSError):
os.remove('filename.txt')
"""
try:
yield
except exceptions:
... | alefnula/tea | tea/ctx/__init__.py | Python | bsd-3-clause | 332 |
import datetime as dt
from unittest import skipIf
import numpy as np
from holoviews.core.overlay import NdOverlay
from holoviews.core.util import pd
from holoviews.element import Curve
from holoviews.util.transform import dim
from .test_plot import TestMPLPlot, mpl_renderer
pd_skip = skipIf(pd is None, 'Pandas is n... | ioam/holoviews | holoviews/tests/plotting/matplotlib/test_curveplot.py | Python | bsd-3-clause | 10,641 |
# GUI Application automation and testing library
# Copyright (C) 2006-2020 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# ... | pywinauto/pywinauto | pywinauto/base_application.py | Python | bsd-3-clause | 44,969 |
# Copyright (c) 2012 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 logging
import os
import re
from pylib import android_commands
from pylib import constants
from pylib import pexpect
from pylib.base import base_... | mogoweb/chromium-crosswalk | build/android/pylib/gtest/test_runner.py | Python | bsd-3-clause | 6,990 |
import asyncio
import configparser
import json
import logging
import os
import os.path
import py.error
import pytest
import re
import sys
from collections.abc import Mapping
from functools import wraps
from subprocess import Popen, PIPE
from time import sleep
__tracebackhide__ = True
HERE = os.path.dirname(os.path.ab... | johnnoone/aiovault | tests/conftest.py | Python | bsd-3-clause | 9,455 |
'''
Created on Feb 21, 2014
@author: rkourtz
'''
import json
import pynuodb
class sql():
def __init__(self,
dbname,
host,
username,
password,
options
):
self.dbname = dbname
self.host = host
se... | nuodb/nuodbTools | nuodbTools/cluster/sql.py | Python | bsd-3-clause | 3,027 |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | xguse/scikit-bio | skbio/diversity/alpha/_gini.py | Python | bsd-3-clause | 3,692 |
import permstruct
import permstruct.dag
from permuta import Permutations
# Since we usually don't want overlays:
overlays = False
# In most of the test cases below we do not include symmetries
# R = [[2,3,1], [1,5,4,3,2]]
# perm_prop = lambda p: all( p.avoids(x) for x in R)
# perm_bound = 7
# # inp_dag = p... | PermutaTriangle/PermStruct | scratch/scratch_Henning.py | Python | bsd-3-clause | 7,679 |
from pygiftgrab import Codec, ColourSpace
def pytest_addoption(parser):
parser.addoption('--codec', action='store',
help='Codec (HEVC, Xvid, or VP9)')
parser.addoption('--colour-space', action='store',
help='Colour space specification (BGRA, I420, or UYVY)')
def pyt... | gift-surg/GIFT-Grab | src/tests/target/conftest.py | Python | bsd-3-clause | 1,482 |
"""
A couple of auxiliary functions
"""
import numpy as np
def sidekick(w1, w2, dt, T, A=1):
"""
This function crates the sidekick time series provided
the two mixing frequencies w1, w2, the time resolution dt
and the total time T.
returns the expresion A * (cos(w1 * t) + cos(w2 * t))
where t... | h-mayorquin/time_series_basic | signals/aux_functions.py | Python | bsd-3-clause | 2,499 |
"""
byceps.services.board.category_query_service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from typing import Optional, Sequence
from ...database import db
from .dbmodels.category import Category as DbCategory
f... | homeworkprod/byceps | byceps/services/board/category_query_service.py | Python | bsd-3-clause | 3,564 |
# Copyright (c) 2014, Guillermo López-Anglada. Please see the AUTHORS file for details.
# All rights reserved. Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.)
from subprocess import Popen
from subprocess import PIPE
from subprocess import TimeoutExpired
import threa... | guillermooo/dart-sublime-bundle-releases | sublime_plugin_lib/filter.py | Python | bsd-3-clause | 2,055 |
import wave
import sys
import struct
import time
import subprocess
import threading
import traceback
import shlex
import os
import string
import random
import datetime as dt
import numpy as np
import scipy as sp
import scipy.special
from contextlib import closing
from argparse import ArgumentParser
from pyoperant impor... | gentnerlab/pyoperant | pyoperant/utils.py | Python | bsd-3-clause | 13,912 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['RelativeDifference'] , ['PolyTrend'] , ['Seasonal_Minute'] , ['LSTM'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_RelativeDifference/model_control_one_enabled_RelativeDifference_PolyTrend_Seasonal_Minute_LSTM.py | Python | bsd-3-clause | 168 |
from django.db.models.signals import post_save, m2m_changed
from django.dispatch import receiver
from django.contrib.auth.models import User, Group
from mqtt.cache_clear import mqtt_cache_clear
from .models import UserProfile, GroupProfile
# Add signal to automatically clear cache when group permissions change
@rec... | EMSTrack/WebServerAndClient | login/signals.py | Python | bsd-3-clause | 992 |
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
from scipy import integrate
from .kern import Kern
from ...core.parameterization import Param
from ...util.linalg import tdot
from ... import util
from ...util.config import config # for... | SheffieldML/GPy | GPy/kern/src/stationary.py | Python | bsd-3-clause | 29,873 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..model import GLMFit
def test_GLMFit_inputs():
input_map = dict(allow_ill_cond=dict(argstr='--illcond',
),
allow_repeated_subjects=dict(argstr='--allowsubjrep',
),
args=dict(argstr='%s',
),
... | mick-d/nipype | nipype/interfaces/freesurfer/tests/test_auto_GLMFit.py | Python | bsd-3-clause | 4,335 |
from django.http import Http404
from django.http import HttpResponse
from common.templates import render_template
from blog.models import Post
def index(request):
post_list = Post.objects.all().order_by('-publishedDate')[:10]
return HttpResponse(render_template('blog/index.tpl', request, {'post_list': post_li... | ProgVal/ProgVal.42 | blog/views.py | Python | bsd-3-clause | 544 |
"""
Functions for generating sigma algebras on finite sets.
Chetan Jhurani
http://users.ices.utexas.edu/~chetan/Publications.html
http://users.ices.utexas.edu/~chetan/reports/2009-03-ices-set_algebra_algorithms.pdf
"""
from collections import defaultdict
import numpy as np
from dit.utils import pow... | Autoplectic/dit | dit/math/sigmaalgebra.py | Python | bsd-3-clause | 8,590 |
#
# PgHelp.py -- web application threading help routines.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import tornado.web
import tornado.websocket
import tornado.tem... | eteq/ginga | ginga/web/pgw/PgHelp.py | Python | bsd-3-clause | 5,510 |
from .mean import mean
from .decimalize import decimalize
from .standard_deviation import standard_deviation
def z_scores(data):
"""
Standardizing a variable or set of data is transforming the data such that it
has a mean of 0 and standard deviation of 1.
Each converted value equals how many standard ... | jhowardanderson/simplestatistics | simplestatistics/statistics/z_scores.py | Python | bsd-3-clause | 1,514 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-18 12:37
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
import taggit.managers
class Migration(migrations.Migration):
dependen... | ScorpionResponse/freelancefinder | freelancefinder/jobs/migrations/0011_auto_20170318_1237.py | Python | bsd-3-clause | 1,734 |
"""
Django settings for encounterdeck project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
imp... | patjouk/EncounterDeck | encounterdeck/settings.py | Python | bsd-3-clause | 3,584 |
""" Python library for interacting with Project Vote Smart API.
Project Vote Smart's API (http://www.votesmart.org/services_api.php)
provides rich biographical data, including data on votes, committee
assignments, and much more.
"""
__author__ = "James Turk (jturk@sunlightfoundation.com)"
__version__ = "0... | mikejs/python-votesmart | votesmart.py | Python | bsd-3-clause | 25,110 |
from django.conf.urls.defaults import *
from gitology.config import settings as gsettings
from gitology.d import urls as gitology_urls
urlpatterns = patterns('',
# some url not managed by gitology.
# gitology will add to this conf file for the rest of the urls.
(
'files/(?P<path>.*)$', 'django... | amitu/gitology | amitucom/urls.py | Python | bsd-3-clause | 619 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myhpom', '0003_user_details'),
]
operations = [
migrations.DeleteModel(
name='StateAdvanceDirective',
),... | ResearchSoftwareInstitute/MyHPOM | myhpom/migrations/0004_auto_20180708_0954.py | Python | bsd-3-clause | 1,233 |
#!/usr/bin/env python
"""
This script tests the python class interface
"""
from __future__ import absolute_import, division, print_function
# standard imports:
import os
import sys
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
sys.path.append(os.path.join(os.path.dirname(__file__), "..... | ioshchepkov/SHTOOLS | examples/python/ClassInterface/WindowExample.py | Python | bsd-3-clause | 1,515 |
from display_exceptions import NotFound, PermissionDenied
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.forms import modelformset_factory
from django.shortcuts import redirect
from base.views import rend... | mverleg/svsite | source/svfinance/views.py | Python | bsd-3-clause | 5,911 |
from django.test import TestCase
from django.contrib.auth.models import Group
from hs_access_control.models import PrivilegeCodes
from hs_core import hydroshare
from hs_core.models import GenericResource
from hs_core.testing import MockIRODSTestCaseMixin
from hs_access_control.tests.utilities import global_reset, is... | FescueFungiShare/hydroshare | hs_access_control/tests/test_create_resource.py | Python | bsd-3-clause | 24,563 |
import re
import mock
from nose.tools import eq_
from pyquery import PyQuery as pq
from django.core.files import temp
from olympia import amo
from olympia.amo.tests import TestCase
from olympia.amo.urlresolvers import reverse
from olympia.amo.tests import formset, initial
from olympia.addons.models import Addon, Add... | jpetto/olympia | src/olympia/devhub/tests/test_views_versions.py | Python | bsd-3-clause | 37,068 |
# Copyright 2020 Verily Life Sciences LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""Tests for bsst.evaluation."""
from absl.testing import absltest
import numpy as np
import xarray as xr
from... | verilylifesciences/site-selection-tool | bsst/evaluation_test.py | Python | bsd-3-clause | 1,526 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['BoxCox'] , ['MovingAverage'] , ['NoCycle'] , ['MLP'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_BoxCox/model_control_one_enabled_BoxCox_MovingAverage_NoCycle_MLP.py | Python | bsd-3-clause | 151 |
#!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2018, UFACTORY, Inc.
# All rights reserved.
#
# Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>
from ..x3 import XArm, Studio
class XArmAPI(object):
def __init__(self, port=None, is_radian=False, do_not... | xArm-Developer/xArm-Python-SDK | xarm/wrapper/xarm_api.py | Python | bsd-3-clause | 148,949 |
from doorman import permissions
def can_do_stuff(*args, **kwargs):
return True
permissions.register('can_do_stuff', can_do_stuff)
def can_do_other_stuff(*args, **kwargs):
return True
| seanbrant/django-doorman | tests/basicapp/permissions.py | Python | bsd-3-clause | 197 |
__author__ = "Sebastien Celles"
__copyright__ = "Copyright 2014, celles.net"
__credits__ = ["Sebastien Celles"]
__license__ = "BSD"
__version__ = "0.0.5"
__maintainer__ = "Sebastien Celles"
__email__ = "s.celles@gmail.com"
__status__ = "Development"
__url__ = 'https://github.com/scls19fr/openweathermap_requests'
| scls19fr/openweathermap_requests | openweathermap_requests/version.py | Python | bsd-3-clause | 314 |
from django.conf.urls import patterns, url
urlpatterns = patterns('ui.views',
url(r'^', 'index'),
)
| niksy/conference-web | ui/urls.py | Python | bsd-3-clause | 107 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2016, Mario Vilas
# 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... | debasishm89/OpenXMolar | ExtDepLibs/winappdbg/win32/version.py | Python | bsd-3-clause | 36,774 |
from tastypie import fields
from tastypie.resources import ModelResource
from public_project.models import ProjectPart, Question, Participant, Event, Page, Document
class ProjectPartsResource(ModelResource):
class Meta:
queryset = ProjectPart.objects.all()
resource_name = 'project_parts'
... | holgerd77/django-public-project | public_project/api.py | Python | bsd-3-clause | 1,526 |
#!/usr/bin/env python
import os
import math
import rosbag
import actionlib
import rospy
from trajectory_msgs.msg import *
from flexbe_core import EventState, Logger
from flexbe_core.proxy import ProxyPublisher, ProxySubscriberCached
# from flexbe_behaviors.atlas_definitions import AtlasDefinitions
'''
Created on 04... | team-vigir/vigir_behaviors | vigir_flexbe_states/src/vigir_flexbe_states/generate_trajectory_from_txtfile_state.py | Python | bsd-3-clause | 4,998 |
from setuptools import setup, find_packages
from pyvarnish import __author__, __version__
setup(
name='pyvarnish',
version=__version__,
description='Varnish Management',
long_description=open('README.rst').read(),
author=__author__,
author_email='john@8t8.eu',
url='https://github.com/redsna... | redsnapper8t8/pyvarnish | setup.py | Python | bsd-3-clause | 967 |