code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
import logging
from ..analyses import AnalysesHub
from . import Analysis, CFGFast
l = logging.getLogger(name=__name__)
class Vtable:
"""
This contains the addr, size and function addresses of a Vtable
"""
def __init__(self, vaddr, size, func_addrs=None):
self.vaddr = vaddr
... | angr/angr | angr/analyses/vtable.py | Python | bsd-2-clause | 4,142 |
# -*- coding: utf-8 -*-
"""
Custom model managers for finance.
"""
from .entity_manager import FinanceEntityManager
__all__ = (
'FinanceEntityManager',
) | access-missouri/am-django-project | am/finance/models/managers/__init__.py | Python | bsd-2-clause | 159 |
# Copyright edalize contributors
# Licensed under the 2-Clause BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-2-Clause
import os
import logging
from edalize.edatool import Edatool
logger = logging.getLogger(__name__)
class Vcs(Edatool):
_description = """ Synopsys VCS Backend
VCS is one... | SymbiFlow/edalize | edalize/vcs.py | Python | bsd-2-clause | 3,290 |
#encoding:utf-8
from .abstracts import BaseCompanyModel
class Manufacturer(BaseCompanyModel):
pass
| KeoH/django-keoh-kstore | kstore/models/manufacturers.py | Python | bsd-2-clause | 104 |
#!/usr/bin/env python
"""
@package ion.agents.platform.platform_agent_stream_publisher
@file ion/agents/platform/platform_agent_stream_publisher.py
@author Carlos Rueda
@brief Stream publishing support for platform agents.
"""
__author__ = 'Carlos Rueda'
import logging
import uuid
from coverage_model.paramet... | ooici/coi-services | ion/agents/platform/platform_agent_stream_publisher.py | Python | bsd-2-clause | 10,637 |
class PGPAdmin(object):
def get_queryset(self, request):
"""Skip any auto decryption when ORM calls are from the admin."""
return self.model.objects.get_queryset(**{'skip_decrypt': True})
| atdsaa/django-pgcrypto-fields | pgcrypto/admin.py | Python | bsd-2-clause | 209 |
import locale
import os
import subprocess
import sys
class SimpleI18N:
def __init__(self, lang=None):
if lang:
self.lang = lang
else:
self.lang = self.get_os_language()
if not self.lang:
self.lang = "en_US"
def get_os_language(self):
try:
... | zlsun/XX-Net | code/default/launcher/simple_i18n.py | Python | bsd-2-clause | 4,279 |
# Copyright 2014-2016 Morgan Delahaye-Prat. All Rights Reserved.
#
# Licensed under the Simplified BSD License (the "License");
# you may not use this file except in compliance with the License.
"""JSON serializer."""
import json
from datetime import tzinfo, timedelta
class _simple_utc(tzinfo): # pragma: no cover
... | project-hypr/hypr2 | hypr/serializers/json_serializer.py | Python | bsd-2-clause | 1,374 |
"""
structral controllability measure, driver nodes
"""
# Copyright (C) 2014 by
# Xin-Feng Li <silfer.lee@gmail.com>
# All rights reserved
# BSD license
import networkx as nx
import matplotlib.pyplot as plt
__author__ = """Xin-Feng Li (silfer.lee@gmail.com)"""
def get_driver_nodes(DG):
'''Return the dri... | python27/NetworkControllability | NetworkControllability/strutral_controllability.py | Python | bsd-2-clause | 6,085 |
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 27 17:00:01 2014
@author: Wasit
"""
try:
import json
except ImportError:
import simplejson as json
import numpy as np
import base64
def Base64Encode(ndarray):
return json.dumps([str(ndarray.dtype),base64.b64encode(ndarray),ndarray.shape])
def Base64Decode(js... | wasit7/cs634 | 2016/lab6_calibration/jsonPorter.py | Python | bsd-2-clause | 728 |
# -*- coding: utf-8 -*-
from requests import post, get, put, delete
class Api:
def __init__(self, base_url, user_token, app_token):
self.base_url = base_url
self.app_token = app_token
self.user_token = user_token
def initSession(self):
target_url = 'initSession/'
sess... | marcelogomess/glpi_api | glpi_api/api.py | Python | bsd-2-clause | 6,202 |
"""
Tests of disco_elastigroup
"""
import random
from unittest import TestCase
from parameterized import parameterized
from mock import MagicMock, ANY, patch
from disco_aws_automation import DiscoElastigroup
ENVIRONMENT_NAME = "moon"
class DiscoElastigroupTests(TestCase):
"""Test DiscoElastigroup class"""
... | amplifylitco/asiaq | tests/unit/test_disco_elastigroup.py | Python | bsd-2-clause | 22,367 |
"""Provide the RisingListingMixin class."""
from urllib.parse import urljoin
from ...base import PRAWBase
from ..generator import ListingGenerator
class RisingListingMixin(PRAWBase):
"""Mixes in the rising methods."""
def random_rising(self, **generator_kwargs):
"""Return a ListingGenerator for rand... | leviroth/praw | praw/models/listing/mixins/rising.py | Python | bsd-2-clause | 961 |
# -*- coding: utf-8 -*-
from decimal import Decimal
from be2bill_sdk import Be2BillForm
from cartridge_external_payment.providers.base import PaymentProvider
class Be2BillProvider(PaymentProvider):
def get_start_payment_form(self, request, order):
total = Decimal(order.total * 100).quantize(Decima... | thomasWajs/cartridge-external-payment | cartridge_external_payment/providers/be2bill.py | Python | bsd-2-clause | 1,363 |
import time
import datetime
from MyPy.core.exceptions import (
Warning, Error, InterfaceError, DatabaseError, DataError, OperationalError,
IntegrityError, InternalError, ProgrammingError, NotSupportedError
)
from MyPy.constants import fieldtypes
apilevel = '2.0'
threadsafety = 1
paramstyle = 'format'
def Co... | nasi/MyPy | MyPy/__init__.py | Python | bsd-3-clause | 2,276 |
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext_noop, ugettext as _
from corehq.apps.domain.decorators import login_required
from corehq.apps.h... | qedsoftware/commcare-hq | corehq/apps/styleguide/examples/controls_demo/views.py | Python | bsd-3-clause | 2,630 |
# Copyright 2014 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.
from common.chrome_proxy_benchmark import ChromeProxyBenchmark
from integration_tests import chrome_proxy_measurements as measurements
from integration_tests... | SaschaMester/delicium | tools/chrome_proxy/integration_tests/chrome_proxy_benchmark.py | Python | bsd-3-clause | 6,825 |
# -*- coding: utf-8 -*-
import unittest
from hamlish_jinja import Hamlish, Output
import testing_base
class TestDebugOutput(testing_base.TestCase):
def setUp(self):
self.hamlish = Hamlish(
Output(indent_string=' ', newline_string='\n', debug=True))
def test_html_tags(self):
... | Pitmairen/hamlish-jinja | tests/test_debug_output.py | Python | bsd-3-clause | 3,732 |
from measuring_stations.models import MeasuringPoint
import pytest
def test_active_values():
mp = MeasuringPoint(so2=True, o3=True)
assert mp.get_active_values() == ('so2', 'o3')
@pytest.fixture
def csv():
return "Datum Zeit; Leipzig-Mitte SO2\n" \
"; <B5>g/m<B3>\n" \
"01-07-14 11:... | CodeforLeipzig/luftqualitaet_sachsen | luftqualitaet_sachsen/tests/test_measuring_stations/test_models.py | Python | bsd-3-clause | 655 |
# -*- coding: utf-8 -*-
import os
import urllib.parse as urlparse
from unittest.mock import patch
from oauthlib import signals
from oauthlib.oauth2 import LegacyApplicationClient
from tests.unittest import TestCase
@patch('time.time', new=lambda: 1000)
class LegacyApplicationClientTest(TestCase):
client_id = "... | idan/oauthlib | tests/oauth2/rfc6749/clients/test_legacy_application.py | Python | bsd-3-clause | 6,427 |
# -*- coding: utf-8 -*-
#
# Zend Framework 2 documentation build configuration file, created by
# sphinx-quickstart on Fri Jul 6 18:55:07 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... | froschdesign/zf2-documentation | docs/src/conf.py | Python | bsd-3-clause | 8,058 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import pytest
from cryptography.hazmat.backends import _available_backen... | Ayrx/cryptography | tests/conftest.py | Python | bsd-3-clause | 1,721 |
# -*- coding: utf-8 -*-
from scout.commands import cli
from scout.server.extensions import store
def test_update_institute(mock_app):
"""Tests the CLI that updates an institute"""
runner = mock_app.test_cli_runner()
assert runner
# Test CLI base, no arguments provided
result = runner.invoke(cli... | Clinical-Genomics/scout | tests/commands/update/test_update_institute_cmd.py | Python | bsd-3-clause | 2,917 |
import uuid
import marshmallow_jsonapi
import pytest
from marshmallow_jsonapi import fields
import flask_jsonapi
from flask_jsonapi import filters_schema
class TestFiltersSchemaCreation:
def test_simple(self):
class ExampleFiltersSchema(filters_schema.FilterSchema):
title = filters_schema.Li... | maruqu/flask-jsonapi | tests/test_filters_schema.py | Python | bsd-3-clause | 8,296 |
"""
Django settings for example_project project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Bu... | pydanny/dj-paginator | example_project/example_project/settings.py | Python | bsd-3-clause | 2,669 |
import threading
from copy import deepcopy
from functools import reduce
from requests import exceptions
from remix import utils
class RaiseForStatusMixin(object):
def process_request(self, *args, **kwargs):
response = super(RaiseForStatusMixin, self).process_request(*args, **kwargs)
response.rai... | jsurloppe/remix | remix/mixins/request.py | Python | bsd-3-clause | 4,591 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
from .factory import get_api_sync_engine, get_consumer_sync_engine
from .models import APIReference, ConsumerReference, PluginConfigurationReference
def synchronize_apis(client, queryset=None):
return get_api_sync_engine().synchroniz... | peterayeni/django-kong-admin | kong_admin/logic.py | Python | bsd-3-clause | 1,977 |
# -*- coding: utf-8 -*-
import hashlib
import json
import os
import tempfile
import zipfile
from datetime import datetime
from django import forms
from django.core.files.storage import default_storage as storage
from django.conf import settings
from django.test.utils import override_settings
import mock
import pytest... | tsl143/addons-server | src/olympia/files/tests/test_models.py | Python | bsd-3-clause | 56,292 |
"""
This module contains functions for auto feature generation.
"""
import logging
import pandas as pd
import six
from py_entitymatching.utils.validation_helper import validate_object_type
from IPython.display import display
import py_entitymatching as em
import py_entitymatching.feature.attributeutils as au
import ... | anhaidgroup/py_entitymatching | py_entitymatching/feature/autofeaturegen.py | Python | bsd-3-clause | 34,022 |
"""empty message
Revision ID: 247c9e7de059
Revises: None
Create Date: 2015-12-02 15:03:20.582541
"""
# revision identifiers, used by Alembic.
revision = '247c9e7de059'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###... | hellwen/mytrade | migrations/versions/247c9e7de059_.py | Python | bsd-3-clause | 4,058 |
from __future__ import division
from sympy import (Add, Basic, S, Symbol, Wild, Float, Integer, Rational, I,
sin, cos, tan, exp, log, nan, oo, sqrt, symbols, Integral, sympify,
WildFunction, Poly, Function, Derivative, Number, pi, NumberSymbol, zoo,
Piecewise, Mul, Pow, nsimplify, ratsimp, trigsimp, radsim... | ojengwa/sympy | sympy/core/tests/test_expr.py | Python | bsd-3-clause | 54,290 |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... | enthought/traitsgui | enthought/pyface/preference/preference_node.py | Python | bsd-3-clause | 2,478 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from django.forms.models import (
inlineformset_factory,
ModelForm, ModelFormMetaclass,
)
from django.utils import six
class InlineModelFormMetaclass(ModelFormMetaclass):
def __new__(cls, name, bases, attrs):
options = attrs.get('Me... | samuelmaudo/yepes | yepes/forms/inline_model.py | Python | bsd-3-clause | 2,021 |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 1.3.40
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path import d... | silkyar/570_Big_Little | build/ARM/python/m5/internal/param_BaseSimpleCPU.py | Python | bsd-3-clause | 3,817 |
import os, sys; sys.path.insert(0, os.path.join("..", ".."))
from pattern.web import Flickr, extension
from pattern.web import RELEVANCY, LATEST, INTERESTING # Image sort order.
from pattern.web import SMALL, MEDIUM, LARGE # Image size.
# This example downloads an image from Flickr (http://flickr.com).
# Ac... | piskvorky/pattern | examples/01-web/05-flickr.py | Python | bsd-3-clause | 1,357 |
# -*- coding: utf-8 -*-
"""
***
Labelling is B I O St Sm Sb
Singletons are split into:
- St : a singleton on "top" of its cell, vertically
- Sm : a singleton in "middle" of its cell, vertically
- Sb : a singleton in "bottom" of its cell, vertically
Copyright Naver Labs Eu... | Transkribus/TranskribusDU | TranskribusDU/tasks/TablePrototypes/DU_ABPTableSkewed_txtBIOStmb_sepSIO_line.py | Python | bsd-3-clause | 8,251 |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
from mixbox import entities
from mixbox import fields
import cybox.bindings.dns_cache_object as dns_cache_binding
from cybox.common import ObjectProperties, PositiveInteger
from cybox.objects.dns_record_object impo... | CybOXProject/python-cybox | cybox/objects/dns_cache_object.py | Python | bsd-3-clause | 990 |
# Copyright (c) 2015-2019, Activision Publishing, 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 copyright notice, this
# list of ... | ActivisionGameScience/assertpy | tests/test_same_as.py | Python | bsd-3-clause | 2,899 |
import sys
from contextlib import contextmanager
from StringIO import StringIO
@contextmanager
def string_stdout():
output = StringIO()
sys.stdout = output
yield output
sys.stdout = sys.__stdout__
| jklaiho/django-class-fixtures | class_fixtures/utils/__init__.py | Python | bsd-3-clause | 214 |
"""
Tests for search API functions.
"""
import itertools
from unittest.mock import patch
from ddt import (
data,
ddt,
unpack,
)
from django.conf import settings
from django.db.models.signals import post_save
from elasticsearch.exceptions import NotFoundError
from factory.django import mute_signals
from da... | mitodl/micromasters | search/indexing_api_test.py | Python | bsd-3-clause | 42,482 |
# BSD 3-Clause License
#
# Copyright (c) 2012, the Sentry Team, see AUTHORS for more details
# Copyright (c) 2019, Elasticsearch BV
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Red... | beniwohli/apm-agent-python | elasticapm/contrib/django/middleware/wsgi.py | Python | bsd-3-clause | 2,302 |
from stream_framework.activity import Activity
from stream_framework.exceptions import SerializationException
from stream_framework.serializers.activity_serializer import ActivitySerializer
from stream_framework.serializers.utils import check_reserved
from stream_framework.utils import epoch_to_datetime, datetime_to_ep... | izhan/Stream-Framework | stream_framework/serializers/aggregated_activity_serializer.py | Python | bsd-3-clause | 4,616 |
# Copyright (c) 2014, Salesforce.com, 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... | priorknowledge/loom | loom/format.py | Python | bsd-3-clause | 18,525 |
from spectrum import *
from numpy.testing import assert_almost_equal
import pytest
def test_class_Window():
w = Window(65, name='hann')
w.enbw
w.mean_square
w.frequencies
w.plot_time_freq()
w.compute_response(NFFT=32)
try:
w = Window(64, name='wrong')
assert False
ex... | cokelaer/spectrum | test/test_window.py | Python | bsd-3-clause | 9,764 |
"""Defines the unit tests for the :mod:`colour.utilities.data_structures` module."""
import numpy as np
import operator
import pickle
import unittest
from colour.utilities import (
Structure,
Lookup,
CaseInsensitiveMapping,
LazyCaseInsensitiveMapping,
Node,
)
__author__ = "Colour Developers"
__co... | colour-science/colour | colour/utilities/tests/test_data_structures.py | Python | bsd-3-clause | 17,079 |
"""Compute coefficients for polynomial smoothers
"""
import numpy
__docformat__ = "restructuredtext en"
__all__ = ['chebyshev_polynomial_coefficients']
def chebyshev_polynomial_coefficients(a, b, degree):
"""Chebyshev polynomial coefficients for the interval [a,b]
Parameters
----------
a,b : float
... | pombreda/pyamg | pyamg/relaxation/chebyshev.py | Python | bsd-3-clause | 4,258 |
from pylearn2.models.mlp import MLP
class Autoencoder(MLP):
"""
An MLP whose output domain is the same as its input domain.
"""
def get_target_source(self):
return 'features'
| CKehl/pylearn2 | pylearn2/scripts/tutorials/convolutional_network/autoencoder.py | Python | bsd-3-clause | 201 |
import json
import pickle
from django.core import exceptions, serializers
from django.db import IntegrityError
from django.test import TestCase
from django.utils import timezone
from django_cryptography.fields import PickledField
from .models import PickledModel, NullablePickledModel
class TestSaveLoad(TestCase):
... | georgemarshall/django-cryptography | tests/fields/test_pickle.py | Python | bsd-3-clause | 3,763 |
# Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, 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 copyright notice,
# this list... | gaberger/pybvc | pybvc/openflowdev/ofswitch.py | Python | bsd-3-clause | 118,713 |
#!/usr/bin/env python3
import os
import sys
src_dir = os.path.abspath('src/')
sys.path.append(src_dir)
sys.ps1 = ''
sys.ps2 = ''
import id003
import termutils as t
import time
import logging
import configparser
import threading
import serial.tools.list_ports
from serial.serialutil import SerialException
from colle... | Kopachris/py-id003 | protocol_analyzer.py | Python | bsd-3-clause | 17,902 |
#!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 2009-2015 California Institute of Technology.
# License: 3-clause BSD. The full license text is available at:
# - http://trac.mystic.cacr.caltech.edu/project/mystic/browser/mystic/LICENSE
DEBUG = False
##############... | jcfr/mystic | examples_UQ/TEST_surrogate_cut.py | Python | bsd-3-clause | 9,913 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 7, transform = "Anscombe", sigma = 0.0, exog_count = 100, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_Lag1Trend/cycle_7/ar_/test_artificial_32_Anscombe_Lag1Trend_7__100.py | Python | bsd-3-clause | 263 |
import logging
import os
import re
import sys
from collections import Counter
import simplejson
from django.conf import settings
from memoized import memoized
from corehq.apps.domain.dbaccessors import iter_all_domains_and_deleted_domains_with_name
from corehq.apps.domain.extension_points import custom_domain_module... | dimagi/commcare-hq | corehq/apps/domain/utils.py | Python | bsd-3-clause | 3,824 |
def extractMajimeHomeBlog(item):
'''
Parser for 'majime.home.blog'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loitero... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractMajimeHomeBlog.py | Python | bsd-3-clause | 1,139 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility for checking and processing licensing information in third_party
directories.
Usage: licenses.py <command>
Commands:
... | mogoweb/chromium-crosswalk | tools/licenses.py | Python | bsd-3-clause | 16,956 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from sentry.utils.db import is_postgres
class Migration(SchemaMigration):
# Flag to indicate if this migration is too risky
# to run online and... | mvaled/sentry | src/sentry/south_migrations/0391_auto__add_fileblobowner__add_unique_fileblobowner_blob_organization__a.py | Python | bsd-3-clause | 99,198 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2015, MuChu Hsu
Contributed by Muchu Hsu (muchu1983@gmail.com)
This file is part of BSD license
<https://opensource.org/licenses/BSD-3-Clause>
"""
import unittest
import logging
import json
from cameo.parserForINSIDE import ParserForINSIDE
"""
測試 解析 硬塞的 頁面
"""
class ParserForI... | muchu1983/104_cameo | test/unit/test_parserForINSIDE.py | Python | bsd-3-clause | 1,532 |
"""
The :mod:`sklearn.metrics.scorer` submodule implements a flexible
interface for model selection and evaluation using
arbitrary score functions.
A scorer object is a callable that can be passed to
:class:`sklearn.grid_search.GridSearchCV` or
:func:`sklearn.cross_validation.cross_val_score` as the ``scoring`` parame... | Tong-Chen/scikit-learn | sklearn/metrics/scorer.py | Python | bsd-3-clause | 10,407 |
from django.conf.urls.defaults import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^render/(?P<photo_id>\d+)/$', 'render.views.raw'),
url(r'^render/(?P<photo_id>\d+)/thumbnail/$', 'render.views... | trickv/fspot_browser | urls.py | Python | bsd-3-clause | 1,469 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from .context import tripp
from tripp import logistic_regression
from tripp import munge
from tripp import gradient
from tripp import ml
from tripp import algebra
import random
import logging
logging.basicConfig(level=logging.ERROR, format="%(lineno)d\t%(... | mjamesruggiero/tripp | tests/test_logistic_regression.py | Python | bsd-3-clause | 6,511 |
from django.conf.urls import *
from django.contrib.auth import views as auth_views
from businesstest.views import Messages
urlpatterns = patterns("businesstest.views",
# (r"messages/$", "message_list"),
(r"messages/$", Messages.as_view(), {}, "messages"),
(r"(\d+)/$", "test"),
(r"test_done/$", "test_do... | pythonbyexample/PBE | dbe/businesstest/urls.py | Python | bsd-3-clause | 619 |
def extractMkkbunkotoikemenWordpressCom(item):
'''
Parser for 'mkkbunkotoikemen.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_extractMkkbunkotoikemenWordpressCom.py | Python | bsd-3-clause | 565 |
"""
Run integration tests from pixsim through redshifts
python -m desispec.test.integration_test
"""
from __future__ import absolute_import, print_function
import sys
import os
import random
import time
import subprocess as sp
import glob
import shutil
import numpy as np
from astropy.io import fits
try:
from sci... | desihub/desispec | py/desispec/test/integration_test.py | Python | bsd-3-clause | 11,516 |
import mock
import os
from xml.etree import ElementTree
from corehq.util.test_utils import flag_enabled
from datetime import datetime, timedelta
from django.test import TestCase
from casexml.apps.phone.models import SyncLog
from casexml.apps.phone.tests.utils import create_restore_user
from corehq.apps.domain.shortcu... | qedsoftware/commcare-hq | corehq/apps/locations/tests/test_location_fixtures.py | Python | bsd-3-clause | 14,654 |
"""
EventHandler handles all events. The handler sets on every object.
"""
import random
from muddery.utils import defines
from muddery.statements.statement_handler import STATEMENT_HANDLER
from muddery.utils import utils
from muddery.worlddata.data_sets import DATA_SETS
from django.conf import settings
from django.ap... | MarsZone/DreamLand | muddery/utils/event_handler.py | Python | bsd-3-clause | 7,071 |
'''Execution data structure.'''
__copyright__ = "Copyright (c) 2008 Kevin J Bluck"
__version__ = "$Id$"
class Execution(object):
'''Data structure to describe a trade execution.
'''
def __init__(self, order_id=0, client_id=0, exec_id="", time="", acct_number="", exchange="", side="",
... | kbluck/pytws | tws/_Execution.py | Python | bsd-3-clause | 1,064 |
# coding: utf-8
# Examples for NOT class
# In[1]:
# imports
from __future__ import print_function
from BinPy.Gates import *
# In[2]:
# Initializing the NOT class
gate = NOT(0)
# Output of the NOT gate
print (gate.output())
# In[3]:
# Input is changed to 0
gate.setInput(1)
# To get the input states
print... | MridulS/BinPy | BinPy/examples/source/Gates/NOT.py | Python | bsd-3-clause | 731 |
#! /usr/bin/python
import serial, time
import subprocess
from subprocess import call, Popen
from argparse import ArgumentParser
import re
def do_test(port, baudrate, test_name):
databits = serial.EIGHTBITS
stopbits = serial.STOPBITS_ONE
parity = serial.PARITY_NONE
ser = serial.Serial(port, baudrate, d... | dagar/Firmware | Tools/HIL/run_tests.py | Python | bsd-3-clause | 3,547 |
#!/usr/bin/env python
import asyncio
import os
import signal
import websockets
async def echo(websocket):
async for message in websocket:
await websocket.send(message)
async def main():
# Set the stop condition when receiving SIGTERM.
loop = asyncio.get_running_loop()
stop = loop.create_fu... | aaugustin/websockets | example/deployment/haproxy/app.py | Python | bsd-3-clause | 616 |
plugin_class = "shipmaster.plugins.ssh.ssh.SSHPlugin"
| damoti/shipmaster | shipmaster/plugins/ssh/__init__.py | Python | bsd-3-clause | 54 |
#!/usr/bin/env python
import sys
def setup_python3():
# Taken from "distribute" setup.py
from distutils.filelist import FileList
from distutils import dir_util, file_util, util, log
from os.path import join, exists
tmp_src = join("build", "src")
# Not covered by "setup.py clean --all", so exp... | machinalis/refo | setup.py | Python | bsd-3-clause | 2,459 |
#!/usr/bin/python
from mininet.topo import Topo, Node
class CampusTopo( Topo ):
"A simple example of a small campus network."
def __init__(self, enable_all = True):
" Create a campus topology."
super( CampusTopo, self).__init__()
# Add switches and hosts.
switches = [1, 2, 3]... | frenetic-lang/netcore-1.0 | examples/Campus.py | Python | bsd-3-clause | 1,239 |
#!/usr/bin/env python
######################################################################
# Software License Agreement (BSD License)
#
# Copyright (c) 2010, Rice University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that t... | utiasASRL/batch-informed-trees | tests/control/test_control.py | Python | bsd-3-clause | 11,947 |
# A revised version of CPython's turtle module written for Brython
#
# Note: This version is not intended to be used in interactive mode,
# nor use help() to look up methods/functions definitions. The docstrings
# have thus been shortened considerably as compared with the CPython's version.
#
# All public methods/func... | brython-dev/brython | www/src/Lib/turtle.py | Python | bsd-3-clause | 51,962 |
import numpy as np
import xsimlab as xs
@xs.process
class AdvectionLax1D:
"""Wrap 1-dimensional advection in a single Process."""
spacing = xs.variable(description="grid spacing", static=True)
length = xs.variable(description="grid total length", static=True)
x = xs.variable(dims="x", intent="out")
... | benbovy/xarray-simlab | doc/scripts/advection_model.py | Python | bsd-3-clause | 5,038 |
"""
Unit tests for the `HasTraits.class_traits` class function.
"""
from __future__ import absolute_import
from traits import _py2to3
from traits.testing.unittest_tools import unittest
from ..api import HasTraits, Int, List, Str
class A(HasTraits):
x = Int
name = Str(marked=True)
class B(A):
pas... | burnpanck/traits | traits/tests/test_class_traits.py | Python | bsd-3-clause | 1,363 |
#
# NuGridpy - Tools for accessing and visualising NuGrid data.
#
# Copyright 2007 - 2014 by the NuGrid Team.
# All rights reserved. See LICENSE.
#
'''
nugridse is a collection of plots of data in se-type h5 files.
Usage
=====
start by loading the module,
>>> import nugridse as mp
you can get help,
>>> help mp
n... | NuGrid/NuGridPy | nugridpy/nugridse.py | Python | bsd-3-clause | 162,720 |
###############################################################################
## File : b64decode.py
## Description: Base64 decode a supplied list of strings
## :
## Created_On : Wed Sep 26 12:33:16 2012
## Created_By : Rich Smith (rich@kyr.us)
## Modified_On: Tue Jan 29 16:42:41 2013
## Modi... | kyrus/PyMyo | modules/b64decode/command.py | Python | bsd-3-clause | 886 |
import re
import numpy as np
import pytest
from pandas.core.dtypes.common import is_categorical_dtype
import pandas as pd
from pandas import (
Categorical,
CategoricalIndex,
DataFrame,
Index,
Interval,
Series,
Timedelta,
Timestamp,
)
import pandas._testing as tm
from pandas.api.types ... | gfyoung/pandas | pandas/tests/indexing/test_categorical.py | Python | bsd-3-clause | 19,173 |
"""
Test diapason notes.
"""
import pytest
from pytest import approx
from diapason import note_frequency
@pytest.mark.parametrize(('note', 'sharp', 'flat', 'octave', 'frequency'), [
# Exact frequencies (A)
('A', 0, 0, 4, 440.),
('A', 0, 0, 0, 27.5),
('A', 0, 0, 6, 1760.),
# Different notes in the... | Soundphy/diapason | diapason/tests/test_notes.py | Python | bsd-3-clause | 2,727 |
import os
import gettext as gettext_module
from django import http
from django.conf import settings
from django.utils import importlib
from django.utils.translation import check_for_language, activate, to_locale, get_language
from django.utils.text import javascript_quote
from django.utils.encoding import smart_unicod... | vsajip/django | django/views/i18n.py | Python | bsd-3-clause | 9,782 |
def extractFeelinthedarkWordpressCom(item):
'''
Parser for 'feelinthedark.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_extractFeelinthedarkWordpressCom.py | Python | bsd-3-clause | 566 |
from setuptools import setup
setup(
name = "zml",
packages = ["zml"],
version = "0.8.1",
description = "zero markup language",
author = "Christof Hagedorn",
author_email = "team@zml.org",
url = "http://www.zml.org/",
download_url = "https://pypi.python.org/pypi/zml",
keywords = ["zml... | babadoo/zml | setup.py | Python | bsd-3-clause | 1,343 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | antgonza/qp-shotgun | qp_shogun/sortmerna/sortmerna.py | Python | bsd-3-clause | 6,980 |
# -*- coding: utf-8 -*-
#
# Name: Yubico Python Client
# Description: Python class for verifying Yubico One Time Passwords (OTPs).
#
# Author: Tomaž Muraus (http://www.tomaz-muraus.info)
# License: BSD
#
# Requirements:
# - Python >= 2.5
import re
import os
import sys
import time
import socket
import urllib
import url... | meddius/yubisaslauthd | yubico/yubico.py | Python | bsd-3-clause | 11,064 |
# coding=utf-8
from django import forms
from django.core.exceptions import ValidationError
from . import Manager
from models import (
FriendRequest,
SocialGroup,
GroupComment,
GroupMembershipRequest,
GroupImage,
FeedComment,
GroupSharedLink)
class FriendRequestForm(forms.ModelForm):
... | dgvicente/django-social-network | social_network/forms.py | Python | bsd-3-clause | 2,353 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... | wheeler-microfluidics/dmf_control_board_plugin | _version.py | Python | bsd-3-clause | 18,441 |
# -*- coding: utf-8 -*-
from django import forms
from django.core.exceptions import ImproperlyConfigured
from django.db.models import fields
from modeltranslation import settings as mt_settings
from modeltranslation.utils import (
get_language, build_localized_fieldname, build_localized_verbose_name, resolution_or... | yaroslavprogrammer/django-modeltranslation | modeltranslation/fields.py | Python | bsd-3-clause | 15,602 |
import qimage2ndarray, os, numpy, tempfile
from nose.tools import assert_equal
from test_imread import all_test_images, _locate_test_image
def test_imsave():
fh, tempFilename = tempfile.mkstemp('.png')
os.close(fh)
try:
for filename in all_test_images:
filename = _locate_test_image(fil... | pbvarga1/qimage2ndarray | test/test_imsave.py | Python | bsd-3-clause | 630 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013-2014, Martín Gaitán
# Copyright (c) 2012-2013, Alexander Jung-Loddenkemper
# This file is part of Waliki (http://waliki.nqnwebs.com/)
# License: BSD (https://github.com/mgaitan/waliki/blob/master/LICENSE)
#=============================================... | mgaitan/waliki_flask | waliki/extensions/Git.py | Python | bsd-3-clause | 8,645 |
"""
The config module holds package-wide configurables and provides
a uniform API for working with them.
Overview
========
This module supports the following requirements:
- options are referenced using keys in dot.notation, e.g. "x.y.option - z".
- keys are case-insensitive.
- functions should accept partial/regex k... | zfrenchee/pandas | pandas/core/config.py | Python | bsd-3-clause | 23,232 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime, date
from dateutil.relativedelta import relativedelta
try:
from django.contrib.sites.shortcuts import get_current_site
except ImportError:
# Django 1.6
from django.contrib.sites.models import get_current_site
f... | czpython/aldryn-newsblog | aldryn_newsblog/views.py | Python | bsd-3-clause | 13,366 |
# stdlib
from collections import namedtuple
import socket
import subprocess
import time
import urlparse
# 3p
import requests
# project
from checks import AgentCheck
from config import _is_affirmative
from util import headers, Platform
class NodeNotFound(Exception): pass
ESInstanceConfig = namedtuple(
'ESInsta... | JohnLZeller/dd-agent | checks.d/elastic.py | Python | bsd-3-clause | 23,162 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name="hurricane",
version="0.1",
description="Hurricane is a project for easily creating Comet web applications",
classifiers=[
"Programming Language :: Python",
"Topic :: Software Development :: Libraries :: Pytho... | ericflo/hurricane | setup.py | Python | bsd-3-clause | 766 |
"""
There are two types of functions:
1) defined function like exp or sin that has a name and body
(in the sense that function can be evaluated).
e = exp
2) undefined function with a name but no body. Undefined
functions can be defined using a Function class as follows:
f = Function('f')
(the result will... | gnulinooks/sympy | sympy/core/function.py | Python | bsd-3-clause | 23,521 |
# -*- coding: utf-8 -*-
"""
logbook
~~~~~~~
Simple logging library that aims to support desktop, command line
and web applications alike.
:copyright: (c) 2010 by Armin Ronacher, Georg Brandl.
:license: BSD, see LICENSE for more details.
"""
import os
from logbook.base import LogRecord, Logger... | agustinhenze/logbook.debian | logbook/__init__.py | Python | bsd-3-clause | 1,683 |
"""
Test that we work properly with classes with the trivial_abi attribute
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestTrivialABI(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE = Tru... | endlessm/chromium-browser | third_party/llvm/lldb/test/API/lang/cpp/trivial_abi/TestTrivialABI.py | Python | bsd-3-clause | 2,923 |
from autoprotocol.unit import Unit
def dna_mass_to_mole(length, mass, ds=True):
"""
For the DNA Length and mass given, return the mole amount of DNA
Example Usage:
.. code-block:: python
from autoprotocol_utilities import dna_mass_to_mole
from autoprotocol.unit import Unit
... | autoprotocol/autoprotocol-utilities | autoprotocol_utilities/bio_calculators.py | Python | bsd-3-clause | 16,561 |
# 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 'Repository.last_commit_date'
db.add_column('repositories_repository', 'last_commit_date', ... | stephrdev/brigitte | brigitte/repositories/migrations/0012_auto__add_field_repository_last_commit_date.py | Python | bsd-3-clause | 5,432 |
# -*- coding: utf-8 -*-
#
# Scikit-Criteria documentation build configuration file, created by
# sphinx-quickstart on Thu Aug 3 02:18:36 2017.
#
# 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 fil... | leliel12/scikit-criteria | doc/source/conf.py | Python | bsd-3-clause | 6,770 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.