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 |
|---|---|---|---|---|---|
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | tseaver/google-cloud-python | bigquery/samples/tests/test_create_table.py | Python | apache-2.0 | 814 |
#
# Copyright (c) SAS Institute 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 required by applicable law or agreed to in w... | sassoftware/rmake3 | rmake/lib/rpcproxy.py | Python | apache-2.0 | 16,010 |
from . import models
dosage_form = {
"Liq" : "liquid",
"Tab" : "tablet",
"Cap" : "capsule",
"Cps" : "capsule",
"Oin" : "ointment",
"Lit" : "lotion",
"Lot" : "lotion",
"Inj" : "injection",
"Syr" : "syrup",
"Dsp" : "effervescent tablet",
"Eft" : "effervescent tablet",
"Ear... | Code4SA/medicine-price-registry | mpr/serialisers.py | Python | apache-2.0 | 3,715 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import os
#sys.path.append("".join([os.path.dirname(__file__), "/../"]))
from libnmap.parser import NmapParser
from libnmap.diff import NmapDiffException
class TestNmapParser(unittest.TestCase):
def setUp(self):
fdir = os.path.dirname(os.path... | pyphrb/myweb | app/plugin/nmap/libnmap/test/test_report.py | Python | apache-2.0 | 9,693 |
# coding: utf-8
"""
Cloudbreak API
Cloudbreak is a powerful left surf that breaks over a coral reef, a mile off southwest the island of Tavarua, Fiji. Cloudbreak is a cloud agnostic Hadoop as a Service API. Abstracts the provisioning and ease management and monitoring of on-demand clusters. SequenceIQ's Cloud... | Chaffelson/whoville | whoville/cloudbreak/models/management_pack_request.py | Python | apache-2.0 | 9,101 |
"""
This modules provides various functions for operating on files.
Functions:
copy_files: Copy file(s) to a specified location.
move_files: Move file(s) to a specified location.
"""
import subprocess
def copy_files(filenames: list, destination: str):
"""
Copy files to a given destination.
Arg... | bigfatpanda-training/pandas-practical-python-primer | training/level-2-command-line-interfaces/bfp-reference/exercise_14/step_01/file_ops.py | Python | artistic-2.0 | 3,344 |
import json
import logging
import sys
import uuid
from redash.query_runner import *
from redash.utils import JSONEncoder
from redash.query_runner.mssql import MSSQLJSONEncoder, types_map
logger = logging.getLogger(__name__)
try:
import pyodbc
enabled = True
except ImportError:
enabled = False
class SQL... | 44px/redash | redash/query_runner/mssql_odbc.py | Python | bsd-2-clause | 5,258 |
# -*- coding: utf-8 -*-
#
# behave documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 29 16:33:26 2011.
#
# 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.
#
# All ... | memee/behave | docs/conf.py | Python | bsd-2-clause | 8,807 |
from shapely.ops import cascaded_union
from shapely.geometry import LineString, MultiLineString, MultiPolygon, Polygon
from shapely.geometry import shape
import fiona
from osgeo import gdal, ogr, osr
import sys
import os, glob
from osgeo.gdalconst import *
from rtree import index
from math import *
import time
import ... | vickyting0910/opengeocoding | 4roadADDR_parse.py | Python | bsd-2-clause | 6,243 |
# coding=utf-8
from __future__ import unicode_literals
import django
from django.conf import settings
def get_image_field_class():
try:
from sorl.thumbnail import ImageField
except ImportError:
from django.db.models import ImageField
return ImageField
def get_image_field_full_name():
... | springmerchant/pybbm | pybb/compat.py | Python | bsd-2-clause | 2,979 |
import pytest
from pytest import approx
from datetime import datetime
import pymap3d as pm
@pytest.mark.parametrize("use_astropy", [True, False])
def test_eci2ecef(use_astropy):
pytest.importorskip("numpy")
if use_astropy:
pytest.importorskip("astropy")
# this example from Matlab eci2ecef docs
... | scienceopen/pymap3d | src/pymap3d/tests/test_eci.py | Python | bsd-2-clause | 2,982 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from setuptools import find_packages
from setuptools import setup
import pathlib
def _read(path):
with open(path) as f:
return f.read()
name = 'parmatter'
project_info = {}
exec(_r... | Ricyteach/parmatter | setup.py | Python | bsd-2-clause | 1,462 |
"""
This module takes care of a lot of user related things.
It's a good place to put validators and user management functions/classes
"""
import os
RANDOM_USERNAME_LENGTH = 12
def generate_random_username():
"""Returns random username of length set by RANDOM_USERNAME_LENGTH
The generated names will ... | EuroPython/epcon | conference/users.py | Python | bsd-2-clause | 489 |
import itertools
from math import sqrt
from babyfood.pcb.PCBUnits import toMM
from babyfood.features.basic import CircularVia
from babyfood.components.ABC import AbstractTHComponent
stdSpacing = (toMM(2.54), toMM(2.54))
pinEdgeWidth = 0.64
pinViaDiameter = toMM(sqrt((pinEdgeWidth ** 2) * 2))
stdVia = CircularVia((p... | meawoppl/babyfood | babyfood/components/PinHeader.py | Python | bsd-2-clause | 2,140 |
from PyQt4.QtCore import QAbstractTableModel, QModelIndex, QVariant
from PyQt4.QtCore import Qt
class SimpleTableModel(QAbstractTableModel):
"""Implement a simple table model around a list.
AFAIK, PyQt4 doesn't provide an easy way to have a table model, so here it
is.
It's a very basic, non-performan... | multani/kodos-qt4 | kodos/model.py | Python | bsd-2-clause | 3,897 |
import cv2
def get_answer():
"""Get an answer."""
return True
def create_model_config():
"""Creates a functioning config file for testing purposes"""
return True
def set_resolution(cap, x, y):
cap.set(cv2.CAP_PROP_FRAME_WIDTH, int(x))
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, int(y))
return str... | patrick310/sc-vision | vdp/helpers.py | Python | bsd-2-clause | 1,186 |
#!/usr/bin/env python
# coding=utf-8
"""
Balanced ternary integers
=========================
This module provides for sequences of balanced ternary digits to be interpreted
and operated on as integers. In a signed interpretation (Int), the trit values
-, 0 and + represent negative one, zero and positive one respectiv... | direvus/btern | integer.py | Python | bsd-2-clause | 8,570 |
from Crypto.PublicKey import RSA
from Crypto import Random
rng = Random.new().read
def check_signature(pubkey, shibboleth, signature):
rsakey = RSA.importKey(pubkey)
return rsakey.verify(str(shibboleth), (int(signature),))
def authenticate_user(db, app, form):
username = form['username']
shibboleth =... | zhemao/speakeasy | wsgi/crypto.py | Python | bsd-2-clause | 1,014 |
"""
>>> get_list('world')
[1, 'hello', 2.0, 'world']
>>> get_tuple('world')
(1L, 'hello', 2.0, 'world')
>>> get_dict('world') == {"hello": 1, 2.0: 'world'}
True
"""
import sys
from numba import *
myglobal = 20
@autojit(backend='ast')
def get_list(x):
return [1, "hello", 2.0, x]
@autojit(backend='ast')
def get_t... | shiquanwang/numba | numba/tests/test_object_literals.py | Python | bsd-2-clause | 598 |
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# 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 condit... | programa-stic/barf-project | barf/core/symbols.py | Python | bsd-2-clause | 3,209 |
import sys
import leeway.__main__
from leeway.cli import main
def test_main():
assert main([]) == 0
def test_main_sys():
assert main(sys.argv) == 0
def test_main_none():
assert main(None) == 0
def test_main_some():
assert main([1, 2, False, None, 'foo']) == 0
def test_main_folder():
asser... | sdrees/python-leeway | tests/test_leeway.py | Python | bsd-2-clause | 354 |
# coding: utf-8
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
impo... | mindbody/API-Examples | SDKs/Python/test/test_get_sites_request.py | Python | bsd-2-clause | 948 |
from attest import assert_hook
# There was a bug caused by using assert_hook in __init__.py and a relative
# import. This file is used to test that that bug no longer exists.
from . import foo
| dag/attest | attest/tests/dummy/__init__.py | Python | bsd-2-clause | 194 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "associate.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| shenek/django-mojeid-auth | examples/associate/manage.py | Python | bsd-2-clause | 252 |
from __future__ import print_function
import os
import sys
import manhole
stack_dump_file = '/tmp/manhole-pid'
uwsgi_signal_number = 17
try:
import uwsgi
if not os.path.exists(stack_dump_file):
open(stack_dump_file, 'w')
def open_manhole(dummy_signum):
with open(stack_dump_file, 'r') a... | ionelmc/python-manhole | tests/wsgi.py | Python | bsd-2-clause | 1,101 |
from __future__ import unicode_literals
import os
import sys
import threading
from contextlib import contextmanager
from django.contrib.sites.models import Site
from mezzanine.conf import settings
from mezzanine.core.request import current_request
from mezzanine.utils.deprecation import get_middleware_setting
SITE... | BQLQ/BQLQ | mezzanine-4.2.3/mezzanine/utils/sites.py | Python | bsd-2-clause | 4,567 |
"""
Scraper for Florida 5th District Court of Appeal
CourtID: flaapp5
Court Short Name: flaapp5
Author: Andrei Chelaru
Reviewer: mlr
History:
- 2014-07-23, Andrei Chelaru: Created.
- 2014-08-05, mlr: Updated.
- 2014-08-06, mlr: Updated.
- 2014-09-18, mlr: Updated date parsing code to handle Sept.
"""
... | Andr3iC/juriscraper | opinions/united_states/state/fladistctapp_5.py | Python | bsd-2-clause | 5,349 |
import path_helper
from minecraftstuff import MinecraftShape, ShapeBlock
from mcpi.minecraft import Minecraft
import time
#connect to minecraft
mc = Minecraft.create()
#test MinecraftShape
playerPos = mc.player.getTilePos()
#create the shape object
bt = "diamond_block"
shapeBlocks = [ShapeBlock(0,0,0,bt),
... | wensheng/JuicyRaspberryPie | api/python/examples/minecraftstuff_shapes.py | Python | bsd-2-clause | 867 |
from ctree.simd.types import m256d, m256, m512
from ctree.types import register_type_codegenerators
register_type_codegenerators({
m256d: lambda t: "__m256d",
m256: lambda t: "__m256",
m512: lambda t: "__m512"
})
| ucb-sejits/ctree | ctree/simd/__init__.py | Python | bsd-2-clause | 227 |
from __future__ import division
from __future__ import absolute_import
import logging
logger = logging.getLogger('root')
from builtins import *
import math
import shlex
#!/usr/bin/env python
#Copyright (c) 2013, Eduard Broecker
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or withou... | swatz/canmatrix | canmatrix/importsym.py | Python | bsd-2-clause | 11,514 |
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
import logging
import click
import socket
from mkdocs import __version__
from mkdocs import utils
from mkdocs import exceptions
from mkdocs.config import load_config
from mkdocs.commands import build, gh_deploy, new, serve
log = logging.ge... | dmehra/mkdocs | mkdocs/__main__.py | Python | bsd-2-clause | 7,251 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 Michael Hull.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... | mikehulluk/morphforge | src/morphforgetest/morphforge/unittests/morphology/core/testmorphologyarray.py | Python | bsd-2-clause | 2,749 |
#
# Models Tallys Yunes Metrorail tickets problem.
# https://orbythebeach.wordpress.com/2018/03/01/buying-metrorail-tickets-in-miami/
#
# Implement core functionality needed to achieve modularity.
# 1. Define the input data schema
# 2. Define the output data schema
# 3. Create a solve function that accepts a data set c... | opalytics/opalytics-ticdat | examples/expert_section/ampl_original_examples/metrorail/metrorail.py | Python | bsd-2-clause | 5,886 |
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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:
#
# 1. Redistributions of source code must retain the above ... | yiannist/ganeti | lib/config/__init__.py | Python | bsd-2-clause | 111,131 |
# Copyright (c) 2015-2016 Sippy Software, Inc. All rights reserved.
#
# 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, ... | sippy/voiptests | test_cases/t1.py | Python | bsd-2-clause | 9,308 |
import os
from subprocess import check_call
from tempfile import NamedTemporaryFile
from typing import Dict, Iterable, List, Optional, Set
from gilgamesh.disassembly.disassembly import Disassembly
from gilgamesh.disassembly.parser import Token
from gilgamesh.disassembly.renames import apply_renames
from gilgamesh.erro... | AndreaOrru/Gilgamesh | gilgamesh/disassembly/container.py | Python | bsd-2-clause | 2,466 |
#!/usr/local/bin/python2.7
"""
Copyright (c) 2015 Ad Schellevis <ad@opnsense.org>
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 a... | evbevz/plugins | devel/helloworld/src/opnsense/scripts/OPNsense/HelloWorld/testConnection.py | Python | bsd-2-clause | 2,977 |
"""
The metadata API is used to allow customization of how `OPTIONS` requests
are handled. We currently provide a single default implementation that returns
some fairly ad-hoc information about the view.
Future implementations might use JSON schema or other definitions in order
to return this information in a more sta... | HireAnEsquire/django-rest-framework | rest_framework/metadata.py | Python | bsd-2-clause | 5,786 |
import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.txt')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name = 'django-curated-resources',
version = '0.1',
packages = ... | evildmp/django-curated-resources | setup.py | Python | bsd-2-clause | 1,207 |
# Uses py.test.
from __future__ import print_function
import os
import sys
new_syspath = os.path.join(os.path.dirname(__file__), '..', '..')
sys.path.append(new_syspath)
import math
import numpy as np
import pytest
from misu import (
kg, s, lb, minute, Hz, kHz, GHz, MHz, ft, BTU, MW, d, m3, inch, Pa, bar,
cm... | cjrh/misu | misu/tests/test_numpy_fcn.py | Python | bsd-2-clause | 1,012 |
# coding=utf-8
from setuptools import setup
setup(
name='python-mysql-simple-wrapper',
version='1.2.9',
url='https://github.com/secfree/python-mysql-simple-wrapper',
author='secfree',
description='A simple wrapper for operation on mysql.',
long_description=__doc__,
py_modules=['mysql_simp... | secfree/python-mysql-simple-wrapper | setup.py | Python | bsd-2-clause | 619 |
# -*- coding: utf-8 -*-
#
# django-otp documentation build configuration file, created by
# sphinx-quickstart on Fri Jul 13 09:48:33 2012.
#
# 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.
#
# ... | altanawealth/django-otp | docs/source/conf.py | Python | bsd-2-clause | 8,356 |
# -*- coding: utf-8 -*-
from mock import Mock
from nose.tools import eq_, ok_
from rest_framework.request import Request
from rest_framework.serializers import CharField, Serializer
from rest_framework.test import APIRequestFactory
from test_utils import RequestFactory
import amo
from amo.tests import TestCase
from ad... | wagnerand/zamboni | mkt/api/tests/test_fields.py | Python | bsd-3-clause | 13,694 |
from datetime import datetime
from .key_service import NoodleKeyService
from bson import ObjectId
class AbstractDocumentCollection(object):
def __init__(self, key="nice_key", filter=None):
self.key = key
self._provider_managed_keys = set()
self.filter = dict(filter or {})
self._... | NoodleEducation/dborutils | dborutils/mongo.py | Python | bsd-3-clause | 8,410 |
# coding: utf-8
# imports
import os, re, decimal
from time import gmtime, strftime, localtime, mktime, time
from urlparse import urlparse
# django imports
from django.utils.translation import ugettext_lazy as _
from django.utils.safestring import mark_safe
from django.core.files import File
from django.core.files.sto... | vosi/django-medias | medias/functions.py | Python | bsd-3-clause | 11,965 |
from ..generic import Base_Generic
from ..generic.sample import logp_rho_prec, logp_lambda_prec
from ...utils import se_covariance, se_precision
from ... import verify
import numpy as np
class Base_SESE(Base_Generic):
"""
All arguments to this function ar documented in SESE
"""
def __init__(self, Y, X,... | lixun910/pysal | pysal/model/spvcm/both_levels/se_se/model.py | Python | bsd-3-clause | 10,108 |
def extractFreezingslowlyWordpressCom(item):
'''
Parser for 'freezingslowly.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', 'translated'),... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractFreezingslowlyWordpressCom.py | Python | bsd-3-clause | 568 |
# -*- coding: utf-8 -*-
'''
Simple RPC
Copyright (c) 2012-2013, LastSeal S.A.
'''
from types import MethodType
class decorator_base(object):
pass
def getClass(name):
class ExposedDecorator(decorator_base):
def __init__(self, method):
self.method = method
def __call__(self, *args, *... | joaduo/python-simplerpc | simplerpc/expose_api/decorators.py | Python | bsd-3-clause | 910 |
import pdb
arr = [
[ 8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8],
[49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0],
[81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65],
[52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, ... | bgwines/project-euler | src/solved/problem11.py | Python | bsd-3-clause | 3,032 |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# 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
# ... | JakubBrachTieto/openthread | tests/scripts/thread-cert/Cert_5_6_02_NetworkDataRegisterBeforeAttachRouter.py | Python | bsd-3-clause | 4,513 |
# -*- coding: utf-8 -*-
"""Initial version
Revision ID: d5cfdc5eca6d
Revises: None
Create Date: 2016-04-16 13:58:37.356613
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd5cfdc5eca6d'
down_revision = None
def upgrade():
# commands auto generated by Alemb... | derek-miller/flask-template | flask_template/migrations/versions/d5cfdc5eca6d_initial_version.py | Python | bsd-3-clause | 2,740 |
from __future__ import absolute_import
from datetime import timedelta
from django.utils import timezone
from rest_framework.response import Response
from sentry.api.base import EnvironmentMixin
from sentry.api.bases.team import TeamEndpoint
from sentry.api.serializers import serialize, GroupSerializer
from sentry.mod... | gencer/sentry | src/sentry/api/endpoints/team_groups_trending.py | Python | bsd-3-clause | 1,816 |
##
# title: InfoTable.py
# by: Brian Kim
# description: a gtk Table that
# is used to display information about
# multiple objects of the same type
#
import pygtk
pygtk.require('2.0')
import gtk
class InfoTable( gtk.Table ):
pass
| briansan/rams | RAMS/gui/InfoTable.py | Python | bsd-3-clause | 237 |
#!/usr/bin/env python
import roslib; roslib.load_manifest('ardrone_project')
import rospy
import time
from PySide import QtCore, QtGui
from ros_drone import DroneController, MainController
import ros_drone
from ardrone_autonomy.msg import Navdata
import sys
PATH_TO_SOAR = "/home/saikishor/SoarSuite/bin"
sys.path.appe... | saikishor/soar-to-ros | ardrone_project_new/src/soar.py | Python | bsd-3-clause | 6,750 |
import argparse
import logging
import sys
from .eventlog import EventLog
from .logs import setup_logs
log = logging.getLogger(__name__)
parser = argparse.ArgumentParser()
parser.add_argument('-p', '--pretty', action='store_true')
parser.add_argument('-d', '--dumps', action='store_true')
parser.add_argument('-v', '-... | westernx/sgevents | sgevents/__main__.py | Python | bsd-3-clause | 609 |
##########################################################################
#
# Copyright (c) 2011, John Haddon. All rights reserved.
# Copyright (c) 2011-2015, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided ... | appleseedhq/gaffer | python/GafferUI/GLWidget.py | Python | bsd-3-clause | 15,338 |
def extractWwwYhittranslationsXyz(item):
'''
Parser for 'www.yhittranslations.xyz'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loi... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractWwwYhittranslationsXyz.py | Python | bsd-3-clause | 560 |
import gtable as gt
import gtable.reductions
class TimeSuite:
def setup(self):
self.t = gt.Table()
self.t.add_column('a', [1, 2, 2, 3, 4, 5])
self.t.add_column('b', [1, 2, 3])
self.t.add_column('c', [3, 4, 5], align='bottom')
def time_reduce_sum_1(self):
gtable.reduce_... | guillemborrell/gtable | benchmarks/benchmark_reductions.py | Python | bsd-3-clause | 737 |
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import erf
from scipy import optimize
# ---------------------------- Preprocessing ----------------------------------
def _dc_from_profiles(profiles):
dc, c_mean = [], []
for profile in profiles:
n_comp, n_pts = profile.shape
... | emmanuelle/multi-diffusion | multidiff/diffusion_matrix.py | Python | bsd-3-clause | 17,566 |
from validator.errorbundler import ErrorBundle
from validator.rdf import RDFParser
from validator.xpi import XPIManager
from validator.constants import *
import validator.typedetection as typedetection
def _test_type(file_, expectation, failure=False):
'Tests a file against the expectations'
err = ErrorBundl... | diox/amo-validator | tests/test_typedetection.py | Python | bsd-3-clause | 3,732 |
'''
This is example configuration for Stratum server.
Please rename it to config.py and fill correct values.
'''
# ******************** GENERAL SETTINGS ***************
# Enable some verbose debug (logging requests and responses).
DEBUG = False
# Destination for application logs, files rotated once per day.
LOGDIR =... | tuaris/TidePool | lib/config_default.py | Python | bsd-3-clause | 8,806 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import time
from django.db import models, migrations
from django.utils.timezone import localtime
def migrate_events(apps, schema_editor):
Event = apps.get_model('domecek', 'Event')
for event in Event.objects.all():
start ... | misli/django-domecek | domecek/migrations/0022_event_dates.py | Python | bsd-3-clause | 2,432 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2022, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | qiime2/qiime2 | qiime2/jupyter/__init__.py | Python | bsd-3-clause | 489 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
=============
TAP plus
=============
@author: Juan Carlos Segovia
@contact: juan.carlos.segovia@sciops.esa.int
European Space Astronomy Centre (ESAC)
European Space Agency (ESA)
Created on 30 jun. 2016
"""
try:
# python 3
... | ceb8/astroquery | astroquery/utils/tap/conn/tapconn.py | Python | bsd-3-clause | 26,124 |
from typing import Union
from flask import current_app
from flask_appbuilder.const import (
API_SECURITY_PROVIDER_DB,
API_SECURITY_PROVIDER_LDAP,
AUTH_DB,
AUTH_LDAP,
)
from marshmallow import fields, Schema, ValidationError
from marshmallow.validate import Length, OneOf
provider_to_auth_type = {"db":... | dpgaspar/Flask-AppBuilder | flask_appbuilder/security/schemas.py | Python | bsd-3-clause | 1,359 |
import zeit.content.article.edit.browser.testing
class Form(zeit.content.article.edit.browser.testing.BrowserTestCase):
block_type = 'cardstack'
def test_inline_form_saves_values(self):
self.get_article(with_empty_block=True)
b = self.browser
b.open(
'editable-body/blockn... | ZeitOnline/zeit.content.article | src/zeit/content/article/edit/browser/tests/test_cardstack.py | Python | bsd-3-clause | 709 |
def extractOneManArmy(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'DBWG – Chapter' in item['title'] or 'Dragon-Blooded War God' in item['tags']:
return buildReleaseMessageWithType(item, 'Drag... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractOneManArmy.py | Python | bsd-3-clause | 556 |
#!/usr/bin/env python
# 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 copy
import os
import sys
import unittest
root_dir = os.path.abspath(os.path.join(
os.path.dirname(__file__), os.path.pardi... | eunchong/build | scripts/slave/recipe_modules/auto_bisect/config_validation_test.py | Python | bsd-3-clause | 5,667 |
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
... | macrael/webnull | setup.py | Python | bsd-3-clause | 1,144 |
"""
Parse spotify URLs
"""
from __future__ import unicode_literals, print_function, division
import re
import logging
import base64
import requests
log = logging.getLogger('spotify')
def get_token(client_id, client_secret):
token = client_id + ":" + client_secret
encoded_token = base64.b64encode(token)
... | lepinkainen/pyfibot | pyfibot/modules/module_spotify.py | Python | bsd-3-clause | 2,523 |
# -*- coding: utf-8 -*-
"""
Tests of the neo.core.event.Event class
"""
try:
import unittest2 as unittest
except ImportError:
import unittest
import numpy as np
import quantities as pq
try:
from IPython.lib.pretty import pretty
except ImportError as err:
HAVE_IPYTHON = False
else:
HAVE_IPYTHON = ... | SummitKwan/python-neo | neo/test/coretest/test_event.py | Python | bsd-3-clause | 9,451 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
requirements = [
]
test_requirements = [
]
setup(
name='tvsubs-ren... | eliasdorneles/tvsubs_rename | setup.py | Python | bsd-3-clause | 1,433 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import apps
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cfp', '0004_auto_20161210_1721'),
]
Submission = apps.get_model('cfp', 'Submission')
WorkshopSubmis... | djangocon/2017.djangocon.eu | conference/cfp/migrations/0005_auto_20170304_1524.py | Python | bsd-3-clause | 1,096 |
# -*- coding: utf-8 -*-
"""stillness.managers -- Can you manage the stillness?
"""
import sys
import os
import copy
import subprocess
import itertools
import time
import re
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from versioners import Versions
from path import p... | eykd/Stillness | stillness/managers.py | Python | bsd-3-clause | 13,312 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Profile.region'
db.add_column('profiles_profile', 'region', self.gf('django.db.models.fiel... | softak/webfaction_demo | apps/profiles/migrations/0004_auto__add_field_profile_region.py | Python | bsd-3-clause | 5,529 |
#!/usr/bin/python
# Copyright 2015 Couchbase, 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 required by appl... | daverigby/memcached | tests/breakpad_test.py | Python | bsd-3-clause | 10,727 |
"""
Twisted integration
-------------------
This module provides a very simple way to integrate your tests with the
Twisted event loop.
You must import this module *before* importing anything from Twisted itself!
Example::
from nose.twistedtools import reactor, deferred
@deferred()
def test_resolve():
... | santisiri/popego | envs/ALPHA-POPEGO/lib/python2.5/site-packages/nose-0.10.1-py2.5.egg/nose/twistedtools.py | Python | bsd-3-clause | 5,104 |
from django.forms.fields import *
from corehq.apps.sms.forms import BackendForm
from dimagi.utils.django.fields import TrimmedCharField
class UnicelBackendForm(BackendForm):
username = TrimmedCharField()
password = TrimmedCharField()
sender = TrimmedCharField()
| gmimano/commcaretest | corehq/apps/unicel/forms.py | Python | bsd-3-clause | 276 |
from django.core.files.base import ContentFile
from django.core.files import File
def create_dummy_files():
# Create dummy files to be the XSD and XLS files
dummy_xsd_content = ContentFile("Dummy Schema File")
dummy_xls_content = ContentFile("Dummy Excel File")
dummy_xsd_file = File(dummy_xsd_content, "dummyFi... | usgin/modelmanager | tests/utils.py | Python | bsd-3-clause | 431 |
"""
WSGI config for MySmile 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysmile.settings.local")
from django.... | MySmile/mysmile | mysmile/wsgi.py | Python | bsd-3-clause | 395 |
from django.contrib import admin
from comments.models import Comment
from django.utils.translation import ugettext_lazy as _, ungettext
from comments.views.moderation import perform_delete, perform_hide
class CommentsAdmin(admin.ModelAdmin):
fieldsets = (
(_('Content'),
{'fields': ('user', 'com... | vosi/django-xcomments | comments/admin.py | Python | bsd-3-clause | 2,704 |
"""Copyright (C) 2011 ESO/Centre de Recherche Astronomique de Lyon (CRAL)
utils: includes a few useful input output routines
"""
__version__ = '0.0.1'
__revision__ = '$Revision: 1.00 $'
__date__ = '$Date: 2012/03/04 15:05 $'
__all__ = ['iodata', 'biweight']
| emsellem/pygme | pygme/utils/__init__.py | Python | bsd-3-clause | 268 |
# -*- coding: utf-8 -*-
"""
templatetk.nodes
~~~~~~~~~~~~~~~~
Implements the AST of the templating language itself. To avoid confusion
in terms with the Python AST which is used for compilation, this is
internally as ATST (Abstract Template Syntax Tree).
:copyright: (c) Copyright 2011 by Armi... | mitsuhiko/templatetk | templatetk/nodes.py | Python | bsd-3-clause | 16,400 |
# -*- encoding: utf-8
from repchan.exceptions import VersionDisabledMethodException
def enable_in_trash_context(method):
'Disabling methods of context "main"'
def decorator(self, *args, **kwargs):
if self.check_is_main_version() and self.version_in_trash == True:
raise VersionDisabledMethod... | fizista/django-repchan | repchan/decorators.py | Python | bsd-3-clause | 1,879 |
import param
import numpy as np
from matplotlib.collections import LineCollection, PolyCollection
from ...core.data import Dataset
from ...core.options import Cycle, abbreviated_exception
from ...core.util import unique_array, search_indices, is_number, isscalar
from ...util.transform import dim
from ..mixins import ... | ioam/holoviews | holoviews/plotting/mpl/graphs.py | Python | bsd-3-clause | 15,941 |
# -*- coding: utf-8 -*-
VERSION = (1, 5, 0, 'alpha')
def version():
return (u'%s.%s.%s %s' % VERSION).strip(' .')
| butfriendly/friendly-django-topcoat | friendly/topcoat/__init__.py | Python | bsd-3-clause | 120 |
import numpy as nm
from sfepy.base.base import Struct
from sfepy.terms.terms import terms
from sfepy.terms.terms_hyperelastic_base import HyperElasticBase
_msg_missing_data = 'missing family data!'
class HyperElasticULBase(HyperElasticBase):
"""
Base class for all hyperelastic terms in UL formulation family.... | RexFuzzle/sfepy | sfepy/terms/terms_hyperelastic_ul.py | Python | bsd-3-clause | 10,369 |
#!/usr/bin/env python
"""
scripts.multi_processsing
=========================
top level script for processing a cpol file from command line
on Argonne LCRC Blues
.. autosummary::
:toctree: generated/
hello_world
"""
from matplotlib import use
use('agg')
#import processing_code as radar_codes
import sys
from gl... | scollis/AGU_2016 | scripts/multi_proccessing.py | Python | bsd-3-clause | 15,094 |
from django.conf.urls import url
from corehq.apps.oauth_integrations.views.google import (
redirect_oauth_view,
call_back_view
)
urlpatterns = [
# OAuth redirect views
url(r"^google_sheets_oauth/redirect/$",
redirect_oauth_view,
name="google_sheet_oauth_redirect"),
url(r"^google_sh... | dimagi/commcare-hq | corehq/apps/oauth_integrations/urls.py | Python | bsd-3-clause | 414 |
"""
File backends for storing pandas objects.
"""
import pandas as pd
import numpy as np
from datreant.core.backends.core import File
pddatafile = 'pdData.h5'
class pdDataFile(File):
"""Interface to pandas object data files.
Data is stored as pandas data structures (Series, DataFrame, Panel) in
the... | datreant/datreant.data | src/datreant/data/pddata.py | Python | bsd-3-clause | 4,728 |
from django.test import TestCase
from eca_catalogue.text.tests.factories import WashingInstructionFactory
class WashingInstructionTest(TestCase):
def test_model(self):
obj = WashingInstructionFactory()
self.assertTrue(obj.pk)
def test_render_icon(self):
obj = WashingInstructionFactor... | byteweaver/django-eca-catalogue | eca_catalogue/text/tests/models_tests.py | Python | bsd-3-clause | 492 |
"""Discussions app"""
default_app_config = "discussions.apps.DiscussionsConfig"
| mitodl/open-discussions | discussions/__init__.py | Python | bsd-3-clause | 80 |
import os
import django
import pytest
not_implemented = pytest.mark.skip(reason="Not implemented")
class IntendedException(Exception):
# Use this to check if a function has been called
pass
class UnintendedException(Exception):
# Use this to verify a function hasn't been called
pass
def raise_un... | networklocum/django-changes-on-save | tests/__init__.py | Python | bsd-3-clause | 642 |
class FreightTruck:
def __init__(self):
self.make
self.model
self.mpg
self.weight
| KevinFasusi/supplychainpy | supplychainpy/distribution/land_frieght_transport.py | Python | bsd-3-clause | 119 |
import json
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
import arrow
import emission.analysis.config as eac
# These may be altered to run tests
_test_options = {
"use_sample": False,
"override_keylist": None
}
# PRIVATE HELPER FUNCTIONS
def _get_expectation_confi... | e-mission/e-mission-server | emission/analysis/configs/expectation_notification_config.py | Python | bsd-3-clause | 5,955 |
import io
import os
import numpy as np
import pytest
from dask.compatibility import BZ2File, GzipFile, LZMAFile, LZMA_AVAILABLE
from dask.utils import (textblock, filetext, takes_multiple_arguments,
Dispatch, tmpfile, different_seeds, file_size)
SKIP_XZ = pytest.mark.skipif(not LZMA_AVAILABL... | mikegraham/dask | dask/tests/test_utils.py | Python | bsd-3-clause | 3,931 |
#! /usr/bin/env python
"""
# FEATURE_CCID_ESC_COMMAND.py: Unitary test for FEATURE_CCID_ESC_COMMAND
# Copyright (C) 2011 Ludovic Rousseau
"""
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Fou... | vicamo/pcsc-lite-android | UnitaryTests/FEATURE_CCID_ESC_COMMAND_Gemalto_features.py | Python | bsd-3-clause | 3,076 |
from setuptools import setup
setup(
name='mcrypto',
version='0.1',
author='Pavel Brodsky',
author_email='mcouthon@gmail.com',
packages=[
'mcrypto',
'mcrypto.mcrypto_project',
'mcrypto.mcrypto_project.mcrypto_project',
'mcrypto.mcrypto_project.portfolio',
'mc... | mcouthon/mcrypto | setup.py | Python | bsd-3-clause | 612 |
from sympy.core.backend import symbols, Matrix, cos, sin, atan, sqrt, Rational
from sympy import solve, simplify, sympify
from sympy.physics.mechanics import dynamicsymbols, ReferenceFrame, Point,\
dot, cross, inertia, KanesMethod, Particle, RigidBody, Lagrangian,\
LagrangesMethod
from sympy.utilities.pytest im... | kaushik94/sympy | sympy/physics/mechanics/tests/test_linearize.py | Python | bsd-3-clause | 11,805 |
#the driver program to run the app details miner
import os, sys
from appMiner import mineApps
def extract_app_details():
#give a URL from where you will fetch the details.
mainURL = "https://play.google.com"
#create an initial object for the page
pager = mineApps(mainURL)
#create a page detailer object for acc... | bharathkallurs/appsminer | curler.py | Python | bsd-3-clause | 1,256 |