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 |
|---|---|---|---|---|---|
# -*- coding -*-
class myobject(object):
name = 'mo'
def __init__(self):
self.x = 9
def power(self):
return self.x * self.x
| Sherlock-Holo/Python-3.5-learning | oldlearn/objects/Myobject.py | Python | apache-2.0 | 153 |
# tests.random
# A visualizer that draws a random scatter plot for testing.
#
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com>
# Created: Wed Mar 21 17:51:15 2018 -0400
#
# ID: rand.py [cc69b3c] davidwaterman@gmail.com $
"""
A visualizer that draws a random scatter plot for testing.
"""
#################... | DistrictDataLabs/yellowbrick | tests/rand.py | Python | apache-2.0 | 3,195 |
# Copyright (c) 2016 IBM
#
# 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, softw... | openstack/barbican | barbican/model/clean.py | Python | apache-2.0 | 15,281 |
# Copyright (c) 2006-2013 Regents of the University of Minnesota.
# For licensing terms, see the file LICENSE.
import copy
import os
import sys
import conf
import g
from grax.access_level import Access_Level
from grax.user import User
from gwis.query_filters import Query_Filters
from gwis.query_viewport import Query... | lbouma/Cyclopath | pyserver/item/attachment.py | Python | apache-2.0 | 25,536 |
# Copyright 2021 Callum Brown
#
# 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,... | matrix-org/synapse | tests/rest/admin/test_registration_tokens.py | Python | apache-2.0 | 27,938 |
import datetime
import factory
from django.template.defaultfilters import slugify
from . import models
class BaseFactory(factory.django.DjangoModelFactory):
romanized_name = factory.Sequence(lambda i: 'release#%s' % i)
released = datetime.date.today()
slug = factory.LazyAttribute(lambda f: slugify(f.rom... | hello-base/web | apps/merchandise/music/factories.py | Python | apache-2.0 | 1,432 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | cloudera/hue | apps/beeswax/src/beeswax/models.py | Python | apache-2.0 | 21,178 |
#! /usr/bin/env python
#####################################################################################################################
# CUICUILCO: A general purpose framework that allows the construction and evaluation of #
# hierarchical networks for supervised learning ... | AlbertoEsc/cuicuilco | cuicuilco_run.py | Python | apache-2.0 | 264,519 |
# coding=utf-8
# Copyright 2020 The TF-Agents Authors.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | tensorflow/agents | tf_agents/train/utils/replay_buffer_utils_test.py | Python | apache-2.0 | 2,578 |
# Copyright 2019 QuantRocket - 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 ... | quantrocket-llc/quantrocket-client | quantrocket/cli/subcommands/realtime.py | Python | apache-2.0 | 20,184 |
# -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | andrei4ka/fuel-web-redhat | nailgun/nailgun/api/v1/validators/node.py | Python | apache-2.0 | 9,815 |
# Copyright 2020 Google LLC
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | google/qkeras | examples/example_ternary.py | Python | apache-2.0 | 3,467 |
#!/usr/bin/env python
#encode=utf-8
#vim: tabstop=4 shiftwidth=4 softtabstop=4
#Created on 2013-8-17
#Copyright 2013 nuoqingyun xuqifeng
from glance.api.glance_api import wsgi
class Controller(wsgi.Controller):
def __init__(self, **kwargs):
super(Controller, self).__init__(**kwargs)
def ind... | homhei/glance | glance/api/glance_api/phpsite.py | Python | apache-2.0 | 1,118 |
"""
This module provides Manager, a base class for managers.
"""
from weibo.common import cfg
from weibo.common import periodic_task
from weibo.common import log as logging
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
class PeriodicTasks(periodic_task.PeriodicTasks):
def __init__(self):
super(Period... | windskyer/weibo | weibo/manager.py | Python | apache-2.0 | 1,899 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0042_add_external_link_and_project_resources'),
]
operations = [
migrations.AlterField(
model_name='mach... | CCI-MOC/GUI-Backend | core/migrations/0043_meta_update_project_links_and_machinerequest_new_version_membership.py | Python | apache-2.0 | 586 |
from importlib import import_module
from hermes.tag import Universal
"""
Copyright 2017 David B. Bracewell
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/... | dbracewell/pyHermes | hermes/language/language.py | Python | apache-2.0 | 3,603 |
"""Airfow DAG used is the daily release pipeline.
Copyright 2017 Istio 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
... | frankbu/istio | release/pipeline/dags/istio_daily_flow.py | Python | apache-2.0 | 884 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - User-Agent Statistics
This macro creates a pie chart of the type of user agents
accessing the wiki.
TODO: should be refactored after hitcounts.
@copyright: 2002-2004 Juergen Hermann <jh@web.de>,
2007 MoinMoin:ThomasWaldmann
@license:... | RealTimeWeb/wikisite | MoinMoin/stats/useragents.py | Python | apache-2.0 | 5,297 |
import matplotlib
matplotlib.use('Agg')
import cPickle
from matplotlib import pyplot as plt
import os
data_dir = '/Volumes/Storage/models'
img_save_dir = '/Volumes/Storage/weights'
models = [('clean', 'AE1110_Scale_Warp_Blocks_2049_500_tanh_tanh_gpu_sgd_clean_continue_20141110_1235_21624029'),
('gaussian... | hycis/Pynet | scripts/nii/show_weights.py | Python | apache-2.0 | 1,681 |
from google.appengine.ext import db
from appengine_django.auth import models
from core import base
def get_or_create_user(email):
u = User.all().filter('email = ', email).get()
if not u:
u = User(email=email)
u.save()
return u
class User(base.TbpModel):
class_year = db.StringProperty("Class Year",... | gmarcotte/tbp-scheduler | accounts/models.py | Python | apache-2.0 | 1,579 |
#----------------------------------------------------------------
# Introdução a Programação de Computadores - IPC
# Universidade do Estado do Amazonas - UEA
# Prof. Jucimar Jr
# Dayana Picanço Marquez 1715310058
# Vitor Simões Azevedo 1715310025
# Wilbert Luís Evangelista Marins 1715310055
# ... | jucimarjr/IPC_2017-1 | lista06/lista06_lista01_questao17.py | Python | apache-2.0 | 1,556 |
import sys
import logging
import traceback
import MySQLdb
from DBUtils.PooledDB import PooledDB
from Queue import Queue
from Queue import Empty
from threading import Thread
from threading import Lock
import time
class StorageEngine:
def close(self):
pass
class MySQLSaver(Thread):
def __init__(self, engine):
... | Leaderman/dip | mysql/StorageEngine.py | Python | apache-2.0 | 3,233 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import json
import os
import zipfile
from collections import defaultdict
from typing import Dict, List, Tuple
from pants.backend.jvm.subsystems.dependency_context import DependencyContext... | tdyas/pants | src/python/pants/backend/project_info/tasks/export_dep_as_jar.py | Python | apache-2.0 | 25,157 |
#!/usr/bin/env python
from __future__ import print_function
from collections import OrderedDict
import numpy as np
from kernel_tuner import tune_kernel, run_kernel
from context import get_kernel_path
from km3net.util import generate_input_data
from correlate_full import tune_correlate_full_kernel
if __name__ == "__... | benvanwerkhoven/KM3Net | tuning/match3b_full.py | Python | apache-2.0 | 376 |
# ------------------------------------------------------------------------------
# Name: ColorPicker
# Purpose: Represents a palette based color picker;
#
# Author: Rafael Vasco
#
# Created: 29/04/2013
# Copyright: (c) Rafael 2013
# Licence: <your licence>
#------------------------------------... | rafaelvasco/SpriteMator | src/view/color_picker_widget.py | Python | apache-2.0 | 34,309 |
'''
Corrects misnumbered tests.
Assumes that all tests already have some number assigned to them in the form:
# 01 [optional description]
<Test>
Or:
# 01 - 02 [optional description]
<Tests>
'''
from sys import argv, stderr
import re
def main():
if len(argv) < 2:
print('Usage: python3 {} te... | hep-gc/cloudscheduler | unit_tests/numbering.py | Python | apache-2.0 | 1,748 |
# coding: utf-8
# Licensed under the Apache License, Version 2.0 (the "License")
# See LICENSE for details
import re
from urlparse import urlparse, urlunparse
def parse_hosts(hosts, default_port=4243):
"""Converts hosts in free form to list of urls
"""
out = []
for param in (hosts or []):
if... | mailgun/shipper | shipper/host.py | Python | apache-2.0 | 1,523 |
"""
Test xblock/core/plugin.py
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from mock import patch, Mock
from xblock.test.tools import (
assert_is,
assert_raises_regexp,
assert_equals
)
from xblock.core import XBlock
from xblock import plugin
from xblock.plugin ... | mitodl/XBlock | xblock/test/test_plugin.py | Python | apache-2.0 | 2,835 |
import os
import glob
from .basic_script import BasicScript
class Tlacuilo(BasicScript):
"""Compile the XML code for the workflows based on the given templates and configuration files"""
def get_arguments(self):
"""
Get the arguments to configure current script
:return: list
... | scm-spain/slippin-jimmy | src/slippinj/cli/scripts/tlacuilo.py | Python | apache-2.0 | 4,058 |
from mysolr import Solr
import os, sys, requests, json, time, argparse
def atomicUpdate(chunkFile, solrURL):
session = requests.Session()
solr = Solr(solrURL, make_request=session, version=4)
bufferDocs = []
with open(chunkFile, 'r') as inF:
for docID in inF:
docID = docID.strip... | harsham05/new590DR | dhs_src/atomic_update.py | Python | apache-2.0 | 1,206 |
__author__ = 'Gareth Coles'
from twistifier.server.protocol import DispatcherClient
from twistifier.server.factory import VotifierFactory
from twistifier.common.keys import save_new_keys, has_keys, load_keys
from twisted.internet.endpoints import TCP4ServerEndpoint
from twisted.internet import reactor
if __name__ =... | gdude2002/twistifier | twistifier/examples/default_test.py | Python | artistic-2.0 | 813 |
# Copyright (c) 2017, John Skinner
import unittest
import numpy as np
import metadata.camera_intrinsics as cam_intr
class TestImageMetadata(unittest.TestCase):
def test_constructor_sets_properties(self):
subject = cam_intr.CameraIntrinsics(
width=800,
height=600,
fx=76... | jskinn/robot-vision-experiment-framework | metadata/tests/test_camera_intrinsics.py | Python | bsd-2-clause | 7,371 |
from twotest.fixtures import client, django_client
from wheelcms_axle.tests.fixtures import localtyperegistry, localtemplateregistry, root
| wheelcms/wheelcms_spokes | wheelcms_spokes/tests/conftest.py | Python | bsd-2-clause | 139 |
"""
logging - trivial logging function
Only provides one function that formats the message accordingly to the logging type.
"""
LOG_INFO=1
LOG_WARNING=2
LOG_ERROR=4
LOG_INCOMING=8
LOG_IMPORTANTINFO=16
LOG_LEVEL=LOG_INFO | LOG_WARNING | LOG_ERROR | LOG_INCOMING | LOG_IMPORTANTINFO
def log(type, msgOrCaller, msgOrNon... | LizardM4/PyEC | modules/logging.py | Python | bsd-2-clause | 1,348 |
import sys
import copy
import os.path
import numpy as np
from pandas import DataFrame
import scipy.linalg
import scipy.stats.mstats
from connectivity import CovEmbedding, vec_to_sym, sym_to_vec
import setup_data_paths
import confound
import pval_correction
def get_data(root_dir="/",
data_set=None,
... | rphlypo/parietalretreat | classify_covs.py | Python | bsd-2-clause | 8,324 |
import tokenize
LOGFILE = '/tmp/log.txt'
def translate(readline):
for type, name,_,_,_ in tokenize.generate_tokens(readline):
if type ==tokenize.NAME and name =='myprint':
yield tokenize.NAME, 'print'
else:
yield type,name
import codecs, cStringIO, encodings
from encodings ... | jamesthiele/acodec | token_myprint_codec.py | Python | bsd-2-clause | 1,068 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_chart_name01.py | Python | bsd-2-clause | 1,652 |
from __future__ import absolute_import
import os
from celery import Celery
from celery.signals import celeryd_init
from django.conf import settings
from django.core.management import call_command
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
... | Mitso/springstertestapp | gem/celery.py | Python | bsd-2-clause | 1,125 |
__all__ = [
'reader', 'writer',
]
from migrator_csv import CSVReader, CSVWriter
from migrator_json import JSONReader, JSONWriter
from migrator_couchdb import CouchdbReader, CouchdbWriter
from migrator_couchbase import CouchbaseReader, CouchbaseWriter
from migrator_dir import DirReader, DirWriter
from migrator_zip ... | TOTVS/mdmpublic | couchbase-cli/lib/python/couchbase/migrator/__init__.py | Python | bsd-2-clause | 1,784 |
from flask import send_from_directory
from werkzeug.exceptions import NotFound
from ..bepasty_xstatic import serve_files
def xstatic(name, filename):
"""Route to serve the xstatic files (from serve_files)"""
try:
base_path = serve_files[name]
except KeyError:
raise NotFound()
if not ... | bepasty/bepasty-server | src/bepasty/views/xstatic.py | Python | bsd-2-clause | 408 |
from haystack.indexes import *
from haystack import site
from funda.models import Question, Answer
class QuestionIndex(SearchIndex):
text= CharField(document=True, use_template=True)
def index_queryset(self):
return Question.objects.all()
site.register(Question,QuestionIndex)
| mihi-tr/eriwan | eriwan/funda/search_indexes.py | Python | bsd-2-clause | 289 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class ScrapypaperdownloaderPipeline(object):
def process_item(self, item, spider):
return item
| woltob/scrapy_arxiv_sanity_preserver | ScrapyPaperDownloader/pipelines.py | Python | bsd-2-clause | 301 |
import sys
import shlex
from io import BytesIO, TextIOWrapper
from os import WEXITSTATUS, listdir, system
from subprocess import Popen, PIPE
from os.path import isfile, join
from unittest.mock import patch
import self as grader
def list_files(path, extension=''):
return [f for f in listdir(path) if isfile(join(p... | ChristianMoesl/selfie | grader/tests/utils.py | Python | bsd-2-clause | 3,629 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import setup
version = "1.0"
description = (
'Simple Python .pyc files remover.'
)
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
long_description = read('README.rst')
setup(
name='rempycs',
... | vartagg/rempycs | setup.py | Python | bsd-2-clause | 1,396 |
'''
@author Peter Organisciak
Using Google N-Gram Data, classify a text input based on the most likely year
of the text.
'''
from __future__ import unicode_literals
import os
import logging
from ngramtools import nGramReader
from sqlalchemy import (create_engine, Table, Column, Integer,
Unicode... | organisciak/field-exam | classify_year/index-ngrams.py | Python | bsd-2-clause | 2,868 |
from atelier.invlib import setup_from_tasks
ns = setup_from_tasks(
globals(), "lino_xl",
languages="en de fr et nl pt-br es".split(),
tolerate_sphinx_warnings=False,
blogref_url='http://luc.lino-framework.org',
revision_control_system = 'git',
locale_dir='lino_xl/lib/xl/locale')
... | khchine5/xl | tasks.py | Python | bsd-2-clause | 326 |
# -*- coding: utf-8 -*-
"""Support for the EXASOL database.
Auto Increment Behavior
-----------------------
``IDENTITY`` columns are supported by using SQLAlchemy
``schema.Sequence()`` objects. Example:
from sqlalchemy import Table, Integer, String, Sequence, Column
Table('test', metadata,
Column... | expobrain/sqlalchemy_exasol | sqlalchemy_exasol/base.py | Python | bsd-2-clause | 29,708 |
import sys
import os
import scipy.io as sio
import multiprocessing
sys.path.append('.')
from extractCNNbyTSN import build_net, extract_cnn
UCF20Path = '/data3_alpha/datasets/UCF-20-THUMOS14'
UCF20_Feature_Path = '/data3_alpha/datasets/UCF20/CNNfeature-rgb-kin'
num_worker = 2
layerName = 'inception_5a_output'
def f... | ZhanningGao/temporal-segment-networks | DBS/ExtractCNN/script_getUCF20-CNN-rgb.py | Python | bsd-2-clause | 1,284 |
from django.contrib import admin
from .models import Topic, Message
class TopicAdmin(admin.ModelAdmin):
list_display = ('name', 'is_public',)
class MessageAdmin(admin.ModelAdmin):
list_display = ('author', 'created_at',)
admin.site.register(Topic, TopicAdmin)
admin.site.register(Message, MessageAdmin)
| emakarov/django-parakeet | djparakeet/admin.py | Python | bsd-2-clause | 316 |
# -*- coding: utf-8 -*-
"""
pygments.lexers._mapping
~~~~~~~~~~~~~~~~~~~~~~~~
Lexer mapping defintions. This file is generated by itself. Everytime
you change something on a builtin lexer defintion, run this script from
the lexers folder to update it.
Do not alter the LEXERS dictionary by hand... | pombredanne/pygments | Pygments/pygments-lib/pygments/lexers/_mapping.py | Python | bsd-2-clause | 31,703 |
"""
A module that contains functionality that will register API's from
IUserWampComponent, IUserGlobalSubscriber, IWAMPComponent type as
subscription adapters and later when onJoin occur they will be loaded and
registered inside our wamp session as well
"""
from __future__ import absolute_import
from datetime import ... | dimddev/NetCatKS | NetCatKS/Components/api/implementers/registration/wamp/__init__.py | Python | bsd-2-clause | 2,569 |
"""
********************************************************************************
* Name: condor_py_job
* Author: nswain
* Created On: September 12, 2018
* Copyright: (c) Aquaveo 2018
********************************************************************************
"""
import os
from condorpy import Templates, Job
f... | CI-WATER/tethys | tethys_compute/models/condor/condor_py_job.py | Python | bsd-2-clause | 3,489 |
# DO NOT EDIT THIS FILE. This file will be overwritten when re-running go-raml.
import handlers
async def drones_get(request):
"""
Get a list of drones
It is handler for GET /drones
"""
return handlers.drones_getHandler(request)
async def drones_post(request):
"""
Add a new drone to the... | Jumpscale/go-raml | codegen/python/fixtures/sanic/server/congo/drones_api.py | Python | bsd-2-clause | 1,350 |
from wsgiref.simple_server import make_server
from hello import application
httpd = make_server('',8000,application)
print('Serving HTTP on port 8000 ...')
httpd.serve_forever() | liguangyulgy/mytest1 | wsgi/server.py | Python | bsd-2-clause | 180 |
# The Nexus software is licensed under the BSD 2-Clause license.
#
# You should have recieved a copy of this license with the software.
# If you did not, you can find one at the following link.
#
# http://opensource.org/licenses/bsd-license.php
import random
from core.plugins import ProtocolPlugin
from core.decorator... | TheArchives/Nexus | core/plugins/tnt.py | Python | bsd-2-clause | 6,230 |
#!/usr/bin/env python
__author__ = 'Thomas R. Lennan, Stephen Henrie, Michael Meisinger'
from uuid import uuid4
import bcrypt
#from pyon.core.security.authentication import Authentication
from pyon.public import log, RT, OT, Inconsistent, NotFound, BadRequest, get_ion_ts_millis, get_ion_ts, Unauthorized
from interf... | crchemist/scioncc | src/ion/services/identity_management_service.py | Python | bsd-2-clause | 16,206 |
# Copyright (c) 2012-2022, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
def validate_recoveryoption_name(recoveryoption_name):
"""
Validate Name for RecoveryOption
Property: RecoveryOption.Name
"""
VALID_RECOVERYOPTION_NAME = (
"admin_only",
... | cloudtools/troposphere | troposphere/validators/cognito.py | Python | bsd-2-clause | 614 |
#! /usr/bin/env python
# Copyright (c) 2013, Rob Ward
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list ... | rob-ward/smtp-filter-server | smtp-filter-server.py | Python | bsd-2-clause | 4,798 |
"""
Benchmarks for array expressions.
"""
import numpy as np
from numba import jit
@jit(nopython=True)
def sum(a, b):
return a + b
@jit(nopython=True)
def sq_diff(a, b):
return (a - b) * (a + b)
@jit(nopython=True)
def rel_diff(a, b):
return (a - b) / (a + b)
def setup():
ArrayExpressions.setupC... | gmarkall/numba-benchmark | benchmarks/bench_arrayexprs.py | Python | bsd-2-clause | 1,152 |
"""
Tests different implementations of solve functions.
"""
from __future__ import print_function
from unittest import TestCase, skipIf
import numpy as np
from numpy.testing import run_module_suite, assert_allclose
from pkg_resources import parse_version
import gulinalg
class TestSolveTriangular(TestCase):
"""
... | ContinuumIO/gulinalg | gulinalg/tests/test_solve.py | Python | bsd-2-clause | 11,244 |
import numpy as np
import scipy.sparse.linalg as LA
from build2DFDMatrix import get2DMesh
from buildWave2DMatrix import getWave2DMatrix, getWave2DUpwindMatrix
from unflatten import unflatten
from pySDC.core.Problem import ptype
from pySDC.implementations.datatype_classes import mesh, rhs_imex_mesh
class acoustic_2d_... | Parallel-in-Time/pySDC | pySDC/playgrounds/deprecated/acoustic_2d_imex/ProblemClass.py | Python | bsd-2-clause | 4,905 |
from django.test import SimpleTestCase
from corehq.apps.userreports.rebuild import DataSourceResumeHelper
from corehq.apps.userreports.tests.utils import get_sample_data_source
class DataSourceResumeBuildTest(SimpleTestCase):
@classmethod
def setUpClass(cls):
super(DataSourceResumeBuildTest, cls).se... | dimagi/commcare-hq | corehq/apps/userreports/tests/test_resume_rebuild.py | Python | bsd-3-clause | 1,688 |
from django.db import models
import tickets.models
class CaseNoteQuerySet(models.QuerySet):
def filter_for_viewer(self, viewer):
if viewer.is_anonymous():
return self.none()
elif not viewer.has_perm('casenotes.view_casenote'):
query = models.Q(shared_with_users=viewer) | m... | Kvoti/ditto | ditto/casenotes/models.py | Python | bsd-3-clause | 1,439 |
# -*- coding: utf-8 -*-
import json
import unittest
import os
import io
import nbformat
import pytest
from requests.exceptions import ConnectionError
from tempfile import TemporaryDirectory
from unittest.mock import Mock, patch
from .. import iorw
from ..iorw import (
HttpHandler,
LocalHandler,
ADLHandle... | nteract/papermill | papermill/tests/test_iorw.py | Python | bsd-3-clause | 11,037 |
# python imports
import locale
# lfs imports
from lfs.plugins import PaymentMethodProcessor
from lfs.plugins import PM_ORDER_IMMEDIATELY
from lfs.caching.utils import lfs_get_object_or_404
from lfs.core.models import Shop
# django imports
from django.conf import settings
from django.contrib.sites.models import Site
f... | diefenbach/lfs-paypal | lfs_paypal/processor.py | Python | bsd-3-clause | 2,638 |
"""
Integrate Jinja with RST / Sphinx
http://ericholscher.com/blog/2016/jul/25/integrating-jinja-rst-sphinx/
"""
from ...info import gammacat_info
gammacat_context = dict(
version=gammacat_info.version,
)
def rstjinja(app, docname, source):
"""
Render our pages as a jinja template for fancy templating ... | gammapy/gamma-cat | gammacat/sphinx/exts/rstjinja.py | Python | bsd-3-clause | 667 |
"""
WSGI config for sanlam_reality_rewards_lister project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.s... | rudigiesler/sanlam-reality-rewards-lister | sanlam_reality_rewards_lister/wsgi.py | Python | bsd-3-clause | 436 |
# -*- coding: utf-8 -*-
from django.db import models
class OpcionPedagogica(models.Model):
nombre = models.CharField(max_length = 50)
def __unicode__(self):
return self.nombre
class Meta:
app_label = 'titulos'
db_table = 'titulos_opcion_pedagogica'
| MERegistro/meregistro | meregistro/apps/titulos/models/OpcionPedagogica.py | Python | bsd-3-clause | 288 |
from django.db import models
CHAR_CHOICES = (
('test1', 'Test 1'),
('test2', 'Test 2'),
('test3', 'Test 3'),
('test4', 'Test 4'),
('test5', 'Test 5'),
('test6', 'Test 6'),
('test7', 'Test 7'),
)
INTEGER_CHOICES = (
(1, 'Test 1'),
(2, 'Test 2'),
(3, 'Test 3'),
(4, 'Test 4'),... | kaleidos/django-sampledatahelper | tests/models.py | Python | bsd-3-clause | 3,355 |
# -*- coding: future_fstrings -*-
"""
This module gives the "listener" classes for the PyEcore notification layer.
The main class to create a new listener is "EObserver" which is triggered
each time a modification is perfomed on an observed element.
"""
from enum import unique, Enum
from itertools import chain
class ... | pyecore/pyecore | pyecore/notification.py | Python | bsd-3-clause | 1,844 |
import os
from django.core.files import File
from django.test.utils import override_settings
from .raster_testcase import RasterTestCase
@override_settings(RASTER_TILESIZE=100)
class RasterLayerParserWithoutCeleryTests(RasterTestCase):
def test_raster_layer_parsing(self):
self.assertEqual(self.rasterla... | PADAS/django-raster | tests/test_rasterlayer_parser.py | Python | bsd-3-clause | 2,923 |
import mangler
import urlparse
# Adjust these config settings for use in config below
# Base URL of the server with scheme, host and optional port
# e.g "https://tank.peermore.com/"
base_url = ''
# Cookie salt. Set to a complex random string.
secret = 'cookies taste better with a bit of salt'
# oauth ids and secrets... | cdent/tankdock | runner/tiddlywebconfig.py | Python | bsd-3-clause | 3,607 |
# Django settings for eukalypse_now project.
import os
PROJECT_ROOT = os.path.normpath(os.path.dirname(__file__))
HOME = os.path.expanduser("~")
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
import djcelery
djcelery.setup_loader()
BROKER_URL = 'dj... | kinkerl/eukalypse_now | src/eukalypse_now/settings.py | Python | bsd-3-clause | 5,143 |
# -*- coding: utf-8 -*-
'''
Created on 25.06.2012
@author: bach
'''
from shotgun_replica.sync.shotgun_to_local import EventProcessor
from shotgun_replica.connectors import DatabaseModificator
from shotgun_replica.factories import getObject
from shotgun_replica.entity_manipulation import changeEntity
from tests_elefa... | dahiro/shotgun-replica | shotgun_replica/python/tests/shotgun_replica_tests/sync/shotgun_to_local/test_change.py | Python | bsd-3-clause | 3,895 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# 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 copyrigh... | nuagenetworks/vspk-python | vspk/v5_0/nuoverlayaddresspool.py | Python | bsd-3-clause | 10,655 |
"""Unittests for $ rio blocks"""
import json
import re
import numpy as np
import rasterio
from rasterio.warp import transform_bounds
from rasterio.compat import zip_longest
from rasterio.rio.main import main_group
def check_features_block_windows(features, src, bidx):
"""Compare GeoJSON features to a datasou... | brendan-ward/rasterio | tests/test_rio_blocks.py | Python | bsd-3-clause | 4,743 |
from __future__ import absolute_import
import six
import pytest
import base64
import mock
from exam import fixture
from six.moves.urllib.parse import urlencode, urlparse, parse_qs
from django.conf import settings
from django.core.urlresolvers import reverse
from sentry.auth.providers.saml2 import SAML2Provider, Attr... | gencer/sentry | tests/sentry/web/frontend/test_auth_saml2.py | Python | bsd-3-clause | 5,835 |
from django.views import generic
from django.template.loader import select_template
from django.shortcuts import render
from .models import Page
def home_page(request):
page_base_template_names = ["nupages/base.html",]
page_template_names = ["nupages/index.html",]
page_list = Page.objects.published()
... | goldhand/django-nupages | nupages/views.py | Python | bsd-3-clause | 4,345 |
#!/usr/bin/python
from gcode import *
from config import *
#define operations to run here
operations = [
Bore(Point(1.25, 1.25, 0), 1, .25, toolDiameter).generate(),
#rapidTravel(Point(-3, 1, 1)),
]
#generate program from the list of operations
generateProgram(operatio... | jfamestad/gcode | bore.py | Python | bsd-3-clause | 324 |
#!/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 task
from .fhirdate import FHIRDate
class TaskTests(unittest.TestCase):
def instantiate_from(self, filename):
datadir... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_3_0_0/models/task_tests.py | Python | bsd-3-clause | 14,958 |
# -*- coding: utf-8 -*-
import logging
import os
from django.test import TestCase as Test_Case_django
from django.test.utils import override_settings
from django.test.client import RequestFactory
from django.contrib.messages.storage.fallback import FallbackStorage
from django.contrib.messages import get_messages
from... | pfrancois/grisbi_django | gsb/tests/test_base.py | Python | bsd-3-clause | 6,649 |
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 3 15:35:30 2016
@author: decarlo
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from xdesign import *
import os
import time
import pytz
import datetime
import numpy as np
import m... | tomography/tomobank | docs/demo/phantom_00003.py | Python | bsd-3-clause | 4,085 |
from numpy import *
from configobj import ConfigObj
class Contrast(dict):
def __init__(self, indict=None,verbose=0):
dict.__init__(self)
if indict != None:
for entry in indict.keys():
if entry != "Type" and entry != "Dimension":
if verbose: print indi... | yarikoptic/NiPy-OLD | examples/neurospin/neurospy/Contrast.py | Python | bsd-3-clause | 4,557 |
"""
This module implements the telnet protocol.
This depends on a generic session module that implements
the actual login procedure of the game, tracks
sessions etc.
"""
import re
from twisted.internet.task import LoopingCall
from twisted.conch.telnet import Telnet, StatefulTelnetProtocol, IAC, LINEMODE, GA, WILL, W... | emergebtc/muddery | evennia/evennia/server/portal/telnet.py | Python | bsd-3-clause | 11,644 |
import random
import datetime
from hashlib import sha1
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.db import models
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django... | softak/webfaction_demo | apps/accounts/models.py | Python | bsd-3-clause | 4,127 |
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... | mishbahr/django-staticgen | docs/conf.py | Python | bsd-3-clause | 8,191 |
"""
Torture tests for asymptotics and high precision evaluation of
special functions.
(Other torture tests may also be placed here.)
Running this file (gmpy and psyco recommended!) takes several CPU minutes.
With Python 2.6+, multiprocessing is used automatically to run tests
in parallel if many cores are available. ... | tovrstra/sympy | sympy/mpmath/tests/torture.py | Python | bsd-3-clause | 7,884 |
import unittest
from django.conf import settings
from django.contrib.auth.models import User
from liveblog.models import LiveBlogEntry
#from blog.models import Entry
from markdown import markdown
blog = __import__(settings.BLOG_APP)
Entry = blog.models.__getattribute__(settings.BLOG_ENTRY_MODEL)
class LiveBlogTest... | bycoffe/django-liveblog | tests.py | Python | bsd-3-clause | 1,094 |
from __future__ import print_function
from math import pi
import pandas as pd
from bokeh.models import (
Plot, ColumnDataSource, FactorRange, CategoricalAxis, TapTool, HoverTool, OpenURL, CategoricalScale)
from bokeh.models.glyphs import Rect
from bokeh.document import Document
from bokeh.embed import file_html
f... | percyfal/bokeh | examples/models/file/colors.py | Python | bsd-3-clause | 9,076 |
import torch
from torch import Tensor
def _box_cxcywh_to_xyxy(boxes: Tensor) -> Tensor:
"""
Converts bounding boxes from (cx, cy, w, h) format to (x1, y1, x2, y2) format.
(cx, cy) refers to center of bounding box
(w, h) are width and height of bounding box
Args:
boxes (Tensor[N, 4]): boxes... | pytorch/vision | torchvision/ops/_box_convert.py | Python | bsd-3-clause | 2,408 |
"""
Copyright (c) 2016 Rodrigo Baravalle
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
notice, this list of conditions and the following... | rbaravalle/imfractal | imfractal/__init__.py | Python | bsd-3-clause | 3,273 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['Lag1Trend'] , ['Seasonal_DayOfMonth'] , ['SVR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_None/model_control_one_enabled_None_Lag1Trend_Seasonal_DayOfMonth_SVR.py | Python | bsd-3-clause | 157 |
import time
import sys
import shutil
import os
if (sys.version_info >= (2, 7)):
import unittest
else:
import unittest2 as unittest
from resource_suite import ResourceBase
from pydevtest_common import assertiCmd, assertiCmdFail, interruptiCmd, getiCmdOutput
import pydevtest_common
import pydevtest_sessions as s
... | irods/irods_resource_plugin_msso | test/pydevtest/test_workflow_suite.py | Python | bsd-3-clause | 3,308 |
"""
Django settings for {{cookiecutter.project_name}} project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the project like this: os.path.... | st4lk/cookiecutter-django | {{cookiecutter.repo_name}}/config/settings.py | Python | bsd-3-clause | 6,595 |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 31 10:17:09 2015
@author: mje
"""
import mne
from mne.minimum_norm import (source_induced_power, read_inverse_operator)
import numpy as np
import sys
from my_settings import (tf_folder, subjects_dir, epochs_folder, mne_folder)
subject = sys.argv[1]
# Using the same inv... | MadsJensen/CAA | extract_ts_source_tfr_grad.py | Python | bsd-3-clause | 2,934 |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import sys
from mixbox.binding_utils import *
from . import cybox_common
from . import device_object
from . import win_volume_object
class AccessedFileListType(GeneratedsSuper):
"""The AccessedFileListType sp... | CybOXProject/python-cybox | cybox/bindings/win_prefetch_object.py | Python | bsd-3-clause | 28,464 |
from sympy import solve
from pydy import *
N = NewtonianReferenceFrame('N')
rrt, rft, rr, rf, lr, ls, lf, l1, l2, l3, l4 = N.declare_parameters('rrt rft rr rf lr ls lf l1 l2 l3 l4')
# Declare generalized coordinates and generalized speeds
(q1, q2, q3, q4, q5, q6, q7, q8), q_list, qdot_list = N.declare_coords('q', 8... | hazelnusse/pydy | examples/bicycle/nofunc.py | Python | bsd-3-clause | 2,931 |
#!/usr/bin/python
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for the cros_best_revision program."""
from __future__ import print_function
import os
import sys
sys.path.insert(0... | mxOBS/deb-pkg_trusty_chromium-browser | third_party/chromite/scripts/cros_best_revision_unittest.py | Python | bsd-3-clause | 5,142 |
import re
import param
from param.parameterized import classlist
import ipywidgets
from ipywidgets import (
SelectMultiple, Button, HBox, VBox, Layout, Text, HTML,
FloatSlider, FloatText, IntText, IntSlider,
Image, ColorPicker, FloatRangeSlider, IntRangeSlider, Dropdown,
Output
)
import traitlets
fro... | ioam/paramnb | paramnb/widgets.py | Python | bsd-3-clause | 12,693 |
def extractThewebnovelhavenWordpressCom(item):
'''
Parser for 'thewebnovelhaven.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', 'translate... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractThewebnovelhavenWordpressCom.py | Python | bsd-3-clause | 572 |