code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from __future__ import absolute_import, unicode_literals
from collections import namedtuple
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.db.models.fields import FieldDoesNotExist
from django.test.client import RequestFactory
from drf_toolbox.compat import django_pgfields_installed,... | pombredanne/drf-toolbox | tests/test_serializers.py | Python | bsd-3-clause | 23,089 |
#!/usr/bin/env python
#
# Test fff_array wrapping
#
from numpy.testing import assert_almost_equal, assert_equal
import numpy as np
import nipy.neurospin.bindings as fb
MAX_TEST_SIZE = 30
def random_shape(size):
"""
Output random dimensions in the range (2, MAX_TEST_SIZE)
"""
aux = np.random.randint... | yarikoptic/NiPy-OLD | nipy/neurospin/bindings/tests/test_array.py | Python | bsd-3-clause | 2,134 |
import os
from setuptools import setup, find_packages
def read(filename):
return open(os.path.join(
os.path.dirname(__file__), filename)).read()
entry_points = """
[zc.buildout]
default = svetlyak40wt.recipe.symlinks:Symlinks
[zc.buildout.uninstall]
default = svetlyak40wt.recipe.symlinks:uninstal... | svetlyak40wt/svetlyak40wt.recipe.symlinks | setup.py | Python | bsd-3-clause | 1,194 |
def function1():
"""
Return 1
"""
return 1
def function2():
"""
Return 2
"""
return 2
| has2k1/travis_doc | travis_doc/travis_doc.py | Python | bsd-3-clause | 120 |
# Copyright 2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | arkmaxim/grpc | src/python/grpcio_tests/grpc_version.py | Python | bsd-3-clause | 1,643 |
"""
Lift ckernels to their appropriate rank so they always consume the full array
arguments.
"""
from __future__ import absolute_import, division, print_function
from pykit.ir import transform, Op
#------------------------------------------------------------------------
# Run
#---------------------------------------... | zeeshanali/blaze | blaze/compute/air/passes/ckernel_impls.py | Python | bsd-3-clause | 1,537 |
#!/usr/bin/python -OOOO
# vim: set fileencoding=utf8 shiftwidth=4 tabstop=4 textwidth=80 foldmethod=marker :
# Copyright (c) 2010, Kou Man Tong. All rights reserved.
# For licensing, see LICENSE file included in the package.
"""
Base codec functions for bson.
"""
import struct
import cStringIO
import calendar, pytz
fro... | cupcicm/bson | bson/codec.py | Python | bsd-3-clause | 10,379 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
args_linear = ['/openmp', '/O2', '/favor:INTEL64']
args_nonlinear = ['/openmp', '/O2', '/favor:INTEL64', '/fp:fast']
ext_modules = [
Extension('clpt_commons_bc1', ['clpt_commons_bc1.pyx'],
... | albertoferna/compmech | compmech/conecyl/clpt/setup_clpt_bc1.py | Python | bsd-3-clause | 472 |
import sys
import numpy as np
from copy import copy, deepcopy
import multiprocessing as mp
from numpy.random import shuffle, random, normal
from math import log, sqrt, exp, pi
import itertools as it
from scipy.stats import gaussian_kde, pearsonr
from scipy.stats import ttest_1samp
from itertools import product
try:
... | Gibbsdavidl/miergolf | src/corEdges.py | Python | bsd-3-clause | 3,914 |
import gc
import numpy as np
from pandas import (
DatetimeIndex,
Float64Index,
Index,
IntervalIndex,
MultiIndex,
RangeIndex,
Series,
date_range,
)
from .pandas_vb_common import tm
class SetOperations:
params = (
["datetime", "date_string", "int", "strings"],
["i... | jorisvandenbossche/pandas | asv_bench/benchmarks/index_object.py | Python | bsd-3-clause | 6,355 |
#!/usr/bin/env python
import sys
import os
import pandas as pd
import numpy as np
from hmmlearn.hmm import *
from sklearn.externals import joblib
import ipdb
import time
from math import (
log,
exp
)
from matplotlib import pyplot as plt
from sklearn.preprocessing import (
scale,
normalize
)
def matplo... | birlrobotics/HMM | hmm_for_hiro_snap_task/failure_detection/hmm_model_test_classification_mid_real_hiro.py | Python | bsd-3-clause | 21,847 |
# Copyright (c) 2015 - present Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import ... | jsachs/infer | infer/lib/python/inferlib/issues.py | Python | bsd-3-clause | 9,001 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
TRANSACTION_STATUS = (
('P', _('pending')),
('F', _('failed')),
('C', _('complete')),
)
class Transaction(models.Model):
user = models.ForeignKey(User, blank = True, null... | truevision/django_banklink | django_banklink/models.py | Python | bsd-3-clause | 1,291 |
from django.test import TestCase
from forums.factories import PostFactory
class CategoryModelTests(TestCase):
def setUp(self):
self.post = PostFactory()
def test_string_method(self):
self.assertEquals(str(self.post), 'Body text\nWith multiple lines!')
| byteweaver/django-forums | tests/test_model_post.py | Python | bsd-3-clause | 280 |
"""
RGB Colourspace & Transformations
=================================
Defines the following *RGB* colourspace transformations:
- :func:`colour_hdri.camera_space_to_RGB`
- :func:`colour_hdri.camera_space_to_sRGB`
"""
from __future__ import annotations
import numpy as np
from colour.algebra import matrix_dot, ... | colour-science/colour-hdri | colour_hdri/models/rgb.py | Python | bsd-3-clause | 3,252 |
# pyeq2 is a collection of equations expressed as Python classes
#
# Copyright (C) 2012 James R. Phillips
# 2548 Vera Cruz Drive
# Birmingham, AL 35235 USA
#
# email: zunzun@zunzun.com
# web: http://zunzun.com
#
# License: BSD-style (see LICENSE.txt in main source directory)
# Version info: $Id:... | JMoravec/unkRadnet | fitToCurve/pyeq2/Models_2D/Peak.py | Python | bsd-3-clause | 66,908 |
im = open('006993_photoA.tif', 'rb')
ord(im.read(1))
chr(ord(im.read(1))) | vincentdavis/corrupt_image_finder | test_images/RandomMutateImage.py | Python | bsd-3-clause | 73 |
"""MNE software for MEG and EEG data analysis."""
# PEP0440 compatible formatted version, see:
# https://www.python.org/dev/peps/pep-0440/
#
# Generic release markers:
# X.Y
# X.Y.Z # For bugfix releases
#
# Admissible pre-release markers:
# X.YaN # Alpha release
# X.YbN # Beta release
# X.YrcN # Rele... | kambysese/mne-python | mne/__init__.py | Python | bsd-3-clause | 5,932 |
""" pytest fixtures for test suite """
import pytest
import sqlalchemy as sa
import sqlalchemy.orm as orm
import testing.postgresql
import temporal_sqlalchemy as temporal
from . import models
@pytest.yield_fixture(scope='session')
def engine():
"""Creates a postgres database for testing, returns a sqlalchemy eng... | CloverHealth/temporal-sqlalchemy | temporal_sqlalchemy/tests/conftest.py | Python | bsd-3-clause | 1,589 |
"""
drslib exceptions
"""
class TranslationError(Exception):
pass
| ESGF/esgf-drslib | drslib/exceptions.py | Python | bsd-3-clause | 73 |
import logging
import os
import unittest
from unittest.mock import Mock, patch
from flask import Flask
from flask_appbuilder import AppBuilder, SQLA
from flask_appbuilder.security.manager import AUTH_LDAP
import jinja2
import ldap
from mockldap import MockLdap
from ..const import USERNAME_ADMIN, USERNAME_READONLY
l... | dpgaspar/Flask-AppBuilder | flask_appbuilder/tests/security/test_auth_ldap.py | Python | bsd-3-clause | 41,672 |
import wx
import wx.calendar
from wx.lib.masked import TimeCtrl
from wx.lib.agw import hypertreelist as HTL
from datetime import datetime, time
from lib import Task, DATA, PRIORITIES, DEFAULT_PRIORITY
from decorators import requires_selection
ID_ADD_TASK = 1000
ID_ADD_SUBTASK = 1010
ID_COLLAPSE = 1020
ID_EXPAND = 103... | codekoala/treedo | treedo/gui.py | Python | bsd-3-clause | 12,628 |
# -*- coding: utf-8 -*-
# Future
from __future__ import absolute_import, division, print_function, \
unicode_literals, with_statement
# Standard Library
from datetime import datetime
# Third Party
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D # Load 3d plots ca... | cigroup-ol/metaopt | metaopt/plugin/visualization/best_fitness.py | Python | bsd-3-clause | 1,969 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import inselect
REQUIREMENTS = [
# TODO How to specify OpenCV? 'cv2>=3.1.0',
'numpy>=1.11.1,<1.12',
'Pillow>=3.4.2,<3.5',
'python-dateutil>=2.6.0,<2.7',
'pytz>=2016.7',
'PyYAML>=3.12,<3.2',
'schematics>=1.1.1,<1.2',
'scikit-lea... | NaturalHistoryMuseum/inselect | setup.py | Python | bsd-3-clause | 7,651 |
# $Id$
#
# Copyright (C) 2001-2006 greg Landrum and Rational Discovery LLC
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
""" periodic table data... | jandom/rdkit | rdkit/Chem/PeriodicTable.py | Python | bsd-3-clause | 5,870 |
from communities.models import Community, SendToOption
from datetime import datetime, date, time
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from ocd.formfields import HTMLArea, OCSplitDateTime, OCCheckboxSelectMultiple
from users.models import OCUser, Membership
import flo... | hasadna/OpenCommunity | src/communities/forms.py | Python | bsd-3-clause | 4,808 |
# -*- coding: utf8
from __future__ import division, print_function
from collections import defaultdict
from matplotlib import pyplot as plt
from radar import radar_factory
from scipy import stats
from scripts import initialize_matplotlib
import numpy as np
import plac
import sys
REFERRER_ABBRV = {
'EXTERNAL':... | flaviovdf/pyksc | src/scripts/col_to_cluster.py | Python | bsd-3-clause | 7,933 |
import json
import django
from django.db import models
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.core.serializers.json import DjangoJSONEncoder
from django.d... | marguslaak/django-xadmin | xadmin/models.py | Python | bsd-3-clause | 4,934 |
"""star subcommand tests"""
# (c) 2015-2021 Wibowo Arindrarto <contact@arindrarto.dev>
import json
import pytest
from click.testing import CliRunner
from crimson.cli import main
from .utils import get_test_path
@pytest.fixture(scope="module")
def star_fail():
runner = CliRunner()
in_file = get_test_path("s... | bow/crimson | tests/test_star.py | Python | bsd-3-clause | 2,311 |
# Copyright (c) 2021, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from collections import defaultdict, OrderedDict
import logging as _logging
from .internal_graph imp... | apple/coremltools | coremltools/converters/mil/frontend/torch/torchir_passes.py | Python | bsd-3-clause | 12,830 |
"""
This is our testing framework.
Goals:
* it should be compatible with py.test and operate very similarly (or
identically)
* doesn't require any external dependencies
* preferably all the functionality should be in this file only
* no magic, just import the test file and execute the test functions, that's it
* port... | gnulinooks/sympy | sympy/utilities/runtests.py | Python | bsd-3-clause | 21,885 |
from djangobench.utils import run_benchmark
from query_latest.models import Book
def benchmark():
Book.objects.latest()
run_benchmark(
benchmark,
meta = {
'description': 'A simple Model.objects.latest() call.',
}
)
| alex/djangobench | djangobench/benchmarks/query_latest/benchmark.py | Python | bsd-3-clause | 241 |
#!/usr/bin/env python
"""Execute the tests for the razers2 program.
The golden test outputs are generated by the script generate_outputs.sh.
You have to give the root paths to the source and the binaries as arguments to
the program. These are the paths to the directory that contains the 'projects'
directory.
Usage:... | h-2/seqan | core/apps/razers2/tests/run_tests.py | Python | bsd-3-clause | 12,963 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010, 2degrees Limited <egoddard@tech.2degreesnetwork.com>.
# All Rights Reserved.
#
# This file is part of djangoaudit <https://launchpad.net/django-audit/>,
# which is subject to the provisions of ... | rdkls/django-audit-mongodb | tests/test_models.py | Python | bsd-3-clause | 25,093 |
"""
A framework for data processing and data preparation DAG (directed acyclic graph) pipelines.
The examples in the documentation assume
>>> from __future__ import print_function
if running pre Py3K, as well as
>>> from dagpype import *
"""
import types
from . import _core
from . import _src
from . import _fi... | garywu/pypedream | pypedream/__init__.py | Python | bsd-3-clause | 1,083 |
def plot_kinematics(signal, background, nbins=100,
mass_range=(50., 110.), pt_range=(200., 500.),
mass_pad=10, pt_pad=50,
linewidth=1, title=None):
import numpy as np
from matplotlib import pyplot as plt
import h5py
pt_min, pt_max = pt_range
... | deepjets/deepjets | etc/plotting_NR.py | Python | bsd-3-clause | 6,730 |
from datetime import date
from django import forms
from django.utils.translation import ugettext_lazy as _lazy
class AnnouncementForm(forms.Form):
"""Form for collecting information about an announcement.
This is not a ModelForm, and does not include the group or locale fields,
because it should only be... | mozilla/kitsune | kitsune/announcements/forms.py | Python | bsd-3-clause | 842 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
# @file ostap/math/random_ext.py
# The simple extention for the standard python module random
# @author Vanya BELYAEV
# @date 2012-04-28
# =====================================================... | OstapHEP/ostap | ostap/math/random_ext.py | Python | bsd-3-clause | 6,045 |
from AutoNetkit.examples.examples import *
import AutoNetkit.examples.examples
| sk2/ank_le | AutoNetkit/examples/__init__.py | Python | bsd-3-clause | 80 |
import bleach
from django.db.models.fields import TextField
from django.utils.encoding import smart_text
from .widgets import RichTextareaWidget
class RichTextarea(TextField):
"""
"""
def to_python(self, value):
"""
"""
if value:
html = value.replace(' ', ' ')
... | Merino/poc-cbb | vesper/fields.py | Python | bsd-3-clause | 1,042 |
import collections.abc
import tempfile
import sys
import warnings
import operator
import io
import itertools
import functools
import ctypes
import os
import gc
import weakref
import pytest
from contextlib import contextmanager
from numpy.compat import pickle
import pathlib
import builtins
from decimal import Decimal
... | simongibbons/numpy | numpy/core/tests/test_multiarray.py | Python | bsd-3-clause | 339,352 |
#!/usr/bin/env python
# Copyright (c) 2011 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.
"""Implements a simple "negative compile" test for C++ on linux.
Sometimes a C++ API needs to ensure that various usages cannot co... | endlessm/chromium-browser | tools/nocompile_driver.py | Python | bsd-3-clause | 18,515 |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2013, LastSeal S.A.
Copyright (c) 2011-2012, Joaquin G. Duo
All rights reserved.
This code is distributed under BSD 3-clause License.
For details check the LICENSE file in the root of the project.
'''
class FrameworkObject(object):
pass
def smokeTestModule():
Frame... | joaduo/python-simplerpc | simplerpc/common/abstract/FrameworkObject.py | Python | bsd-3-clause | 383 |
import warnings
from collections import namedtuple
from MySQLdb.constants import FIELD_TYPE
from django.db.backends.base.introspection import (
BaseDatabaseIntrospection, FieldInfo, TableInfo,
)
from django.db.models.indexes import Index
from django.utils.datastructures import OrderedSet
from django.utils.depreca... | camilonova/django | django/db/backends/mysql/introspection.py | Python | bsd-3-clause | 9,426 |
"""Module will classes related to PV row geometries"""
import numpy as np
from pvfactors.config import COLOR_DIC
from pvfactors.geometry.base import \
BaseSide, _coords_from_center_tilt_length, PVSegment
from shapely.geometry import GeometryCollection, LineString
from pvfactors.geometry.timeseries import \
TsS... | SunPower/pvfactors | pvfactors/geometry/pvrow.py | Python | bsd-3-clause | 31,109 |
#!/usr/bin/env python
from sys import argv
from sys import stdout
stdout.write('argv ')
print(argv)
stdout.write('argv[1:] ')
print(argv[1:])
stdout.write('argv[:] ')
print(argv[:])
stdout.write('len(argv) ')
print(len(argv))
stdout.write('len(argv[1:]) ')
print(len(argv[1:]))
stdout.write('len(argv[:]) ')
print... | talapus/Ophidian | Commandline_input/argv_experiment.py | Python | bsd-3-clause | 613 |
import yaml as yaml
from astropy import units
import re
class DefaultParser:
"""Not invented here syndrome"""
__check = {}
__convert = {}
__list_of_leaf_types = []
def __init__(self, default_dict):
self.__register_leaf('list')
self.__register_leaf('int')
self.__r... | mklauser/tardis-OLD | tardis/io/default_config_parser.py | Python | bsd-3-clause | 19,137 |
#===========================================================================
# Copyright (c) 2011-2012, the PyFACT developers
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributio... | mraue/pyfact | pyfact/map.py | Python | bsd-3-clause | 11,616 |
import unittest
from llvm.core import (Module, Type, Builder)
from .support import TestCase, tests
class TestExact(TestCase):
def make_module(self):
mod = Module.new('asdfa')
fnty = Type.function(Type.void(), [Type.int()] * 2)
func = mod.add_function(fnty, 'foo')
bldr = Builder.new(... | llvmpy/llvmpy | llvm/tests/test_exact.py | Python | bsd-3-clause | 1,076 |
import numpy as np
import amnet
import z3
from numpy.linalg import norm
import sys
import unittest
import itertools
VISUALIZE = True # output graphviz drawings
if VISUALIZE:
import amnet.vis
class TestSmt(unittest.TestCase):
@classmethod
def setUpClass(cls):
print 'Setting up test floats.'
... | ipapusha/amnet | tests/test_smt.py | Python | bsd-3-clause | 32,730 |
from .functor import Functor
class _PASS(Functor):
def __call__(self, *_, **__):
pass
__enter__ = __exit__ = __call__
def __repr__(self):
return '<PASS>'
PASS = _PASS()
| Infinidat/infi.pyutils | infi/pyutils/functors/pass_.py | Python | bsd-3-clause | 198 |
from __future__ import print_function, division, absolute_import
from numbers import Integral
from operator import add
import os
import shutil
import sys
import traceback
import logging
import re
import pytest
from toolz import pluck
from tornado import gen
from tornado.ioloop import TimeoutError
from distributed.ba... | broxtronix/distributed | distributed/tests/test_worker.py | Python | bsd-3-clause | 16,430 |
# ----------------------------------------------------------------------------
# cocos2d
# Copyright (c) 2008-2011 Daniel Moisset, Ricardo Quesada, Rayentray Tappa,
# Lucio Torre
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the... | eevee/cocos2d-mirror | cocos/particle.py | Python | bsd-3-clause | 17,917 |
# 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... | airelil/pywinauto | pywinauto/handleprops.py | Python | bsd-3-clause | 14,685 |
"""
WSGI config for dj_bookmarks 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.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | kennethlove/django_bookmarks | dj_bookmarks/dj_bookmarks/wsgi.py | Python | bsd-3-clause | 402 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cacao', '0006_auto_20150119_0946'),
]
operations = [
migrations.AddField(
model_name='section',
name... | CacaoMovil/guia-de-cacao-django | cacao_app/cacao/migrations/0007_auto_20150123_1600.py | Python | bsd-3-clause | 2,739 |
# -*- coding: utf-8 -*-
"""
Formulas for density calculation.
"""
from math import log10
from colormath.density_standards import (
ANSI_STATUS_T_BLUE,
ANSI_STATUS_T_GREEN,
ANSI_STATUS_T_RED,
VISUAL_DENSITY_THRESH,
ISO_VISUAL,
)
def ansi_density(color, density_standard):
"""
Calculates den... | gtaylor/python-colormath | colormath/density.py | Python | bsd-3-clause | 2,458 |
# -*- coding: utf-8 -*-
import hashlib
import math
import struct
import base64
import json
import zlib
import binascii
from Crypto.Cipher import AES
from Crypto import Random
salt ='__E3S$hH%&*KL:"II<UG=_!@fc9}021jFJ|KDI.si81&^&%%^*(del?%)))+__'
fingerprint_len =4
iv_len =16
randomiv_len =4
print_log =False
# 输入密... | dungeonsnd/forwarding | EChat/pack.py | Python | bsd-3-clause | 3,621 |
from django.test import TestCase
from corehq.apps.receiverwrapper import submit_form_locally
from couchforms.models import XFormError
class CaseProcessingErrorsTest(TestCase):
def test_no_case_id(self):
"""
submit form with a case block that has no case_id
check that
- it errors
... | puttarajubr/commcare-hq | corehq/ex-submodules/couchforms/tests/test_errors.py | Python | bsd-3-clause | 3,166 |
from datetime import datetime
import hashlib
import os
import random
import re
import string
import time
from django import forms, dispatch
from django.conf import settings
from django.contrib.auth.models import User as DjangoUser
from django.core import validators
from django.db import models
from django.template imp... | jbalogh/zamboni | apps/users/models.py | Python | bsd-3-clause | 17,994 |
""" Defines the base class for color maps
"""
from traits.api import Enum, HasTraits, Instance
from data_range_1d import DataRange1D
class AbstractColormap(HasTraits):
"""
Abstract class for color maps, which map from scalar values to color values.
"""
# The data-space bounds of the mapper.
range... | burnpanck/chaco | chaco/abstract_colormap.py | Python | bsd-3-clause | 2,253 |
# -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use sendgrid to send emails
- Use MEMCACHIER on Heroku
'''
from configurations import values
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings... | djangocali/blog-api | blog-api/config/production.py | Python | bsd-3-clause | 4,350 |
# perf script event handlers, generated by perf script -g python
# Licensed under the terms of the GNU GPL License version 2
# The common_* event handler fields are the most useful fields common to
# all events. They don't necessarily correspond to the 'common_*' fields
# in the format files. Those fields not availa... | dterei/Scraps | perf/syscall-latency.py | Python | bsd-3-clause | 1,275 |
from pkg_resources import DistributionNotFound, get_distribution
def get_version():
try:
return get_distribution("naima").version
except DistributionNotFound:
# package is not installed
return "UNINSTALLED"
| zblz/naima | src/naima/version.py | Python | bsd-3-clause | 241 |
from simcore import *
comm.setADCValue(1,0,1,400)
comm.setADCValue(2,0,1,380)
comm.setADCValue(3,0,1,362)
comm.setADCValue(4,0,1,334)
comm.setADCValue(5,0,1,412)
comm.setADCValue(6,0,1,425)
comm.setADCValue(7,0,1,445)
comm.setADCValue(8,0,1,429)
| jryans/wavelet-tinyos | compasstest/adc.py | Python | bsd-3-clause | 246 |
####
#### Give a report on the "sanity" of the users and groups YAML
#### metadata files.
####
#### Example usage to analyze the usual suspects:
#### python3 sanity-check-users-and-groups.py --help
#### Get report of current problems:
#### python3 ./scripts/sanity-check-users-and-groups.py --users metadata/users.yaml... | geneontology/go-site | scripts/sanity-check-users-and-groups.py | Python | bsd-3-clause | 7,704 |
#!/usr/bin/env python
import os
import sys
try:
# For local development in a virtualenv:
from funfactory import manage
except ImportError:
# Production:
# Add a temporary path so that we can import the funfactory
tmp_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
... | satdav/mozillians | manage.py | Python | bsd-3-clause | 590 |
"""HaloEndpoint class"""
import cloudpassage.sanity as sanity
from .utility import Utility as utility
from .http_helper import HttpHelper
class HaloEndpoint(object):
"""Base class inherited by other specific HaloEndpoint classes."""
default_endpoint_version = 1
def __init__(self, session, **kwargs):
... | cloudpassage/cloudpassage-halo-python-sdk | cloudpassage/halo_endpoint.py | Python | bsd-3-clause | 3,416 |
#(c) 2016-2018 by Authors
#This file is a part of Flye program.
#Released under the BSD license (see LICENSE file)
"""
Created on Wed Jan 4 03:50:31 2017
@author: jeffrey_yuan
"""
from __future__ import absolute_import
from __future__ import division
import os
import logging
from itertools import combinations, prod... | fenderglass/ABruijn | flye/trestle/trestle.py | Python | bsd-3-clause | 138,871 |
# Copyright 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Presubmit script for changes affecting tools/perf/.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about th... | Just-D/chromium-1 | tools/perf/PRESUBMIT.py | Python | bsd-3-clause | 4,403 |
#!/usr/bin/env python
# -*- coding: utf-8 -*_
| fuzhouch/amberalertcn | server/amberalertcn/api/__init__.py | Python | bsd-3-clause | 47 |
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.models import NOT_PROVIDED
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_rename_table = "RENAME TABLE %(old_table)s TO %(new_table)s"
sql_alter_column_null = "MODIFY %(column)s %(type)s NULL"
sql_alter_column_... | cyaninc/django-mysql-pymysql | src/mysql_pymysql/schema.py | Python | bsd-3-clause | 2,073 |
#!/usr/bin/env python
###
# Copyright (c) 2002-2007 Systems in Motion
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS I... | bleepbloop/Pivy | examples/Mentor/05.3.TriangleStripSet.py | Python | isc | 4,616 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2015, Rafael Bodill http://github.com/rafi
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
#... | kareemallen/beets | beetsplug/lastimport.py | Python | mit | 6,738 |
from wagtailmenus.utils.version import get_version, get_stable_branch_name
# major.minor.patch.release.number
# release must be one of alpha, beta, rc, or final
VERSION = (3, 1, 0, "alpha", 0)
__version__ = get_version(VERSION)
stable_branch_name = get_stable_branch_name(VERSION)
default_app_config = "wagtailmenus.ap... | rkhleics/wagtailmenus | wagtailmenus/__init__.py | Python | mit | 1,864 |
#!/usr/bin/env python3
# Copyright © 2012-13 Qtrac Ltd. All rights reserved.
# This program or module is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option)... | nwiizo/workspace_2017 | pipng/imagescale-c.py | Python | mit | 4,916 |
import sys
import cStringIO
import OpenSSL
from libpathod import pathod, version
from netlib import tcp, http
from netlib.exceptions import HttpException, TlsException
import tutils
class TestPathod(object):
def test_logging(self):
s = cStringIO.StringIO()
p = pathod.Pathod(("127.0.0.1", 0), log... | Kriechi/pathod | test/test_pathod.py | Python | mit | 7,878 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/clothing/shared_clothing_boots_casual_12.iff"
result.attri... | anhstudios/swganh | data/scripts/templates/object/draft_schematic/clothing/shared_clothing_boots_casual_12.py | Python | mit | 462 |
'''
split a file into two randomly, line by line.
Usage: split.py <input file> <output file 1> <output file 2> [<probability of writing to the first file>]'
'''
import csv
import sys
import random
try:
P = float( sys.argv[4] )
except IndexError:
P = 0.9
print "P = %s" % ( P )
input_file = sys.argv[1]
output_fil... | zygmuntz/kaggle-advertised-salaries | split.py | Python | mit | 825 |
from allauth.socialaccount.providers.base import AuthAction, ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class Scope(object):
ACCESS = 'read-only'
class YNABAccount(ProviderAccount):
pass
class YNABProvider(OAuth2Provider):
id = 'ynab'
name = 'YNAB'
... | lukeburden/django-allauth | allauth/socialaccount/providers/ynab/provider.py | Python | mit | 852 |
#! /usr/bin/env python
import sys
import os
sys.path.insert(0, os.environ["QUEX_PATH"])
from copy import deepcopy
from quex.core_engine.state_machine.core import *
import quex.core_engine.state_machine.nfa_to_dfa as nfa_to_dfa
import quex.core_engine.state_machine.hopcroft_minimization as hopcroft
def do(the_state_... | grit-engine/grit-engine | dependencies/quex-0.34.1/quex/core_engine/state_machine/setup_pre_context.py | Python | mit | 3,013 |
e = .1
mean_list = base.List(self.get_theta(key="treatment"), base.Mean, ["control", "treatment"])
if np.random.binomial(1,e) == 1:
self.action["treatment"] = mean_list.random()
self.action["propensity"] = 0.1*0.5
else:
self.action["treatment"] = mean_list.max()
self.action["propensity"] = (1-e) | Nth-iteration-labs/streamingbandit | app/defaults/E-Greedy/get_action.py | Python | mit | 312 |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 04 13:10:20 2015
@author: bayevskihk
"""
import sys
def main(argv):
number = len(argv)
data_addr = 0
last_addr = 0
if(number != 2):
return
else:
try:
data_addr = int(argv[0])
last_addr = int(argv[1])
... | chebykinn/university | circuitry/lab4/convert.py | Python | mit | 1,703 |
import conv
import tools
from ..api.clss import api
from ..sql.clss import sql
from pandas import DataFrame
import time as tm
class data(object):
def __init__(self):
self.a = api()
self.s = sql()
self.jobs = []
self.trd = DataFrame()
self.prc = DataFrame()
def add_tra... | rosspalmer/bitQuant | bitquant/data/clss.py | Python | mit | 3,127 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
A commandline tool for parsing RDF in different formats and serializing the
resulting graph to a chosen format.
"""
import sys
from optparse import OptionParser
import logging
import rdflib
from rdflib import plugin
from rdflib.store import Store
from rdflib.graph imp... | bhavanaananda/DataStage | test/RDFDatabank/rdfextras/tools/rdfpipe.py | Python | mit | 5,524 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Delete record tests."""
from __future__ import absolute_import, print_function
f... | tiborsimko/invenio-records-rest | tests/test_views_item_delete.py | Python | mit | 2,501 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2017 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the... | alexforencich/python-ivi | ivi/agilent/agilentMSOX92804A.py | Python | mit | 1,692 |
from django.contrib.auth import authenticate, get_user_model
from graphene import AbstractType, relay, Field, String, ObjectType, Union, List
from users.jwt_schema import TokensSuccess
from users.jwt_util import get_jwt_token
from users.schema.definitions import Viewer
class Error(ObjectType):
"""Form Errors
... | ncrmro/reango | server/users/schema/mutations.py | Python | mit | 3,252 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Ship()
result.template = "object/ship/shared_blacksun_medium_s03_tier2.iff"
result.attribute_template_id = -1
re... | anhstudios/swganh | data/scripts/templates/object/ship/shared_blacksun_medium_s03_tier2.py | Python | mit | 422 |
from __future__ import print_function, division
import matplotlib
import logging
from sys import stdout
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import (Net, RealApplianceSource,
BLSTMLayer, DimshuffleLayer,
Bidirectio... | JackKelly/neuralnilm_prototype | scripts/e405.py | Python | mit | 27,430 |
# coding=utf-8
import json
import re
import responses
import pytest
import mapbox
def test_geocoder_default_name():
"""Default name is set"""
geocoder = mapbox.Geocoder()
assert geocoder.name == 'mapbox.places'
def test_geocoder_name():
"""Named dataset name is set"""
geocoder = mapbox.Geocode... | ravik/mapbox-baseSDK | tests/test_geocoder.py | Python | mit | 12,916 |
#!/usr/bin/python
# Copyright (c) 2014 Wladmir J. van der Laan
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the dir... | TheAltcoinBoard/XAB-withoutSecp256k1 | share/seeds/generate-seeds.py | Python | mit | 4,318 |
def saveData(X, f_out, colfmt='%i'):
'''
Quick alias for saving data matricies. If X and f_out are tuples,
this function will save multiple matricies at once.
'''
import numpy as np
if isinstance(X, tuple):
assert(len(X) == len(f_out))
for idx,Z in enumerate(X):
... | mattdelhey/kaggle-galaxy | saveData.py | Python | mit | 440 |
"""Zwave util methods."""
import logging
from . import const
_LOGGER = logging.getLogger(__name__)
def check_node_schema(node, schema):
"""Check if node matches the passed node schema."""
if (const.DISC_NODE_ID in schema and
node.node_id not in schema[const.DISC_NODE_ID]):
_LOGGER.debug(... | miniconfig/home-assistant | homeassistant/components/zwave/util.py | Python | mit | 3,178 |
import glob, csv, re, shutil, mustache, time
import numpy as np
oddsfile = list(sorted(glob.glob('raw/odds*.csv')))[-1]
timestamp = re.search('s(.*?)\.', oddsfile).group(1)
with open(oddsfile) as infile:
reader = csv.reader(infile)
header = reader.next()
teams = [row for row in reader]
fixed = []
for team... | llimllib/champsleagueviz | europa/stats.py | Python | mit | 1,359 |
# -*- coding: utf-8 -*-
""" S3 Profile
@copyright: 2009-2013 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restrict... | sahildua2305/eden | modules/s3/s3profile.py | Python | mit | 20,693 |
import string
from universe import error
from universe.vncdriver import constants
class VNCEvent(object):
pass
def keycode(key):
if key in constants.KEYMAP:
return constants.KEYMAP.get(key)
elif len(key) == 1:
return ord(key)
else:
raise error.Error('Not sure how to translate t... | rht/universe | universe/spaces/vnc_event.py | Python | mit | 2,568 |
import os
import logging
import decimal
import base64
import json
from datetime import datetime
from lib import config, util, util_bitcoin
ASSET_MAX_RETRY = 3
D = decimal.Decimal
def parse_issuance(db, message, cur_block_index, cur_block):
if message['status'] != 'valid':
return
def modify_extended_... | ClearingHouse/clearblockd | lib/components/assets.py | Python | mit | 14,545 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import pytest
@pytest.fixture
def fda_application(conn, organization):
fda_application = {
'id': 'ANDA018659',
'organisation... | arthurSena/processors | tests/fixtures/api/fda_applications.py | Python | mit | 543 |
from redispy import command
import unittest
class TestCommand(unittest.TestCase):
def test_auth(self):
c = command.ConnectionAuth()
assert c.get_id() == 'AUTH'
if __name__ == '__main__':
unittest.main()
| whiteclover/redis-py | t/commandtest.py | Python | mit | 236 |