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 2016 Google Inc. All Rights Reserved.
#
# This script is used to help the compiler wrapper in the Android build system
# bisect for bad object files.
"""Utilities for bisection of Android object files.
This module contains a set of utilities to allow bisection between
two sets (good and bad) of object file... | javilonas/NCam | cross/android-toolchain/bin/bisect_driver.py | Python | gpl-3.0 | 10,450 |
"""Store ImapUid<msg_uid as BigInteger instead of Integer
Revision ID: 519e462df171
Revises: 4fd291c6940c
Create Date: 2014-04-25 00:54:05.728375
"""
# revision identifiers, used by Alembic.
revision = '519e462df171'
down_revision = '4fd291c6940c'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.diale... | nylas/sync-engine | migrations/versions/022_store_imapuid_msg_uid_as_biginteger_.py | Python | agpl-3.0 | 495 |
# pylint: disable=missing-docstring,no-member
import uuid
from django.http import HttpRequest
from django.template import VariableDoesNotExist
from django.test import override_settings
from mock import patch
from edx_ace import Message, Recipient
from openedx.core.djangoapps.ace_common.templatetags.ace import (
e... | BehavioralInsightsTeam/edx-platform | openedx/core/djangoapps/ace_common/tests/test_templatetags.py | Python | agpl-3.0 | 6,291 |
"""Auto-generated file, do not edit by hand. 62 metadata"""
from ..phonemetadata import NumberFormat
PHONE_ALT_FORMAT_62 = [NumberFormat(pattern='(\\d{2})(\\d{3,4})(\\d{4})', format='\\1 \\2', leading_digits_pattern=['2[124]|[36]1'])]
| roubert/python-phonenumbers | python/phonenumbers/data/alt_format_62.py | Python | apache-2.0 | 236 |
from openshift_checks.docker_image_availability import DockerImageAvailability
try:
# python3, mock is built in.
from unittest.mock import patch
except ImportError:
# In python2, mock is installed via pip.
from mock import patch
def test_is_available_skopeo_image():
result = {'rc': 0}
# test ... | tagliateller/openshift-ansible | roles/openshift_health_checker/test/docker_image_availability_test.py | Python | apache-2.0 | 2,165 |
# Test the windows specific win32reg module.
# Only win32reg functions not hit here: FlushKey, LoadKey and SaveKey
import os, sys, errno
import unittest
from test import support
threading = support.import_module("threading")
from platform import machine
# Do this first so test will be skipped if module doesn't exist
... | PennartLoettring/Poettrix | rootfs/usr/lib/python3.4/test/test_winreg.py | Python | gpl-2.0 | 20,406 |
import logging
__author__ = 'peter.amstutz@curoverse.com'
_logger = logging.getLogger("salad")
_logger.addHandler(logging.StreamHandler())
_logger.setLevel(logging.INFO)
| ohsu-computational-biology/common-workflow-language | draft-3/salad/schema_salad/__init__.py | Python | apache-2.0 | 172 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | ghchinoy/tensorflow | tensorflow/python/kernel_tests/sparse_conditional_accumulator_test.py | Python | apache-2.0 | 27,276 |
#!/usr/bin/env python
#
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and t... | zhuyongyong/crosswalk-test-suite | apptools/apptools-android-tests/apptools/manifest_versionCode.py | Python | bsd-3-clause | 3,242 |
import wx
import sys
import os
import time
import threading
import math
PPRZ_HOME = os.getenv("PAPARAZZI_HOME")
sys.path.append(PPRZ_HOME + "/sw/lib/python")
import messages_tool
WIDTH = 450
LABEL_WIDTH = 166
DATA_WIDTH = 100
HEIGHT = 800
BORDER = 1
class MessagesFrame(wx.Frame):
def message_recv(self, ac_id, ... | arbuzarbuz/paparazzi | sw/ground_segment/python/messages_app/messagesframe.py | Python | gpl-2.0 | 5,004 |
# Copyright 2013 OpenStack Foundation
#
# 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 a... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/api/openstack/compute/plugins/v3/extended_volumes.py | Python | gpl-2.0 | 10,085 |
#!/usr/bin/python
# (c) 2019, NetApp, Inc
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | resmo/ansible | lib/ansible/modules/storage/netapp/na_ontap_volume_autosize.py | Python | gpl-3.0 | 15,817 |
import gc
import unittest
import mozharness.base.log as log
from mozharness.base.log import ERROR
import mozharness.base.script as script
from mozharness.mozilla.buildbot import BuildbotMixin, TBPL_SUCCESS, \
TBPL_FAILURE, EXIT_STATUS_DICT
class CleanupObj(script.ScriptMixin, log.LogMixin):
def __init__(sel... | Yukarumya/Yukarum-Redfoxes | testing/mozharness/test/test_mozilla_buildbot.py | Python | mpl-2.0 | 1,980 |
"""
API for submitting background tasks by an instructor for a course.
Also includes methods for getting information about tasks that have
already been submitted, filtered either by running state or input
arguments.
"""
from celery.states import READY_STATES
from xmodule.modulestore.django import modulestore
from ... | PepperPD/edx-pepper-platform | lms/djangoapps/instructor_task/api.py | Python | agpl-3.0 | 7,506 |
#!/bin/env python
import os, sys, traceback
def _genAll(verbose=1):
from reportlab.lib.testutils import setOutDir
setOutDir(__name__)
from reportlab.lib.testutils import testsFolder
topDir=os.path.dirname(testsFolder)
L = [os.path.join(topDir,f) for f in (
#'docs/reference/genreference.p... | malexandre/python-xhtml2pdf-demo | reportlab/docs/genAll.py | Python | mit | 1,497 |
#!/usr/bin/env python3
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgp... | nuclear-wizard/moose | python/peacock/tests/utils/test_TerminalUtils.py | Python | lgpl-2.1 | 1,233 |
import urllib
from flask import url_for, current_app
class DebugToolbar(object):
# default config settings
config = {
'DEBUG_TB_INTERCEPT_REDIRECTS': True,
'DEBUG_TB_PANELS': (
'flask_debugtoolbar.panels.versions.VersionDebugPanel',
'flask_debugtoolbar.panels.timer.T... | dcifuen/cloudbday | src/lib/flask_debugtoolbar/toolbar.py | Python | mit | 2,444 |
import pytest
from thefuck.rules.git_push_force import match, get_new_command
from tests.utils import Command
git_err = '''
To /tmp/foo
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '/tmp/bar'
hint: Updates were rejected because the tip of your current branch is behind
... | bigplus/thefuck | tests/rules/test_git_push_force.py | Python | mit | 1,908 |
# Copyright (c) 2012 Rackspace Hosting
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/cells/scheduler.py | Python | gpl-2.0 | 11,256 |
# coding=utf-8
"""
oauthlib.oauth2.rfc6749.errors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error used both by OAuth 2 clients and providers to represent the spec
defined error responses for all four core grant types.
"""
from __future__ import unicode_literals
import json
from oauthlib.common import urlencode, add_params_to_ur... | nikhilsaraf/Twitter-Analytics | venv/lib/python2.7/site-packages/oauthlib/oauth2/rfc6749/errors.py | Python | gpl-3.0 | 10,153 |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import unittest
fro... | cevaris/pants | tests/python/pants_test/util/test_argutil.py | Python | apache-2.0 | 1,850 |
# -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.co... | allmalaysianews/article-extractor | tests/tests/extractors/links.py | Python | apache-2.0 | 1,177 |
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This module provides support for Twisted to interact with the wxPython.
In order to use this support, simply do the following::
| from twisted.internet import wxreactor
| wxreactor.install()
Then, when your root wxApp h... | tquilian/exelearningTest | twisted/internet/wxreactor.py | Python | gpl-2.0 | 3,230 |
import math
import argparse
import json
parser = argparse.ArgumentParser()
parser.add_argument("-lat", "--lat", help="latitude")
parser.add_argument("-lon", "--lon", help="longitude")
parser.add_argument("-st", "--steps", help="steps")
parser.add_argument("-lp", "--leaps", help="like 'steps' but for workers instead of... | quagliero/PokemonGo-Map | Tools/Hex-Beehive-Generator/location_generator.py | Python | agpl-3.0 | 1,851 |
# Copyright (C) 2007, One Laptop Per Child
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is ... | ceibal-tatu/sugar-toolkit-gtk3 | src/sugar3/datastore/__init__.py | Python | lgpl-2.1 | 769 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | elkingtonmcb/nupic | src/regions/ImageSensorExplorers/SpiralSweep.py | Python | agpl-3.0 | 11,350 |
#!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test HD Wallet keypool restore function.
Two nodes. Node1 is under test. Node0 is providing transactions an... | gamecredits-project/GameCredits | test/functional/keypool-topup.py | Python | mit | 2,808 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | WindCanDie/spark | python/pyspark/mllib/stat/_statistics.py | Python | apache-2.0 | 13,545 |
"""SCons.Tool.sunf95
Tool-specific initialization for sunf95, the Sun Studio F95 compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20... | mastbaum/rat-pac | python/SCons/Tool/sunf95.py | Python | bsd-3-clause | 2,162 |
"""The tests for the Introduction component."""
import unittest
from homeassistant.bootstrap import setup_component
from homeassistant.components import introduction
from tests.common import get_test_home_assistant
class TestIntroduction(unittest.TestCase):
"""Test Introduction."""
def setUp(self):
... | Smart-Torvy/torvy-home-assistant | tests/components/test_introduction.py | Python | mit | 666 |
import b
b.B().some_attr
# <ref> | siosio/intellij-community | python/testData/resolve/AttributeClassLevelAnnotation.py | Python | apache-2.0 | 38 |
"""The tests for Home Assistant ffmpeg binary sensor."""
from unittest.mock import patch
from homeassistant.setup import setup_component
from tests.common import (
get_test_home_assistant, assert_setup_component, mock_coro)
class TestFFmpegNoiseSetup(object):
"""Test class for ffmpeg."""
def setup_meth... | MungoRae/home-assistant | tests/components/binary_sensor/test_ffmpeg.py | Python | apache-2.0 | 4,710 |
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS, connections, migrations
from django.db.migrations.loader import AmbiguityError, MigrationLoader
from django.db.migrations.migration import SwappableTuple
from django.db.migrations.o... | mjtamlyn/django | django/core/management/commands/squashmigrations.py | Python | bsd-3-clause | 8,811 |
"""Constants."""
SECRET_YAML = "secrets.yaml"
_SECRET_NAMESPACE = "homeassistant"
| tchellomello/home-assistant | homeassistant/util/yaml/const.py | Python | apache-2.0 | 83 |
#!/usr/bin/env python
#
# Copyright 2013 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.
"""Runs all types of tests from one unified interface.
TODO(gkanwar):
* Add options to run Monkey tests.
"""
import collections
imp... | GeyerA/android_external_chromium_org | build/android/test_runner.py | Python | bsd-3-clause | 25,052 |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'H:i'
DATET... | cobalys/django | django/conf/locale/nn/formats.py | Python | bsd-3-clause | 1,721 |
#!/usr/bin/env python
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# ... | EttusResearch/gnuradio | gr-digital/python/digital/qa_header_payload_demux.py | Python | gpl-3.0 | 16,083 |
# FreeCAD TemplatePyMod module
# (c) 2010 Werner Mayer LGPL
import Mesh,Part,MeshPart
faces = []
mesh = App.ActiveDocument.ActiveObject.Mesh
segments = mesh.getPlanarSegments(0.00001) # use rather strict tolerance here
for i in segments:
if len(i) > 0:
# a segment can have inner holes
wires = MeshP... | sanguinariojoe/FreeCAD | src/Mod/TemplatePyMod/Mesh2Shape.py | Python | lgpl-2.1 | 1,086 |
from django.contrib.gis import views as gis_views
from django.contrib.gis.sitemaps import views as gis_sitemap_views
from django.contrib.sitemaps import views as sitemap_views
from django.urls import path
from .feeds import feed_dict
from .sitemaps import sitemaps
urlpatterns = [
path('feeds/<path:url>/', gis_vie... | wkschwartz/django | tests/gis_tests/geoapp/urls.py | Python | bsd-3-clause | 787 |
"""Test with no handler active"""
from logging import getLogger
root_logger = getLogger()
def run():
for x in xrange(500):
getLogger('Test')
del root_logger.manager.loggerDict['Test']
| mitsuhiko/logbook | benchmark/bench_logging_logger_creation.py | Python | bsd-3-clause | 208 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Agile Business Group sagl (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Licen... | Tecnativa/website | website_logo/__init__.py | Python | agpl-3.0 | 998 |
# mysql/__init__.py
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from . import base, mysqldb, oursql, \
pyodbc, zxjdbc, mysqlconnector, pymysql... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/site-packages/sqlalchemy/dialects/mysql/__init__.py | Python | gpl-3.0 | 1,171 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | deepakgupta1313/models | tutorials/rnn/rnn.py | Python | apache-2.0 | 930 |
#!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterf... | resmo/ansible | lib/ansible/modules/cloud/amazon/ec2_vol.py | Python | gpl-3.0 | 20,083 |
import datetime
from django.test import TestCase, override_settings
from django.utils import timezone
from .models import Article, Category, Comment
class DateTimesTests(TestCase):
def test_related_model_traverse(self):
a1 = Article.objects.create(
title="First one",
pub_date=dat... | Beauhurst/django | tests/datetimes/tests.py | Python | bsd-3-clause | 6,025 |
# Copyright 2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later version.
#
# G... | riveridea/gnuradio | gr-uhd/apps/hf_radio/ssbagc.py | Python | gpl-3.0 | 2,591 |
#!/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.
''' Toolbar preprocessing code. Turns all IDS_COMMAND macros in the RC file
into simpler constructs that can be understood by GRIT.... | guorendong/iridium-browser-ubuntu | tools/grit/grit/tool/toolbar_preprocess.py | Python | bsd-3-clause | 1,807 |
class A:
def __init__(self, x):
self.x = x
class B(A):
def <warning descr="Call to __init__ of super class is missed">__init_<caret>_</warning>(this:'B', y):
this.y = y | idea4bsd/idea4bsd | python/testData/inspections/AddCallSuperSelfNameAndAnnotationPreserved.py | Python | apache-2.0 | 194 |
if another_one:
pass
if True: a = 1 # <- move statement down here
else: b = 2
| asedunov/intellij-community | python/testData/mover/nestedBlockDown_afterDown.py | Python | apache-2.0 | 87 |
from collections import defaultdict
import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.utils.graph import (graph_shortest_path,
single_source_shortest_path_length)
def floyd_warshall_slow(graph, directed=False):
N = graph.shape[0]
#set nonzer... | WangWenjun559/Weiss | summary/sumy/sklearn/utils/tests/test_shortest_path.py | Python | apache-2.0 | 2,828 |
# blocktools.py - utilities for manipulating blocks and transactions
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from mininode import *
from script import CScript, CScriptOp
# Create a block (with regtest difficulty)
... | pouta/bitcoin | qa/rpc-tests/test_framework/blocktools.py | Python | mit | 2,057 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.jvm
~~~~~~~~~~~~~~~~~~~
Pygments lexers for JVM languages.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, ... | AppVentus/AvTime-client | packages/wakatime/wakatime/packages/pygments3/pygments/lexers/jvm.py | Python | bsd-3-clause | 48,747 |
from django.contrib.gis.db.models.fields import GeometryField
from django.db.backends.oracle.schema import DatabaseSchemaEditor
from django.db.backends.utils import strip_quotes, truncate_name
class OracleGISSchemaEditor(DatabaseSchemaEditor):
sql_add_geometry_metadata = ("""
INSERT INTO USER_SDO_GEOM_MET... | sametmax/Django--an-app-at-a-time | ignore_this_directory/django/contrib/gis/db/backends/oracle/schema.py | Python | mit | 3,916 |
#!/usr/bin/python
# Copyright 2017 Google Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | tsdmgz/ansible | lib/ansible/modules/cloud/google/gce_labels.py | Python | gpl-3.0 | 12,673 |
from datetime import date, datetime, time
from warnings import warn
from django.db import models
from django.db.models import fields
from south.db import generic
from south.db.generic import delete_column_constraints, invalidate_table_constraints, copy_column_constraints
from south.exceptions import ConstraintDropped
f... | esplinr/foodcheck | wsgi/foodcheck_proj/south/db/sql_server/pyodbc.py | Python | agpl-3.0 | 19,579 |
from __future__ import absolute_import
from django.conf.urls import patterns
from . import views
urlpatterns = patterns('',
(r'^test_utils/get_person/(\d+)/$', views.get_person),
)
| openhatch/new-mini-tasks | vendor/packages/Django/tests/regressiontests/test_utils/urls.py | Python | apache-2.0 | 189 |
# Copyright 2012 IBM Corp.
# Copyright (c) AT&T Labs Inc. 2012 Yun Mao <yunmao@gmail.com>
#
# 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
#
#... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/servicegroup/__init__.py | Python | gpl-2.0 | 807 |
"""
Account constants
"""
# The minimum and maximum length for the name ("full name") account field
NAME_MIN_LENGTH = 2
NAME_MAX_LENGTH = 255
# The minimum and maximum length for the username account field
USERNAME_MIN_LENGTH = 2
USERNAME_MAX_LENGTH = 30
# The minimum and maximum length for the email account field
E... | ahmadiga/min_edx | openedx/core/djangoapps/user_api/accounts/__init__.py | Python | agpl-3.0 | 784 |
from decimal import Decimal
from django.test import TestCase
from wellsfargo.models import FinancingPlan
from wellsfargo.dashboard.forms import (
FinancingPlanForm,
FinancingPlanBenefitForm,
)
class FinancingPlanFormTest(TestCase):
def test_create(self):
form = FinancingPlanForm(
data=... | thelabnyc/django-oscar-wfrs | src/wellsfargo/tests/dashboard/test_forms.py | Python | isc | 3,003 |
import unittest
import random
import sys
sys.path.append("../")
from cache import Cache
from common import Entry, make_cdf
import ARC, CLOCK, LRU, LFU, LRU3, LRU10
CACHESIZE = 500
class TestStatistics(unittest.TestCase):
def setUp(self):
pass
def test_algorithm(self, name=None):
if name == ... | trauzti/mimir | pymimir/tests/test_statistics.py | Python | isc | 2,469 |
"""TODO(ejhumphrey): write me."""
from __future__ import print_function
import numpy as np
import theano.tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
from theano.tensor.signal import pool
from . import core
from . import FLOATX
from . import functions
class UnconnectedNodeError(BaseExcept... | ejhumphrey/optimus | optimus/nodes.py | Python | isc | 33,957 |
import asyncio
import re
from aiohttp import web
from aiohttp.web import Response, json_response
async def mandrill_send_view(request):
data = await request.json()
message = data.get('message') or {}
if message.get('subject') == '__slow__':
await asyncio.sleep(30)
elif message.get('subject') ... | tutorcruncher/morpheus | tests/dummy_server.py | Python | mit | 5,351 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__aps__ = {
'api': '1.0.0',
'version': '1.0',
'uri': None
}
#
#
# Plugin adaptado para recuperar a URL de unsubscribe, no modo rastreável ou não, e inserí-la no
# cabeçalho do e-mail, utilizando um link mnemônico, quando for o caso.
# Para funcionar, o link de unsub... | estevao90/openemm | extras/semu/listUnsubscribeHeader.py | Python | mit | 2,464 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-12-12 15:12
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('comments', '0002_auto_20161130_0003'),
]
operation... | shawon922/django-blog | comments/migrations/0003_auto_20161212_2112.py | Python | mit | 688 |
from SBaaS_base.postgresql_orm_base import *
class data_stage01_resequencing_lineage(Base):
#TODO: rename to _timecourse
__tablename__ = 'data_stage01_resequencing_lineage'
id = Column(Integer, Sequence('data_stage01_resequencing_lineage_id_seq'), primary_key=True)
experiment_id = Column(String(50)... | dmccloskey/SBaaS_resequencing | SBaaS_resequencing/stage01_resequencing_lineage_postgresql_models.py | Python | mit | 3,741 |
import ConfigParser
class Config:
def load(self, filename):
config = ConfigParser.SafeConfigParser()
config.read(filename)
self.host = config.get('general', 'host')
self.port = int(config.get('general', 'port'))
self.db_schema = config.get('db', 'schema')
self.db_host = config.get('db', 'h... | b0r3d0m/reactions | web/config.py | Python | mit | 431 |
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import User
try:
from django.utils import timezone
except ImportError:
from datetime import datetime as timezone
def user_unicode(self):
"""
return 'last_name, first_name' for User by default
"""
return u'%s... | suenkler/django-tickets | main/models.py | Python | mit | 4,049 |
import os.path
from datetime import datetime
import sqlalchemy as db
import sqlalchemy.orm as orm
from sqlalchemy.ext.declarative import declarative_base
# This application's models:
Base = declarative_base()
# Join table for M2M between categories and blog entries.
entry_categories = db.Table('entry_categories', Ba... | cargocult/rowan-python | examples/with_db/models.py | Python | mit | 3,665 |
from unittest import TestCase
import soup_helpers as helpers
class AssertPageTitleEqualsTestCase(TestCase):
def test_pass_on_positive_match(self):
content = """
<head>
<title>Page Title</title>
</head>
"""
self.assertEqual(
helpers.asser... | bigmassa/soup_helpers | soup_helpers/tests/test_assertPageTitleEquals.py | Python | mit | 916 |
#!/usr/bin/python
# coding: utf-8
"""
Bias Sentence Investigator (BSI): Detecting and Quantifying the Degree of Bias in Text
Created on June 04, 2015
@author: C.J. Hutto
"""
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_litera... | cjhutto/bsd | bsdetector/bias.py | Python | mit | 24,943 |
def one_bits(x):
"""Given an integer, compute the number of bits set to 1.
Problem from 'Elements of Programming Interviews'.
"""
m = 1
count = 0
for i in range(x // 2 + 1):
if x & m == m:
count += 1
m = m << 1
return count
| gatita/programming-challenges | bits_set_to_one.py | Python | mit | 280 |
from rest_framework import permissions, viewsets
from rest_framework.decorators import detail_route
from rest_framework.response import Response
from accio.projects.models import Project
from accio.projects.serializers import ProjectSerializer
from ..filters import PermittedPermissionFilter
class ProjectViewSet(vie... | relekang/accio | accio/api/views/projects.py | Python | mit | 732 |
#!/usr/bin/env python
#SYSTEM IMPORTS
import numpy as np
import cv2
import argparse
#COMMOM IMPORTS
from VisNav.Common.VN_config import VN_config
'''
This program is used to calibrate a camera for opencv
Daniel Nugent 11/6/2014
Image can be found at:
http://wiki.ros.org/camera_calibration/Tutorials/StereoCalibrati... | icisneros/uav_landing | OtherssCode/Precland-master_moreRecent/Tools/VN_CameraCalibrate.py | Python | mit | 4,105 |
import unittest
import gamemaker
from Interface.models import HuntUser, Landmark, Game
import team
from django.test import TestCase
from django.utils import timezone
from datetime import datetime, timedelta
class TestMakerAddLandmark(TestCase):
def setUp(self):
Landmark.objects.all().delete()
lm =... | cutefluffykittens/ScavengerHunt | tests/ut_gamemaker.py | Python | mit | 21,339 |
from django import forms
from django.contrib.comments.forms import CommentForm
from scritti.markdown_comments.models import MarkdownComment
class MarkdownCommentForm(CommentForm):
def get_comment_model(self):
return MarkdownComment
def get_comment_create_data(self):
return super(MarkdownC... | nlativy/scritti | markdown_comments/forms.py | Python | mit | 364 |
import html
import os
import stat
import time
import urllib.parse
import functools
from fooster import web
import fooster.web.file
__all__ = ['default_index_template', 'default_index_entry', 'default_index_content_type', 'DirEntry', 'FancyIndexHandler', 'new']
default_index_template = '''<!DOCTYPE html>
<html>
... | fkmclane/web.py | fooster/web/fancyindex.py | Python | mit | 7,471 |
from flask import Blueprint
status = Blueprint('status', __name__)
from app.status.views import healthcheck # noqa isort:skip
| alphagov/notifications-admin | app/status/__init__.py | Python | mit | 129 |
from collections import OrderedDict
expected = [
OrderedDict(
[
("mediaType", "application/zip"),
("uri", u"elife-16996-supp-v1.zip"),
("filename", u"elife-16996-supp-v1.zip"),
("id", "SD1-data"),
("label", "All additional files"),
(
... | elifesciences/elife-tools | tests/fixtures/test_supplementary_files_json/content_01_expected.py | Python | mit | 850 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "note_project.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| dasap89/django_note_app | note_project/manage.py | Python | mit | 255 |
#!/usr/bin/python
import pycurl as pc
from io import BytesIO
class ReAero(object):
# XHTMLRequest Headers
headers = ['X-Requested-With: XMLHttpRequest']
# user agent
user_agent = 'Mozilla/5.0 (X11; Linux x86_64) ' \
'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/... | carbolymer/reaero | reaero.py | Python | mit | 2,198 |
#!/usr/bin/env python
# coding=utf-8
import time
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define, options
import tornado.gen
define('port', default=8888, help='run server on the port', type=int)
class MainHandler(tornado.web.RequestHandler):
def get(self):
... | tao12345666333/Talk-Is-Cheap | python/tornado/webapp_comp/app_async.py | Python | mit | 907 |
'''Tests for WindowsConsoleIO
'''
import io
import unittest
import sys
if sys.platform != 'win32':
raise unittest.SkipTest("test only relevant on win32")
from _testconsole import write_input
ConIO = io._WindowsConsoleIO
class WindowsConsoleIOTests(unittest.TestCase):
def test_abc(self):
self.assert... | anbangleo/NlsdeWeb | Python-3.6.0/Lib/test/test_winconsoleio.py | Python | mit | 4,738 |
#!/usr/bin/python3
# -*- coding:utf-8 -*-
# Project: http://cloudedbats.org
# Copyright (c) 2016-2018 Arnold Andreasson
# License: MIT License (see LICENSE.txt or http://opensource.org/licenses/mit).
import time
import logging
import threading
class ControlByMouse(object):
""" For Raspberry Pi. Makes a mouse ac... | cloudedbats/cloudedbats_wurb | cloudedbats_wurb/wurb_raspberry_pi/control_by_mouse.py | Python | mit | 8,092 |
import sys
import re
import urllib
import urllib2
from socket import *
USER_AGENT = 'Pynik/0.1'
def read_url(url, http_headers={}, http_post_data=None):
m = re.match("^(.{3,5}):\/\/([^\/]*)(:?\d*)(\/.*?)?$", url)
if m:
protocol, address, port, file = m.group(1, 2, 3, 4)
if protocol == 'http' ... | serpis/pynik | plugins/httpget.py | Python | mit | 4,011 |
#!/usr/bin/env python
from gym_env import gym_env_world
import rospy
gym_env = gym_env_world('world')
rospy.spin()
| robotics-at-maryland/qubo | src/vision/src/tuners/DQNplayground/env_world.py | Python | mit | 117 |
import unittest
from grains import (
on_square,
total_after,
)
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0
class GrainsTest(unittest.TestCase):
def test_square_1(self):
self.assertEqual(on_square(1), 1)
def test_square_2(self):
self.assertEqual(on_squ... | pheanex/xpython | exercises/grains/grains_test.py | Python | mit | 1,785 |
from django.contrib import admin
# Register your models here.
from .models import Orders
class OrdersAdmin(admin.ModelAdmin):
date_hierarchy = 'create_date'
list_display = ('order_id', 'customer', 'creater', 'ship_date','pay_term','create_date','updater')
ordering = ['-create_date']
# fields = ('order_id', 'cus... | forance/django-q | djangoq_demo/order_reminder/admin.py | Python | mit | 396 |
import unittest
from core.engine.hybrid import HybridEngine
from core.engine.simple import Engine
from core.taxonomy import Taxonomy
class HybridTestCase(unittest.TestCase):
def setUp(self):
taxonomy = Taxonomy('base', {'key': 'value', 'key2': 'value2'})
component1 = Engine('recommender1', taxonomy... | halk/recowise | tests/core/engine/test_hybrid.py | Python | mit | 1,053 |
# -*- coding: utf-8 -*-
import codecs
import bleach
def clean(s):
"""
>>> clean('<li>Data Warehouse platforms or massively parallel processing databases </li></ul>- Online advertising analytic platforms using any of the following: <ul><li>Machine learning, e.g., feature discovery, formula optimization, text cla... | xiaohan2012/job-tag-cloud | clean_html.py | Python | mit | 1,603 |
from enum import Enum
class PolygonIntersectionMode(Enum):
UNION = "union"
INTERSECTION = "intersection"
AVERAGE = "average"
@classmethod
def parse(clazz, str):
if str is None:
raise Exception('PolygonIntersectionMode: "None" not supported!')
type = getattr(cl... | route360/r360-py | r360_py/util/enum/PolygonIntersectionMode.py | Python | mit | 474 |
# --------------------------------------------------------------------------- #
import os
import filecmp
from arroyo import utils
from arroyo.crypto import PublicKey, PrivateKey
import pytest
from .test_asymmetric import get_public_key_filename
# ------------------------------------------------------------------... | ArroyoNetworks/python-arroyo-crypto | tests/test_x509.py | Python | mit | 9,405 |
#!/usr/bin/env python
import re
import sys
import string
import unicodedata
import nltk
from textblob import TextBlob
from textblob.blob import WordList
from textblob.base import BaseNPExtractor
from textblob.en.np_extractors import FastNPExtractor, ConllExtractor
import grammars
import util
class SuperNPExtractor(B... | tomshen/sherlock | parse.py | Python | mit | 6,134 |
# -*- coding: utf-8 -*-
from io import StringIO
from django.core.management import CommandError, call_command
from django.test import TestCase
from django.test.utils import override_settings
from unittest.mock import patch
MYSQL_DATABASE_SETTINGS = {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'dbatabase'... | django-extensions/django-extensions | tests/management/commands/test_sqlcreate.py | Python | mit | 5,106 |
"""Hackbright project"""
from flask import Flask, render_template, jsonify, request, session
from flask_debugtoolbar import DebugToolbarExtension
from model import *
from image_engine import *
from sequencer import *
from scaletracker import *
from os import environ
app = Flask(__name__)
app.secret_key = e... | kaiayoung/petrichor | server.py | Python | mit | 10,044 |
__all__ = [
'ObstManager'
]
'''
This file contains classes related to the management of obstacles.
'''
__author__ = 'Yinan Zhang Dartmouth College'
__revision__ = '$Revision$'
import sys
sys.path.append('../math')
from robot import *
from geometry import *
class ObstManager:
'''Obstacle manager that controls ... | Yinan-Zhang/RichCSpace | basics/robotics/obstacles.py | Python | mit | 1,930 |
# -*- coding: utf-8 -*-
# quiz-orm/app.py
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import os
app = Flask(__name__)
# konfiguracja aplikacji
app.config.update(dict(
SECRET_KEY='bardzosekretnawartosc',
DATABASE=os.path.join(app.root_path, 'quiz.db'),
SQLALCHEMY_DATABASE_URI='sqlite:/... | koduj-z-klasa/python101 | docs/webflask/quiz_orm/quiz2_sa/app.py | Python | mit | 545 |
import re
import struct
import time
import socket, select
import Queue, threading
from collections import namedtuple
import commands
class ISCPMessage(object):
"""Deals with formatting and parsing data wrapped in an ISCP
containers. The docs say:
ISCP (Integra Serial Control Protocol) consists of th... | reddec/onkyo-eiscp | eiscp/core.py | Python | mit | 17,909 |
import os
project_path = os.path.split(os.path.split(__file__)[0])[0]
del os
| adrn/triforce | triforce/__init__.py | Python | mit | 77 |
"""
@file
@brief Helpers for sphinx extensions.
"""
import os
def try_add_config_value(app, name, default, rebuild, type_s=()):
"""
Add a variables in the config file if it does not have it yet.
@param app Sphinx application
@param name name of the variable
@param de... | sdpython/pyquickhelper | src/pyquickhelper/sphinxext/sphinxext_helper.py | Python | mit | 2,614 |
import datetime
from sqlalchemy import text
from sqlalchemy.orm import eagerload,joinedload
import sys
from ..models import FixedFeast, ServicePattern
class FixedFeasts:
"""Class for placing fixed feasts in a year"""
def __init__(self, session, year):
"""Sets up the placer"""
self.session = s... | rsterbin/liturgicalendar | bin/calendar_builder/fetch/fixed_feasts.py | Python | mit | 1,449 |