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 |
|---|---|---|---|---|---|
"""
Build extension modules, package and install Fatiando.
"""
import sys
import os
from setuptools import setup, Extension, find_packages
import numpy
# Get the version number and setup versioneer
import versioneer
versioneer.VCS = 'git'
versioneer.versionfile_source = 'fatiando/_version.py'
versioneer.versionfile_bu... | mtb-za/fatiando | setup.py | Python | bsd-3-clause | 2,945 |
# -*- coding: utf-8 -*-
from django.utils import baseconv
from django.template.defaultfilters import slugify
import time
def slugify_uniquely(value, model, slugfield="slug"):
"""
Returns a slug on a name which is unique within a model's table
"""
suffix = 0
potential = base = slugify(value)
... | niwinz/Green-Mine | src/greenmine/core/utils/slug.py | Python | bsd-3-clause | 1,106 |
#
# An attempt at re-implementing LZJB compression in native Python.
#
# Created in May 2014 by Emil Brink <emil@obsession.se>. See LICENSE.
#
# ---------------------------------------------------------------------
#
# Copyright (c) 2014-2016, Emil Brink
# All rights reserved.
#
# Redistribution and use in source and b... | hiliev/py-zfs-rescue | zfs/lzjb.py | Python | bsd-3-clause | 5,428 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-12-27 09:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('heatcontrol', '0015_heatcontrol_profile_add_holes'),
]
operations = [
migr... | rkojedzinszky/thermo-center | heatcontrol/migrations/0016_heatcontrol_profile_end_null.py | Python | bsd-3-clause | 473 |
from __future__ import absolute_import
import hashlib
import jwt
from six.moves.urllib.parse import quote
from sentry.shared_integrations.exceptions import ApiError
def percent_encode(val):
# see https://en.wikipedia.org/wiki/Percent-encoding
return quote(val.encode("utf8", errors="replace")).replace("%7E"... | beeftornado/sentry | src/sentry_plugins/jira_ac/utils.py | Python | bsd-3-clause | 2,784 |
"""
Clickjacking Protection Middleware.
This module provides a middleware that implements protection against a
malicious site loading resources from your site in a hidden frame.
"""
from django.conf import settings
class XFrameOptionsMiddleware(object):
"""
Middleware that sets the X-Frame-Options HTTP head... | bretlowery/snakr | lib/django/middleware/clickjacking.py | Python | bsd-3-clause | 1,983 |
from django.conf.urls.defaults import url, patterns
urlpatterns = patterns('tutorial.views',
url(r'^$', 'tutorial', name='tutorial'),
)
| mozilla/FlightDeck | apps/tutorial/urls.py | Python | bsd-3-clause | 141 |
from __future__ import absolute_import
from __future__ import unicode_literals
from base64 import b64encode
from django_digest.test.methods import WWWAuthenticateError, BaseAuth
class BasicAuth(BaseAuth):
def authorization(self, request, response):
if response is not None:
challenges = self._... | dimagi/django-digest | django_digest/test/methods/basic.py | Python | bsd-3-clause | 744 |
#(c) 2016 by Authors
#This file is a part of ABruijn program.
#Released under the BSD license (see LICENSE file)
"""
Runs polishing binary in parallel and concatentes output
"""
from __future__ import absolute_import
from __future__ import division
import logging
import subprocess
import os
from collections import de... | fenderglass/ABruijn | flye/polishing/polish.py | Python | bsd-3-clause | 11,547 |
import os
from traits.api import HasTraits
from traitsui.api import View, Item
from enable.savage.trait_defs.ui.svg_button import SVGButton
pause_icon = os.path.join(os.path.dirname(__file__), 'player_pause.svg')
resume_icon = os.path.join(os.path.dirname(__file__), 'player_play.svg')
class SVGDemo(HasTraits):
... | tommy-u/enable | examples/savage/toggle_demo.py | Python | bsd-3-clause | 673 |
"""
BNF reference: http://theory.lcs.mit.edu/~rivest/sexp.txt
<sexp> :: <string> | <list>
<string> :: <display>? <simple-string> ;
<simple-string> :: <raw> | <token> | <base-64> | <hexadecimal> |
<quoted-string> ;
<display> :: "[" <simple-string> "]" ;
<raw> :: <decimal> ":" <bytes> ;
<deci... | bossiernesto/uLisp | uLisp/parser/uLispParser.py | Python | bsd-3-clause | 2,979 |
import asyncio
from unittest.mock import MagicMock
def SimpleCoroutineMock(f=lambda *args, **kwargs: None):
builder = CoroutineMockBuilder()
return builder.addDelegate(f).build().mock()
class CoroutineMock(object):
# Handy for debugging failing tests in the debugger.
__blocking_dict = {}
def __... | cbrichford/async-mock | async_mock/coroutine.py | Python | bsd-3-clause | 3,037 |
from collections import OrderedDict
import unittest
import numpy
from ConfigSpace.configuration_space import ConfigurationSpace
from ConfigSpace.hyperparameters import CategoricalHyperparameter
from autosklearn.pipeline.components.classification.liblinear_svc import LibLinear_SVC
from autosklearn.pipeline.components... | automl/auto-sklearn | test/test_pipeline/test_create_searchspace_util_classification.py | Python | bsd-3-clause | 6,398 |
from __future__ import unicode_literals
from tests.utils import ConverterTestCase
class EnumTestCase(ConverterTestCase):
def test_empty(self):
self.assertGeneratedOutput(
"""
enum Bar {
};
""",
"""
from enum import Enum
... | pybee/seasnake | tests/test_enum.py | Python | bsd-3-clause | 3,328 |
"""
ios.py
Handle arguments, configuration file
@author: K.Edeline
"""
import sys
import argparse
import configparser
import logging
import shutil
class IOManager(object):
"""
extend me
"""
#DEFAULT_CONFIG_LOC="/tmp/deploypl.ini"
PKG_FILE = "packages.txt"
def __init__(self, child=None, **kw... | ekorian/deploypl | deployer/ios.py | Python | bsd-3-clause | 7,259 |
from django.views.generic import TemplateView
from django.shortcuts import render_to_response
from django.template import RequestContext
from braces.views import LoginRequiredMixin
class DashboardView(LoginRequiredMixin, TemplateView):
template_name = 'dashboard.html'
def get(self, *args, **kwargs):
... | savioabuga/phoenix | phoenix/dashboard/views.py | Python | bsd-3-clause | 614 |
from btmux_template_io.item_table import ITEM_TABLE
from btmux_template_io.parsers.ssw.crit_mapping import PHYSICAL_WEAPON_MAP, \
EQUIPMENT_MAP
from . ammo import add_ammo
from . common import add_crits_from_locations
from . weapons import add_weapon
def populate_equipment(xml_root, unit_obj):
"""
Equipm... | gtaylor/btmux_template_io | btmux_template_io/parsers/ssw/populators/equipment.py | Python | bsd-3-clause | 2,429 |
"""The image module provides basic functions for working with images in nipy.
Functions are provided to load, save and create image objects, along with
iterators to easily slice through volumes.
load : load an image from a file
save : save an image to a file
fromarray : create an image from a numpy array... | yarikoptic/NiPy-OLD | nipy/io/files.py | Python | bsd-3-clause | 8,110 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
default_app_config = 'yepes.contrib.slugs.apps.SlugsConfig'
| samuelmaudo/yepes | yepes/contrib/slugs/__init__.py | Python | bsd-3-clause | 125 |
"""Management command for uploading master json data for OCW courses"""
from django.core.management import BaseCommand
from course_catalog.etl.deduplication import generate_duplicates_yaml
class Command(BaseCommand):
"""Print course duplicates yaml"""
help = "Print course duplicates yaml"
def handle(se... | mitodl/open-discussions | course_catalog/management/commands/print_course_duplicates_yaml.py | Python | bsd-3-clause | 397 |
import re
from django.conf import settings
from django.utils.html import strip_tags
import amo
from amo.helpers import absolutify
from amo.urlresolvers import reverse
from amo.utils import urlparams, epoch
from tags.models import Tag
from versions.compare import version_int
# For app version major.minor matching.
m... | SuriyaaKudoIsc/olympia | apps/api/utils.py | Python | bsd-3-clause | 5,273 |
import zeit.newsletter.testing
class MetadataTest(zeit.newsletter.testing.SeleniumTestCase):
def test_form_should_save_entered_data_on_blur(self):
s = self.selenium
self.open('/repository/newsletter/@@checkout')
s.waitForElementPresent('id=metadata.subject')
s.assertValue('id=meta... | ZeitOnline/zeit.newsletter | src/zeit/newsletter/browser/tests/test_form.py | Python | bsd-3-clause | 668 |
from .Base_Action import *
class ProfileAction(Base_Action):
def __init__(self, action_xml, root_action=None):
super(self.__class__, self).__init__(action_xml, root_action)
self.shouldUseLaunchSchemeArgsEnv = self.contents.get('shouldUseLaunchSchemeArgsEnv');
self.savedToolIdentifier =... | samdmarshall/pyxcscheme | pyxcscheme/ProfileAction.py | Python | bsd-3-clause | 611 |
class Error ( Exception ):
"""Exception class for Address exceptions"""
def __init__( self, message ) :
Exception.__init__(self,message)
| SPlanzer/AIMS | ElectoralAddress/Error.py | Python | bsd-3-clause | 159 |
__version__ = '0.1.0'
from .reports import Report
| grantmcconnaughey/django-reports | djreports/__init__.py | Python | bsd-3-clause | 51 |
#!/usr/bin/env python
from __future__ import absolute_import
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "service.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| peragro/peragro-rest | manage.py | Python | bsd-3-clause | 289 |
from django import forms
from dragnet.dll.models import File, Comment
class FileForm(forms.ModelForm):
"""Using a model form to expedite the creation of DLL records"""
class Meta:
model = File
exclude = ('date_created', 'date_modified', 'created_by',
'modified_by', )
class... | mozilla/dragnet | dragnet/dll/forms.py | Python | bsd-3-clause | 534 |
"""
To start UNO for both Calc and Writer:
(Note that if you use the current_document command, it will open the Calc's current document since it's the first switch passed)
libreoffice "--accept=socket,host=localhost,port=18100;urp;StarOffice.ServiceManager" --norestore --nofirststartwizard --nologo --calc --writer
To ... | Risto-Stevcev/iac-protocol | iac/app/libreoffice/calc.py | Python | bsd-3-clause | 3,484 |
#-*- coding: utf-8 -*-
# version string following pep-0396 and pep-0386
__version__ = '0.9a4.dev1' # pragma: nocover
| BertrandBordage/django-filer | filer/__init__.py | Python | bsd-3-clause | 118 |
import copy
import pandas as pd
from threeML.plugins.SpectrumLike import SpectrumLike
from threeML.utils.OGIP.response import InstrumentResponse
from threeML.utils.spectrum.binned_spectrum import (
BinnedSpectrumWithDispersion,
ChannelSet,
)
__instrument_name = "General binned spectral data with energy dispe... | giacomov/3ML | threeML/plugins/DispersionSpectrumLike.py | Python | bsd-3-clause | 8,596 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-02-21 17:35
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations
import django.db.models.deletion
import sentry.db.models.fields.foreignkey
class Migration(migrations.Migration):
# This flag is used... | beeftornado/sentry | src/sentry/migrations/0046_auto_20200221_1735.py | Python | bsd-3-clause | 1,992 |
from django.conf.urls.defaults import *
from corehq import AccountingAdminInterfaceDispatcher
from corehq.apps.accounting.views import *
urlpatterns = patterns('corehq.apps.accounting.views',
url(r'^$', 'accounting_default', name='accounting_default'),
url(r'^accounts/(\d+)/$', ManageBillingAccountView.as_vie... | gmimano/commcaretest | corehq/apps/accounting/urls.py | Python | bsd-3-clause | 1,305 |
from django.conf import settings
def MAX_USERNAME_LENGTH():
return getattr(settings, "MAX_USERNAME_LENGTH", 255)
def MAX_EMAIL_LENGTH():
return getattr(settings, "MAX_EMAIL_LENGTH", 255)
def REQUIRE_UNIQUE_EMAIL():
return getattr(settings, "REQUIRE_UNIQUE_EMAIL", True)
| madssj/django-longer-username-and-email | longerusernameandemail/__init__.py | Python | bsd-3-clause | 288 |
"""Auto-generated file, do not edit by hand. PE metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_PE = PhoneMetadata(id='PE', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='1\\d{2}', possible_number_pattern='\\d{... | vicky2135/lucious | oscar/lib/python2.7/site-packages/phonenumbers/shortdata/region_PE.py | Python | bsd-3-clause | 816 |
def extractDhragonisslytherinWordpressCom(item):
'''
Parser for 'dhragonisslytherin.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'trans... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractDhragonisslytherinWordpressCom.py | Python | bsd-3-clause | 576 |
"""Auto-generated file, do not edit by hand. NF metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_NF = PhoneMetadata(id='NF', country_code=672, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[13]\\d{5}', possible_number_pattern='\\... | WillisXChen/django-oscar | oscar/lib/python2.7/site-packages/phonenumbers/data/region_NF.py | Python | bsd-3-clause | 1,648 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# 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... | stormi/tsunami | src/primaires/information/sujet.py | Python | bsd-3-clause | 9,045 |
import copy
import types
from django.core.urlresolvers import reverse
from django.db.models.query import QuerySet
registry = []
def register(*args):
"""
Register urls, views, model instances and QuerySets to be potential
pages for menu items.
Example::
import simplemenu
simpleme... | elpaso/django-simplemenu | simplemenu/pages.py | Python | bsd-3-clause | 2,730 |
#!/usr/bin/env python
from setuptools import setup
setup(name='tagdog',
version='0.2',
description='Tag media files',
author='Albert Pham',
author_email='the.sk89q@gmail.com',
url='https://github.com/sk89q/TagDog',
install_requires=[
'titlecase',
'mutagen',
... | sk89q/TagDog | setup.py | Python | bsd-3-clause | 383 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "LinearTrend", cycle_length = 7, transform = "Anscombe", sigma = 0.0, exog_count = 0, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_LinearTrend/cycle_7/ar_12/test_artificial_32_Anscombe_LinearTrend_7_12_0.py | Python | bsd-3-clause | 264 |
# GUI Application automation and testing library
# Copyright (C) 2006-2018 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 with... | pywinauto/pywinauto | pywinauto/findbestmatch.py | Python | bsd-3-clause | 20,676 |
# -*- coding: utf-8 -*-
__version__ = '1.3.7'
default_app_config = 'aldryn_redirects.apps.AldrynRedirects'
| aldryn/aldryn-redirects | aldryn_redirects/__init__.py | Python | bsd-3-clause | 109 |
import json
import shutil
import sys
import warnings
from itertools import zip_longest
import s3fs
from smart_open import open
from tqdm import tqdm
def session_type():
if 'IPython' not in sys.modules:
# IPython hasn't been imported, definitely not
return "python"
from IPython import get_ipyt... | Featuretools/featuretools | featuretools/utils/gen_utils.py | Python | bsd-3-clause | 4,834 |
import numpy as nm
try:
import matplotlib.pyplot as plt
import matplotlib as mpl
except (ImportError, RuntimeError):
plt = mpl = None
#print 'matplotlib import failed!'
from sfepy.base.base import output, pause
def spy(mtx, eps=None, color='b', **kwargs):
"""
Show sparsity structure of a `sci... | RexFuzzle/sfepy | sfepy/base/plotutils.py | Python | bsd-3-clause | 4,703 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-16 12:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_auto_20161116_1209'),
]
operations = [
migrations.AddField(
... | smn/blinky | blinky/core/migrations/0005_workertype_is_active.py | Python | bsd-3-clause | 455 |
from neurotune.controllers import SineWaveController
import sys
from neurotune import evaluators
from neurotune import optimizers
from neurotune import utils
if __name__ == "__main__":
showPlots = not ("-nogui" in sys.argv)
verbose = not ("-silent" in sys.argv)
sim_vars = {"amp": 65, "period": 250, "of... | NeuralEnsemble/neurotune | examples/example_4/SineWavePointOptimizer.py | Python | bsd-3-clause | 1,854 |
import json
from django.core import serializers
from django.core.serializers.json import DjangoJSONEncoder
from .base import Binding
from ..generic.websockets import WebsocketDemultiplexer
from ..sessions import enforce_ordering
class WebsocketBinding(Binding):
"""
Websocket-specific outgoing binding subcla... | linuxlewis/channels | channels/binding/websockets.py | Python | bsd-3-clause | 5,020 |
"""
pakbase module
This module contains the base package class from which
all of the other packages inherit from.
"""
from __future__ import print_function
import os
import webbrowser as wb
import numpy as np
from numpy.lib.recfunctions import stack_arrays
from .modflow.mfparbc import ModflowParBc as mfparbc
f... | bdestombe/flopy-1 | flopy/pakbase.py | Python | bsd-3-clause | 35,922 |
#!/usr/bin/env python
"""
A script for automated nagging emails based on passed in queries
These can be collated into several 'queries' through the use of multiple query files with
a 'query_name' param set eg: 'Bugs tracked for Firefox Beta (13)'
Once the bugs have been collected from Bugzilla they are sorted into buc... | anoopvalluthadam/bztools | auto_nag/scripts/email_nag.py | Python | bsd-3-clause | 24,245 |
import unittest
import operator
import six
from six.moves import range,reduce
import arybo.lib.mba_exprs as EX
from arybo.lib import MBA
from pytanque import expand_esf_inplace, simplify_inplace
class MBAExprsTest:
def setUp(self):
self.mba1 = MBA(1)
self.mba4 = MBA(4)
self.mba4.use_esf ... | quarkslab/arybo | tests/arybo/mba_exprs.py | Python | bsd-3-clause | 5,358 |
#!/usr/bin/python
"""
This is a tool to verify checksum hashes produced by LOCKSS against hashes
provided by a BagIt manifest document.
Invoke with -h for usage help.
Written by Stephen Eisenhauer
At University of North Texas Libraries
On 2013-04-17
Notes:
* The LOCKSS hash list will have more entries than we ac... | MetaArchive/metaarchive-qa-tools | lockss-manifest-validate/lockss-manifest-validate.py | Python | bsd-3-clause | 2,391 |
import json
import os
import six
import tensorflow as tf
from PIL import Image
from luminoth.tools.dataset.readers import InvalidDataDirectory
from luminoth.tools.dataset.readers.object_detection import (
ObjectDetectionReader
)
from luminoth.utils.dataset import read_xml, read_image
WNIDS_FILE = 'data/imagenet_... | tryolabs/luminoth | luminoth/tools/dataset/readers/object_detection/imagenet.py | Python | bsd-3-clause | 5,855 |
from abc import ABCMeta, abstractmethod
import six
from django.db.models import Q
from dimagi.utils.chunked import chunked
class DomainFilter(six.with_metaclass(ABCMeta)):
@abstractmethod
def get_filters(self, domain_name):
"""Return a list of filters. Each filter will be applied to a queryset indep... | qedsoftware/commcare-hq | corehq/apps/dump_reload/sql/filters.py | Python | bsd-3-clause | 1,812 |
# -*- coding: utf-8 -*-
"""Defines fixtures available to all tests."""
import pytest
from webtest import TestApp
from p101stat.app import create_app
from p101stat.database import db as _db
from p101stat.settings import TestConfig
from .factories import IdolFactory
@pytest.yield_fixture(scope='function')
def app():... | pmrowla/p101stat | tests/conftest.py | Python | bsd-3-clause | 969 |
"""
Turn entities to and fro various representations.
This is the base Class and interface Class used to
transform strings of various forms to model objects
and model objects to strings of various forms.
"""
from tiddlyweb.serializer import NoSerializationError
from tiddlyweb.model.tiddler import string_to_tags_list
... | funkyeah/tiddlyweb | tiddlyweb/serializations/__init__.py | Python | bsd-3-clause | 3,732 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.0.0.11832 on 2017-03-22.
# 2017, SMART Health IT.
import io
import json
import os
import unittest
from . import riskassessment
from .fhirdate import FHIRDate
class RiskAssessmentTests(unittest.TestCase):
def instantiate_from(self, filena... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_3_0_0/models/riskassessment_tests.py | Python | bsd-3-clause | 11,177 |
from django.conf import settings
from django.http import Http404
import os
import shutil
import time
import re
import urlparse
import urllib
from subprocess import call
from exceptions import ImageMagickException, ImageMagickConversionError, ImageMagickOSFileError
from cache_util import file_hash
from django.db.mode... | gregplaysguitar/glamkit | glamkit/incubated/imageutil/imagemagick_util.py | Python | bsd-3-clause | 6,569 |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class ContactFormConfig(AppConfig):
"""The default AppConfig for admin which does autodiscovery."""
name = 'django_contact'
verbose_name = _("Contact") | arkanister/django-contact-form-site | django_contact/apps.py | Python | bsd-3-clause | 255 |
"""
A *lock* defines access to a particular subsystem or property of
Evennia. For example, the "owner" property can be impmemented as a
lock. Or the disability to lift an object or to ban users.
A lock consists of three parts:
- access_type - this defines what kind of access this lock regulates. This
just a stri... | ergodicbreak/evennia | evennia/locks/lockhandler.py | Python | bsd-3-clause | 19,738 |
"""Kraken Framework."""
import logging
import os
__all__ = ['core', 'helpers', 'plugins', 'ui']
krakenPath = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..'))
if os.environ.get('KRAKEN_PATH', None) is None:
os.environ['KRAKEN_PATH'] = krakenPath
krakenExtsPath = os.path.joi... | goshow-jp/Kraken | Python/kraken/__init__.py | Python | bsd-3-clause | 1,147 |
"""
Simple Scatter Plot with Labels
===============================
This example shows a basic scatter plot with labels created with Altair.
"""
# category: scatter plots
import altair as alt
import pandas as pd
data = pd.DataFrame({
'x': [1, 3, 5, 7, 9],
'y': [1, 3, 5, 7, 9],
'label': ['A', 'B', 'C', 'D',... | ellisonbg/altair | altair/vegalite/v2/examples/scatter_with_labels.py | Python | bsd-3-clause | 517 |
from datetime import datetime, timedelta
from rdr_service.dao.ghost_check_dao import GhostCheckDao
from tests.helpers.unittest_base import BaseTestCase
class GhostCheckDaoTest(BaseTestCase):
def test_loads_only_vibrent(self):
"""We might accidentally start flagging CE participants as ghosts if they're re... | all-of-us/raw-data-repository | tests/dao_tests/test_ghost_check_dao.py | Python | bsd-3-clause | 1,959 |
"""
General Character commands usually availabe to all characters
"""
from django.conf import settings
from evennia.utils import utils, prettytable
from evennia.commands.default.muxcommand import MuxCommand
# limit symbol import for API
__all__ = ("CmdHome", "CmdLook", "CmdNick",
"CmdInventory", "CmdGet", ... | mrkulk/text-world | evennia/commands/default/general.py | Python | bsd-3-clause | 13,667 |
from corehq.dbaccessors.couchapps.all_docs import \
get_all_doc_ids_for_domain_grouped_by_db, get_doc_count_by_type, \
delete_all_docs_by_doc_type, get_doc_count_by_domain_type
from dimagi.utils.couch.database import get_db
from django.test import TestCase
class AllDocsTest(TestCase):
maxDiff = None
... | qedsoftware/commcare-hq | corehq/couchapps/tests/test_all_docs.py | Python | bsd-3-clause | 3,246 |
# ~*~ coding: utf-8 ~*~
"""
tests.marshmallow.test_extension
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests for the :class:`MarshmallowAwareApp` to ensure that it will properly
register the extension and can be used, as well as testing the top level
schema.
"""
import pytest
from flask_marshmallow import fields
from fleaker i... | croscon/fleaker | tests/marshmallow/test_extension.py | Python | bsd-3-clause | 1,644 |
"""
DataLab survey class. Gets data from any survey
available through the NOAO datalab-client.
"""
import pdb
import numpy as np
import warnings
from astropy.table import Table
from astropy import units
import warnings
import sys, os
try:
from dl import queryClient as qc, authClient as ac
from dl.helpers.util... | FRBs/DM | frb/surveys/dlsurvey.py | Python | bsd-3-clause | 5,919 |
from __future__ import absolute_import, division, print_function
from itertools import chain
from dynd import nd
import datashape
from datashape.internal_utils import IndexCallable
from datashape import discover
from functools import partial
from ..dispatch import dispatch
from blaze.expr import Projection, Field
from... | vitan/blaze | blaze/data/core.py | Python | bsd-3-clause | 6,508 |
from __future__ import absolute_import
from sentry.testutils import AcceptanceTestCase
class AuthTest(AcceptanceTestCase):
def enter_auth(self, username, password):
# disable captcha as it makes these tests flakey (and requires waiting
# on external resources)
with self.settings(RECAPTCHA... | mitsuhiko/sentry | tests/acceptance/test_auth.py | Python | bsd-3-clause | 1,321 |
import os
from celery import Celery
from django.conf import settings
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'songaday_searcher.settings')
app = Celery('songaday_searcher')
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(l... | zaneswafford/songaday_searcher | songaday_searcher/celery.py | Python | bsd-3-clause | 352 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 0, transform = "Anscombe", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_Lag1Trend/cycle_0/ar_12/test_artificial_32_Anscombe_Lag1Trend_0_12_20.py | Python | bsd-3-clause | 263 |
# 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... | avehtari/GPy | GPy/kern/src/stationary.py | Python | bsd-3-clause | 21,805 |
##########################################################################
#
# Copyright (c) 2013, Image Engine Design 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:
#
# * Redistrib... | goddardl/gaffer | python/GafferSceneUI/SceneSwitchUI.py | Python | bsd-3-clause | 2,393 |
from . import *
class TestTemplateUse(TestCase):
def test_resized_img_src(self):
@self.app.route('/resized_img_src')
def use():
return render_template_string('''
<img src="{{ resized_img_src('cc.png') }}" />
'''.strip())
res = self.client.get('/re... | knadir/Flask-Images | tests/test_template_use.py | Python | bsd-3-clause | 780 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2009 Edgewall Software
# Copyright (C) 2003-2005 Jonas Borgström <jonas@edgewall.com>
# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of th... | walty8/trac | trac/attachment.py | Python | bsd-3-clause | 47,208 |
import time
from prometheus_client import Counter, Histogram
from prometheus_client import start_http_server
from flask import request
FLASK_REQUEST_LATENCY = Histogram('flask_request_latency_seconds', 'Flask Request Latency',
['method', 'endpoint'])
FLASK_REQUEST_COUNT = Counter('flask_request_count', ... | sbarratt/flask-prometheus | flask_prometheus/__init__.py | Python | bsd-3-clause | 1,126 |
from datetime import datetime
import functools
import os
import uuid
from time import time
from django.conf import settings
from django_statsd.clients import statsd
from mock import Mock
from requests import post
from suds import client as sudsclient
from suds.transport import Reply
from suds.transport.http import Ht... | muffinresearch/solitude | lib/bango/client.py | Python | bsd-3-clause | 7,873 |
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import models
import mozdns
from mozdns.domain.models import Domain
from mozdns.view.models import View
from mozdns.mixins import ObjectUrlMixin, DisplayMixin
from mozdns.validation import validate_first_label, validate_name
from moz... | rtucker-mozilla/mozilla_inventory | mozdns/models.py | Python | bsd-3-clause | 8,260 |
from pandac.PandaModules import *
from direct.directnotify.DirectNotifyGlobal import directNotify
from direct.task import Task
from .DistributedNodeAI import DistributedNodeAI
from .CartesianGridBase import CartesianGridBase
class DistributedCartesianGridAI(DistributedNodeAI, CartesianGridBase):
notify = directNo... | brakhane/panda3d | direct/src/distributed/DistributedCartesianGridAI.py | Python | bsd-3-clause | 5,309 |
from .AlFeatureTemplate import AlFeatureTemplate
from .sensorCountRoutine import AlFeatureSensorCountRoutine
import numpy as np
class AlFeatureSensorCount(AlFeatureTemplate):
def __init__(self, normalize=False):
"""
Initialization of Template Class
:return:
"""
AlFeatureTe... | TinghuiWang/ActivityLearning | actlearn/feature/sensorCount.py | Python | bsd-3-clause | 1,358 |
# coding=utf-8
# pylint: disable-msg=E1101,W0612
from collections import OrderedDict
import pytest
import numpy as np
import pandas as pd
from pandas import Index, Series, DataFrame, date_range
from pandas.core.indexes.datetimes import Timestamp
from pandas.compat import range
from pandas import compat
import panda... | winklerand/pandas | pandas/tests/series/test_api.py | Python | bsd-3-clause | 14,504 |
# c: 19.05.2008, r: 19.05.2008
from sfepy import data_dir
filename_mesh = data_dir + '/meshes/2d/special/circle_in_square.mesh'
dim = 2
field_1 = {
'name' : 'scalar_field',
'dtype' : 'real',
'shape' : 'scalar',
'region' : 'Omega',
'approx_order' : 1,
}
field_2 = {
'name' : 'vector_field',
... | olivierverdier/sfepy | tests/test_term_consistency.py | Python | bsd-3-clause | 4,677 |
from builtins import str
from builtins import range
from builtins import object
import json
import os
import solnlib.utils as utils
from splunktaucclib.global_config import GlobalConfig, GlobalConfigSchema
'''
Usage Examples:
setup_util = Setup_Util(uri, session_key)
setup_util.get_log_level()
setup_util.get_proxy_... | PaloAltoNetworks-BD/SplunkforPaloAltoNetworks | Splunk_TA_paloalto/bin/splunk_ta_paloalto/aob_py3/splunk_aoblib/setup_util.py | Python | isc | 13,234 |
# -*- coding: utf-8 -*-
import abc
import math
import six
import sqlalchemy as sa
from marshmallow_sqlalchemy.convert import ModelConverter
from marshmallow_pagination import pages
converter = ModelConverter()
def convert_value(row, attr):
field = converter._get_field_class_for_property(attr.property)
valu... | jmcarp/marshmallow-pagination | marshmallow_pagination/paginators.py | Python | mit | 3,436 |
import sys
import uos
try:
uos.VfsFat
except AttributeError:
print("SKIP")
sys.exit()
class RAMFS:
SEC_SIZE = 512
def __init__(self, blocks):
self.data = bytearray(blocks * self.SEC_SIZE)
def readblocks(self, n, buf):
#print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf)))... | danicampora/micropython | tests/extmod/vfs_fat_ramdisk.py | Python | mit | 1,230 |
# -*- encoding: utf-8 -*-
import StringIO
import xlsxwriter
"""
Web app module.
"""
__author__ = 'Bernardo Martínez Garrido'
__license__ = 'MIT'
__status__ = 'Development'
def generate_cwr_report_excel(cwr):
output = StringIO.StringIO()
workbook = xlsxwriter.Workbook(output, {'in_memory': True})
_gen... | weso/CWR-WebClient | cwr_webclient/report/cwr.py | Python | mit | 2,566 |
# -*- coding: utf-8 -*-
'''
Created on 2015年8月24日
@author: hustcc
'''
import datetime
import time
# 当前时间,可用于mysql datetime
def now_datetime_string():
return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
def now_datetime():
return datetime.datetime.now()
def now_date_string():
return datetime.... | NetEaseGame/git-webhook | app/utils/DateUtil.py | Python | mit | 535 |
#!/usr/bin/env python
import numpy as np
import pycuda.driver as drv
from neon.backends.nervanagpu import NervanaGPU
from openai_gemm import matmul
ng = NervanaGPU()
print drv.Context.get_current().get_device().name()
config = (
# m, n, k, AT, BT (row order)
( 16, 1760, 1760, False, False),
... | ekelsen/openai-gemm | benchmark.py | Python | mit | 4,622 |
#!/usr/bin/env python
#
# XRootD
#
# XRootD package installer.
#
# Author M Mottram - 15/04/2016 <m.mottram@qmul.ac.uk> : First revision
#######################################################################
import localpackage
import os
import stat
import shutil
class XRootD(localpackage.LocalPackage):
""" Base ... | mjmottram/snoing | packages/xrootd.py | Python | mit | 2,509 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Hello Flask
Latest version can be found at https://github.com/dakside/pydemo
References:
Python documentation:
https://docs.python.org/
Flask documentation:
http://flask.pocoo.org/
PEP 0008 - Style Guide for Python Code
https://ww... | dakside/pydemo | flask/hellojinja/app.py | Python | mit | 2,459 |
"""
Functional test
Anonymous Epic
Storyboard is defined within the comments of the program itself
"""
import unittest
from flask import url_for
from biblib.views.http_errors import NO_PERMISSION_ERROR
from biblib.tests.stubdata.stub_data import UserShop, LibraryShop
from biblib.tests.base import TestCaseDatabase, M... | adsabs/biblib-service | biblib/tests/functional_tests/test_anonymous_epic.py | Python | mit | 3,528 |
"""
neighs information
------------------
Auxiliar class in order to manage the information of the neighbourhood
returned by the retrievers.
Due to the complexity of the structure it is convenient to put altogether
in a single class and manage in a centralized way all the different
interactions with neighs_info in the... | tgquintela/pythonUtils | pythonUtils/NeighsManager/neighs_info.py | Python | mit | 99,145 |
from cadnano.gui.views.styles import *
from PyQt5.QtGui import QColor, QFont, QFontMetricsF
# Path Sizing
VIRTUALHELIXHANDLEITEM_RADIUS = 30
VIRTUALHELIXHANDLEITEM_STROKE_WIDTH = 2
PATH_BASE_WIDTH = 20 # used to size bases (grid squares, handles, etc)
PATH_HELIX_HEIGHT = 2 * PATH_BASE_WIDTH # staple + scaffold
PATH_... | amylittleyang/OtraCAD | cadnano25/cadnano/gui/views/pathview/pathstyles.py | Python | mit | 4,318 |
import pytest
from plumbum.colorlib.styles import ANSIStyle, Color, AttributeNotFound, ColorNotFound
from plumbum.colorlib.names import color_html, FindNearest
class TestNearestColor:
def test_exact(self):
assert FindNearest(0,0,0).all_fast() == 0
for n,color in enumerate(color_html):
... | vodik/plumbum | tests/test_color.py | Python | mit | 2,444 |
#----------------------------------------------------------------------
# Copyright (c) 2014 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... | yippeecw/sfa | sfa/trust/credential_factory.py | Python | mit | 5,023 |
from __future__ import absolute_import, division
from klein.app import Klein, run, route, resource
from klein._plating import Plating
from ._version import __version__ as _incremental_version
# Make it a str, for backwards compatibility
__version__ = _incremental_version.base()
__author__ = "The Klein contributors... | joac/klein | src/klein/__init__.py | Python | mit | 572 |
from dask.callbacks import Callback
from os import getcwd, remove
from os.path import join, exists
from dask.diagnostics import ProgressBar
from dask.multiprocessing import get as get_proc
import toolz
import json
class NekCallback(Callback):
def __init__(self, case):
self.case = case
self.cwd = g... | NekBox/nekpy | nekpy/dask/runner.py | Python | mit | 1,462 |
from .base import *
from .controller import *
| jdzero/foundation | foundation/backend/views/__init__.py | Python | mit | 46 |
"""
WSGI config for geology project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... | MuhammadSohaib/colorado-geology-geodjango | geology/geology/wsgi.py | Python | mit | 1,562 |
import theano
import numpy
import scipy
from theano import tensor
from blocks.bricks import Initializable, Linear
from blocks.bricks.parallel import Parallel
from blocks.bricks.base import lazy, application
from blocks.bricks.attention import (
GenericSequenceAttention, SequenceContentAttention,
ShallowEnergyC... | rizar/attention-lvcsr | lvsr/bricks/attention.py | Python | mit | 10,681 |
from django.conf.urls import url, patterns
urlpatterns = patterns(
"phileo.views",
url(r"^like/(?P<content_type_id>\d+):(?P<object_id>\d+)/$", "like_toggle", name="phileo_like_toggle")
)
| rizumu/pinax-likes | phileo/urls.py | Python | mit | 197 |