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 |
|---|---|---|---|---|---|
#!/pyenv/bin/python
import sys, json, numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.cluster import KMeans
x = []
f = open('cluster_input.txt')
lines = f.read().split('\n')
#for line in sys.stdin:
for idx, line in enumerate(lines[:-1]):
print idx
tokens = line.strip().split('\t')
points... | randerzander/wellbook | etl/hive/cluster.py | Python | apache-2.0 | 1,557 |
from Urutu import *
import numpy as np
@Urutu("CL")
def divmul(a, b, c, d):
Tx, Ty, Tz = 100, 1, 1
Bx, By, Bz = 1, 1, 1
c[tx] = a[tx] / b[tx]
d[tx] = a[tx] * b[tx]
return c, d
@Urutu("CU")
def addsub(a, b, e, f):
Tx, Ty, Tz = 100, 1, 1
Bx, By, Bz = 1, 1, 1
e[tx] = a[tx] + b[tx]
f[tx] = a[tx] - b[tx]
return ... | adityaatluri/Urutu | test/test_simple.py | Python | apache-2.0 | 651 |
# -*- encoding: utf-8 -*-
#
# Copyright © 2012 New Dream Network, LLC (DreamHost)
#
# Author: Doug Hellmann <doug.hellmann@dreamhost.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
#
# ... | tanglei528/ceilometer | ceilometer/api/v1/blueprint.py | Python | apache-2.0 | 24,451 |
# -*- coding: utf-8 -*-
from AppiumLibrary import utils
from robot.api import logger
class ElementFinder(object):
def __init__(self):
self._strategies = {
'identifier': self._find_by_identifier,
'id': self._find_by_id,
'name': self._find_by_name,
... | serhatbolsu/robotframework-appiumlibrary | AppiumLibrary/locators/elementfinder.py | Python | apache-2.0 | 9,396 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
from marionette_test import MarionetteTestCase
from marionette import HTMLElement
from errors import NoSuchEle... | wilebeast/FireFox-OS | B2G/gecko/testing/marionette/client/marionette/tests/unit/test_timeouts.py | Python | apache-2.0 | 2,769 |
# Copyright (c) 2016 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | kawamon/hue | desktop/core/ext-py/jaeger-client-4.0.0/tests/test_reporter.py | Python | apache-2.0 | 10,447 |
# Copyright 2017 Battelle Energy Alliance, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | idaholab/raven | tests/framework/Databases/HDF5/test_2steps/two_steps.py | Python | apache-2.0 | 1,215 |
"""The lookin integration sensor platform."""
from __future__ import annotations
import logging
from homeassistant.components.sensor import (
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_TEMPERATURE,
STATE_CLASS_MEASUREMENT,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.config_entries import ... | jawilson/home-assistant | homeassistant/components/lookin/sensor.py | Python | apache-2.0 | 2,393 |
"""Xbox Media Player Support."""
from __future__ import annotations
import re
from typing import List
from xbox.webapi.api.client import XboxLiveClient
from xbox.webapi.api.provider.catalog.models import Image
from xbox.webapi.api.provider.smartglass.models import (
PlaybackState,
PowerState,
SmartglassCo... | w1ll1am23/home-assistant | homeassistant/components/xbox/media_player.py | Python | apache-2.0 | 7,802 |
import unittest
import wx
from editor.fakeplugin import FakePlugin
from robot.utils.asserts import assert_true
from robotide.controller.macrocontrollers import TestCaseController
from robotide.editor.macroeditors import TestCaseEditor
TestCaseEditor._populate = lambda self: None
class IncredibleMock(object):
d... | caio2k/RIDE | utest/editor/test_macroeditors.py | Python | apache-2.0 | 2,087 |
from plenum.test.view_change_service.helper import check_view_change_adding_new_node
def test_view_change_while_adding_new_node_2_slow_commit(looper, tdir, tconf, allPluginsPath,
txnPoolNodeSet,
sdk_pool_... | evernym/zeno | plenum/test/view_change_service/test_view_change_while_adding_new_node_2_slow_commit.py | Python | apache-2.0 | 1,063 |
# Copyright 2012 OpenStack Foundation
# 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 requ... | jamielennox/tempest | tempest/api/compute/security_groups/test_security_group_rules.py | Python | apache-2.0 | 7,690 |
from .base import *
import os
DEBUG = True
ALLOWED_HOSTS = ['*']
INTERNAL_IPS = ['127.0.0.1']
# Set the path to the location of the content files for python.org
# For example,
# PYTHON_ORG_CONTENT_SVN_PATH = '/Users/flavio/working_copies/beta.python.org/build/data'
PYTHON_ORG_CONTENT_SVN_PATH = ''
DATABASES = {
... | manhhomienbienthuy/pythondotorg | pydotorg/settings/local.py | Python | apache-2.0 | 2,135 |
from dtest import Tester
from tools import putget
class TestMultiDCPutGet(Tester):
def putget_2dc_rf1_test(self):
""" Simple put-get test for 2 DC with one node each (RF=1) [catches #3539] """
cluster = self.cluster
cluster.populate([1, 1]).start()
session = self.patient_cql_conn... | mambocab/cassandra-dtest | multidc_putget_test.py | Python | apache-2.0 | 896 |
# Copyright 2017 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... | floydhub/dockerfiles | dl/tensorflow/tests/1.7.0/parsers.py | Python | apache-2.0 | 14,510 |
# Copyright 2012, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | hanlind/nova | nova/tests/unit/cert/test_rpcapi.py | Python | apache-2.0 | 2,856 |
def __bootstrap__():
global __bootstrap__, __loader__, __file__
import sys, pkg_resources, imp
__file__ = pkg_resources.resource_filename(__name__, '_psycopg.so')
__loader__ = None; del __bootstrap__, __loader__
imp.load_dynamic(__name__,__file__)
__bootstrap__()
| hexlism/css_platform | sleepyenv/lib/python2.7/site-packages/psycopg2-2.6.1-py2.7-linux-x86_64.egg/psycopg2/_psycopg.py | Python | apache-2.0 | 284 |
# Copyright 2020 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | forslund/mycroft-core | test/unittests/client/test_noise_tracker.py | Python | apache-2.0 | 4,000 |
# Copyright 2013 Canonical Corp.
# 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 ... | raildo/nova | nova/tests/unit/virt/vmwareapi/test_vif.py | Python | apache-2.0 | 16,646 |
from build.management.commands.base_build import Command as BaseBuild
from build.management.commands.build_homology_models_zip import Command as UploadModel
from django.db.models import Q
from django.conf import settings
from protein.models import Protein, ProteinConformation, ProteinAnomaly, ProteinState, ProteinSegm... | cmunk/protwis | structure/management/commands/check_knots.py | Python | apache-2.0 | 3,856 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2014 Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 ( the "License" );
# you may not use this file except in compliance with the License.
# You may obtain a cop... | chrismattmann/girder | girder/api/v1/token.py | Python | apache-2.0 | 2,716 |
from __future__ import print_function
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
from h2o.transforms.preprocessing import H2OScaler
from h2o.estimators.random_forest import H2ORandomForestEstimator
from sklearn.pipeline import Pipeline
from sklearn.model_selection import Randomize... | h2oai/h2o-3 | h2o-py/tests/testdir_scikit_grid/pyunit_scal_svd_rf_grid.py | Python | apache-2.0 | 3,661 |
#!/usr/bin/env python
"""
main.py -- Udacity conference server-side Python App Engine
HTTP controller handlers for memcache & task queue access
$Id$
created by wesc on 2014 may 24
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
import webapp2
from google.appengine.api import app_identity
from google.appe... | mrrobeson/Project-4---Conference-App | main.py | Python | apache-2.0 | 1,695 |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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 ... | juanyaw/PTVS | Python/Product/PythonTools/ptvsd/setup.py | Python | apache-2.0 | 1,400 |
# Copyright 2017-present Open Networking 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 agr... | opencord/xos | xos/coreapi/xos_dynamicload_api.py | Python | apache-2.0 | 11,546 |
import uuid
from keystoneclient.v3 import policies
from tests.v3 import utils
class PolicyTests(utils.TestCase, utils.CrudTests):
def setUp(self):
super(PolicyTests, self).setUp()
self.additionalSetUp()
self.key = 'policy'
self.collection_key = 'policies'
self.model = poli... | tylertian/Openstack | openstack F/python-keystoneclient/tests/v3/test_policies.py | Python | apache-2.0 | 596 |
#!/usr/bin/env python
#page 39
import shelve
db = shelve.open('../db/people-shelve')
for key in db:
print(key, '=>\n', db[key])
print(db['kouer']['name'])
db.close()
| lichengshuang/createvhost | python/others/Preview/dump_db_shelve.py | Python | apache-2.0 | 171 |
from hazelcast.serialization.bits import *
from hazelcast.protocol.client_message import ClientMessage
from hazelcast.protocol.custom_codec import *
from hazelcast.util import ImmutableLazyDataList
from hazelcast.protocol.codec.map_message_type import *
REQUEST_TYPE = MAP_EXECUTEONKEYS
RESPONSE_TYPE = 117
RETRYABLE = ... | cangencer/hazelcast-python-client | hazelcast/protocol/codec/map_execute_on_keys_codec.py | Python | apache-2.0 | 1,694 |
from warpnet_client import *
from warpnet_common_params import *
from warpnet_experiment_structs import *
from twisted.internet import reactor
from datetime import *
import time
minTime = 10
pktLen = 1412
pktPeriod = 2000
mod_hdr = 2
mod_payload = 2
txGains = [30, 45, 60];
class ScriptMaster:
def startup(self):
... | shailcoolboy/Warp-Trinity | ResearchApps/Measurement/examples/TxPower_vs_PER/TxPower_vs_PER.py | Python | bsd-2-clause | 3,716 |
# -*- coding: utf-8 -*-
"""
Pygments tests with example files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import print_function
import os
import pprint
import difflib
import pickle
fr... | spencerlyon2/pygments | tests/test_examplefiles.py | Python | bsd-2-clause | 4,257 |
"""A minimal application used by a number of tests and tutorials. It
is not meant to be actually useful in the real world.
The basic idea of min9 is to have most plugins installed. So it is the least
minimal of this series.
This is also a **usage example** of :ref:`plugin_inheritance` because if
overrides the :mod:`l... | lino-framework/book | lino_book/projects/min9/__init__.py | Python | bsd-2-clause | 751 |
from webtest import TestApp
from main import app
app = TestApp(app)
def test_that_fails():
response = app.get('/')
assert response
test_that_fails.nosegae_logservice = True
| brunoripa/NoseGAE | examples/app_with_logging/tests/test.py | Python | bsd-2-clause | 186 |
# coding: utf-8
from hashlib import sha1
import os
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.core.urlresolvers import reverse
from django.core.validators import MaxLengthValidator
from django.db import models
from django.db.models import aggregates
from django.db.... | tjvr/s2forums | djangobb_forum/models.py | Python | bsd-3-clause | 32,814 |
"""
The main site views
"""
__author__='Martin Knobel'
| chipperdoodles/3color | threecolor/site/__init__.py | Python | bsd-3-clause | 57 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-11-10 17:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import filebrowser.fields
class Migration(migrations.Migration):
dependencies = [
('subscriptions', '0002_auto_201710... | scaphilo/koalixcrm | koalixcrm/subscriptions/migrations/0003_auto_20171110_1732.py | Python | bsd-3-clause | 3,603 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from cms.management.commands import publisher_publish
from cms.models.pagemodel import Page
from cms.test.testcases import CMSTestCase
from cms.test.util.context_managers import SettingsOverride, StdoutOverride
from django.contrib.auth.models import User
fro... | team-xue/xue | xue/cms/tests/publisher.py | Python | bsd-3-clause | 9,591 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... | nuagenetworks/vspk-python | vspk/v6/fetchers/nuqospolicers_fetcher.py | Python | bsd-3-clause | 2,121 |
#!/usr/bin/env python
__version__ = '0.8.9'
| eufarn7sp/egads-eufar | egads/_version.py | Python | bsd-3-clause | 44 |
import numpy as np
import pandas as pd
import pandas._testing as tm
from .base import BaseExtensionTests
class BaseMissingTests(BaseExtensionTests):
def test_isna(self, data_missing):
expected = np.array([True, False])
result = pd.isna(data_missing)
tm.assert_numpy_array_equal(result, e... | jreback/pandas | pandas/tests/extension/base/missing.py | Python | bsd-3-clause | 4,515 |
import flux
import forge
from flux.gevent_timeline import GeventTimeline
from .test__timeline import TimeFactorTest, CurrentTimeLineTest, DatetimeTest, ScheduleSequenceTest, ScheduleTest, TimelineAPITest
class GeventTimeFactorTest(TimeFactorTest):
def _forge_timeline(self):
self.forge = forge.Forge()
... | omergertel/flux | tests/test__gevent_timeline.py | Python | bsd-3-clause | 1,377 |
# Copyright (c) 2008-2015 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Contains parsed specs for various NEXRAD messages formats."""
| ahill818/MetPy | metpy/io/_nexrad_msgs/__init__.py | Python | bsd-3-clause | 208 |
import mesh.patch as patch
import mesh.array_indexer as ai
import numpy as np
from numpy.testing import assert_array_equal
# utilities
def test_buf_split():
assert_array_equal(ai._buf_split(2), [2, 2, 2, 2])
assert_array_equal(ai._buf_split((2, 3)), [2, 3, 2, 3])
# ArrayIndexer tests
def test_indexer():
... | zingale/pyro2 | mesh/tests/test_array_indexer.py | Python | bsd-3-clause | 1,312 |
import logging
import posixpath
import warnings
from collections import defaultdict
from django.utils.deprecation import RemovedInDjango21Warning
from django.utils.safestring import mark_safe
from .base import (
Node, Template, TemplateSyntaxError, TextNode, Variable, token_kwargs,
)
from .library import Library
... | mattseymour/django | django/template/loader_tags.py | Python | bsd-3-clause | 13,097 |
#!/usr/bin/env python
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--year', type=int, default=2016)
args = parser.parse_args()
if args.year == 2015:
import jsk_apc2015_common
cls_names = ['background'] + jsk_apc2015_common.get_object_list()
... | start-jsk/jsk_apc | jsk_apc2016_common/scripts/list_objects.py | Python | bsd-3-clause | 717 |
# -*- coding: utf-8 -*-
import os
import pytest
import json
from flask import url_for
from vwadaptor.user.models import User
from vwadaptor.helpers import modelrun_serializer
from .factories import UserFactory
from .conftest import TEST_DIR
from vwpy.modelschema import load_schemas
schemas = load_schemas()
class T... | itsrifat/vwadaptor | tests/test_api.py | Python | bsd-3-clause | 2,675 |
# Generated by Django 2.0.4 on 2018-05-04 17:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("wagtaildocs", "0007_merge"),
]
operations = [
migrations.AddField(
model_name="document",
name="file_size",
... | rsalmaso/wagtail | wagtail/documents/migrations/0008_document_file_size.py | Python | bsd-3-clause | 403 |
# -*- coding: utf-8 -*-
import doctest
import logging
import os
from unittest.mock import Mock, patch, call
from uuid import uuid4
from django.test import TransactionTestCase
from eventkit_cloud.utils import geopackage
from eventkit_cloud.utils.geopackage import (
add_geojson_to_geopackage,
get_table_count,
... | venicegeo/eventkit-cloud | eventkit_cloud/utils/tests/test_geopackage.py | Python | bsd-3-clause | 14,062 |
from __future__ import absolute_import, print_function, division
import numpy
from nose.plugins.skip import SkipTest
import theano
from theano import tensor
import theano.tests.unittest_tools as utt
import theano.tensor.nnet.tests.test_blocksparse
import theano.sandbox.cuda as cuda_ndarray
from theano.sandbox.cuda.bl... | JazzeYoung/VeryDeepAutoEncoder | theano/sandbox/cuda/tests/test_blocksparse.py | Python | bsd-3-clause | 2,932 |
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
from .kern import Kern
from ...core.parameterization import Param
from paramz.transformations import Logexp
import numpy as np
from ...util.multioutput import index_to_slices
class ODE_st(Kern):
"""
... | SheffieldML/GPy | GPy/kern/src/ODE_st.py | Python | bsd-3-clause | 12,839 |
import pytest
from django.template.loader import render_to_string
from tests.thumbnail_tests.utils import BaseTestCase
pytestmark = pytest.mark.django_db
class FilterTestCase(BaseTestCase):
def test_html_filter(self):
text = '<img alt="A image!" src="http://dummyimage.com/800x800" />'
val = ren... | mariocesar/sorl-thumbnail | tests/thumbnail_tests/test_filters.py | Python | bsd-3-clause | 1,546 |
"""
Integrate functions by rewriting them as Meijer G-functions.
There are three user-visible functions that can be used by other parts of the
sympy library to solve various integration problems:
- meijerint_indefinite
- meijerint_definite
- meijerint_inversion
They can be used to compute, respectively, indefinite i... | flacjacket/sympy | sympy/integrals/meijerint.py | Python | bsd-3-clause | 70,440 |
"""Contains implementations for each ported operation in Pandas.
Attributes:
decoder_ (NumPyEncoder): Description
encoder_ (NumPyDecoder): Description
"""
from encoders import *
from weld.weldobject import *
encoder_ = NumPyEncoder()
decoder_ = NumPyDecoder()
def get_field(expr, field):
""" Fetch a fiel... | weld-project/weld | python/grizzly/grizzly/grizzly_impl.py | Python | bsd-3-clause | 48,957 |
"""
Sphinx plugins for Django documentation.
"""
import json
import os
import re
from docutils import nodes
from docutils.parsers.rst import directives
from sphinx import addnodes, __version__ as sphinx_ver
from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.writers.html import SmartyPantsHTMLTranslato... | Beeblio/django | docs/_ext/djangodocs.py | Python | bsd-3-clause | 11,807 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-01 12:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("contentstore", "0007_auto_20171102_0950")]
operations = [
migrations.AddField(
... | praekelt/seed-stage-based-messaging | contentstore/migrations/0008_schedule_scheduler_schedule_id.py | Python | bsd-3-clause | 595 |
from django import forms
from panoptes.core.utils.registry import create_registry
ChartRegistry = create_registry('slug')
class BaseChart(object):
"""Abstract base class for a chart.
A child chart must define a string value for the `slug` attribute, and can
optionally define values for the `js` and `css` attrib... | cilcoberlin/panoptes | panoptes/analysis/panels/charting/charts/base.py | Python | bsd-3-clause | 816 |
import collections
print "\n\n[INFO] Processing articles for publication venues.\n"
print "------------------------------------------------------------------------------------------------\n\n"
file = open("../data/aminer_publication_tiny.txt")
lines = file.readlines()
papers = {}
i = 0
article_count = 0
pub_count = 0
... | sujithvm/internationality-journals | src/test.py | Python | mit | 464 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import __init__
import settings
import random
from bson import ObjectId
class Guild(settings.BaseObj):
data = {
'name': '',
'search_name': '',
'link_name': '',
'description':'',
'people':[],
'creator': '',
'img': 'none',
'score': 0,
'ope... | idooo/tweeria | models/model_guilds.py | Python | mit | 7,396 |
# dev server settings for core project.
from base import *
DEBUG = True
DATABASES = {
'default': {
# The last part of ENGINE is 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'ado_mssql'.
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': '', # Or path to database file if using sql... | mrkeng/fabric-bolt | core/settings/develop.py | Python | mit | 650 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Twisted Python: Utilities and Enhancements for Python.
"""
from __future__ import absolute_import, division
# Deprecating twisted.python.constants.
from .compat import unicode
from .versions import Version
from .deprecate import deprecatedMo... | whitehorse-io/encarnia | pyenv/lib/python2.7/site-packages/twisted/python/__init__.py | Python | mit | 674 |
import functools
import operator
import os
import re
try:
import simplejson as json
except ImportError:
import json
from flask import Blueprint
from flask import Response
from flask import abort
from flask import flash
from flask import redirect
from flask import render_template
from flask import request
from ... | ariakerstein/twitterFlaskClone | project/lib/python2.7/site-packages/flask_peewee/admin.py | Python | mit | 23,963 |
## -*- coding: utf-8 -*-
# (C) 2013 Muthiah Annamalai
#
# Implementation of transliteration algorithm flavors
# and later used in TamilKaruvi (2007) by your's truly.
#
# BlindIterative Algorithm from TamilKaruvi - less than optimal -
class BlindIterative:
@staticmethod
def transliterate(table... | atvKumar/open-tamil | transliterate/algorithm.py | Python | mit | 4,159 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
An incomplete sample script.
This is not a complete bot; rather, it is a template from which simple
bots can be made. You can rename it to mybot.py, then edit it in
whatever way you want.
Use global -simulate option for test purposes. No changes to live wiki
will be done.... | jayvdb/pywikibot-core | scripts/basic.py | Python | mit | 6,777 |
#[PROTEXCAT]
#\License: ALL RIGHTS RESERVED
"""
@file cpuusage.py
"""
##
# @addtogroup pnp pnp
# @brief This is pnp component
# @{
# @addtogroup cpuusage cpuusage
# @brief This is cpuusage module
# @{
##
import os
from oeqa.oetest import oeRuntimeTest
from oeqa.utils.helper import collect_pnp_log
class CPUUsageTest... | ostroproject/meta-iotqa | lib/oeqa/runtime/pnp/cpuusage.py | Python | mit | 1,757 |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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.apac... | SUSE/azure-sdk-for-python | azure-servicemanagement-legacy/azure/servicemanagement/constants.py | Python | mit | 1,337 |
"""
TinyURL.com shortener implementation
No config params needed
"""
from .base import BaseShortener
from ..exceptions import ShorteningErrorException
class Tinyurl(BaseShortener):
api_url = 'http://tinyurl.com/api-create.php'
def short(self, url):
response = self._get(self.api_url, params=dict(url=u... | RuiNascimento/krepo | script.areswizard/pyshorteners/shorteners/tinyurl.py | Python | gpl-2.0 | 536 |
# -*- coding: utf-8 -*-
#
# This file is part of EUDAT B2Share.
# Copyright (C) 2016 CERN.
#
# B2Share 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 2 of the
# License, or (at your option) any... | EUDAT-B2SHARE/b2share | tests/b2share_unit_tests/records/test_records_utils.py | Python | gpl-2.0 | 1,720 |
# Test script to compare transform-matrix vlaues in Blender
# Load in blender text editor, select one or more empties and hit [ALT][P]
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by ... | chrisglass/ufoai | src/tools/blender/test_matrix.py | Python | gpl-2.0 | 1,565 |
# -*- coding: utf-8 -*-
#
# hl_api_simulation.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 2 of the Licen... | SepehrMN/nest-simulator | pynest/nest/lib/hl_api_simulation.py | Python | gpl-2.0 | 11,564 |
#
# Copyright (C) 2006, 2007, One Laptop Per Child
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# ... | iamutkarshtiwari/Browse-fiddleFeature | model.py | Python | gpl-2.0 | 2,775 |
# -*- coding: utf-8 -*-
'''
Created on 21/01/2012
Copyright (c) 2010-2012 Shai Bentin.
All rights reserved. Unpublished -- rights reserved
Use of a copyright notice is precautionary only, and does
not imply publication or disclosure.
Licensed under Eclipse Public License, Version 1.0
In... | guymakam/Kodi-Israel | plugin.video.reshet.video/resources/appCaster/APEpgLoader.py | Python | gpl-2.0 | 1,230 |
# $Id: 200_register.py 369517 2012-07-01 17:28:57Z file $
#
from inc_cfg import *
# Basic registration
test_param = TestParam(
"Basic registration",
[
InstanceParam( "client",
"--null-audio"+
" --id=\"<sip:test1@pjsip.org>\""+
" --registrar=sip:sip.pjsip.org" +
" --username=test1" +
... | fluentstream/asterisk-p2p | res/pjproject/tests/pjsua/scripts-run/200_register.py | Python | gpl-2.0 | 426 |
# python version 1.0 DO NOT EDIT
#
# Generated by smidump version 0.4.8:
#
# smidump -f python PDU2-MIB
FILENAME = "pdu2_mib.mib"
MIB = {
"moduleName" : "PDU2-MIB",
"PDU2-MIB" : {
"nodetype" : "module",
"language" : "SMIv2",
"organization" :
"""Raritan""",
... | sigmunau/nav | python/nav/smidumps/pdu2_mib.py | Python | gpl-2.0 | 809,850 |
import re
import logging
import time
import random
import string
import aexpect
from autotest.client.shared import error
from virttest import data_dir
from virttest import utils_misc
from virttest import storage
from virttest import arch
from virttest import env_process
@error.context_aware
def run(test, params, e... | tolimit/tp-qemu | qemu/tests/pci_hotplug_check.py | Python | gpl-2.0 | 15,817 |
import contextlib
import copy
import inspect
import pickle
import re
import sys
import types
import unittest
import warnings
from test import support
from test.support.script_helper import assert_python_ok
class AsyncYieldFrom:
def __init__(self, obj):
self.obj = obj
def __await__(self):
yiel... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/test/test_coroutines.py | Python | gpl-2.0 | 63,767 |
#
# Copyright 2002-2006 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 2 of the License, or
# (at your option) any lat... | nijel/translate | translate/storage/xml_extract/test_unit_tree.py | Python | gpl-2.0 | 2,956 |
"""JSL schema for Digester worker results."""
import jsl
from f8a_worker.schemas import JSLSchemaBaseWithRelease
# Describe v1-0-0
ROLE_v1_0_0 = "v1-0-0"
ROLE_TITLE = jsl.roles.Var({
ROLE_v1_0_0: "Digests v1-0-0"
})
class DigesterDetail(jsl.Document):
"""JSL schema for Digester worker results details."""
... | jpopelka/fabric8-analytics-worker | f8a_worker/workers/schemas/digests.py | Python | gpl-3.0 | 1,331 |
from rest_framework import permissions, authentication, generics
from nodeshot.core.base.mixins import ACLMixin
from .serializers import *
from .models import *
class ServiceList(ACLMixin, generics.ListCreateAPIView):
"""
Retrieve service list according to user access level
Parameters:
* ... | sephiroth6/nodeshot | nodeshot/networking/services/views.py | Python | gpl-3.0 | 1,999 |
from collections import namedtuple
import time
import struct
from datetime import datetime
from decocare import lib
from .. exceptions import InvalidPacketReceived
_Packet = namedtuple('Packet', [
'type', 'serial', 'op', 'payload', 'crc',
'date', 'dateString', 'valid', 'chan',
'payload_hex'
])
class Packet... | oskarpearson/mmblelink | mmeowlink/packets/rf.py | Python | gpl-3.0 | 3,435 |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import re, time
from functools import partial
from PyQt5.Qt import (
QComboBox... | hazrpg/calibre | src/calibre/gui2/search_box.py | Python | gpl-3.0 | 21,498 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import urlparse
from django import forms
fr... | Finntack/pootle | pootle/apps/pootle_profile/forms.py | Python | gpl-3.0 | 960 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import base64
import hashlib
import json
import os
import subprocess
import tempfile
import threading
import urlparse
im... | GreenRecycleBin/servo | tests/wpt/harness/wptrunner/executors/executorservo.py | Python | mpl-2.0 | 7,684 |
"""
This file contains counting conditions for use for count matrix based code
clone detection. (See http://goo.gl/8UuAW5 for general information about the
algorithm.)
"""
from coalib.bearlib.parsing.clang.cindex import CursorKind
from coalib.misc.Enum import enum
def is_function_declaration(cursor):
"""
Ch... | andreimacavei/coala | bears/codeclone_detection/ClangCountingConditions.py | Python | agpl-3.0 | 15,417 |
"""
Tests for the force_publish management command
"""
from unittest import mock
from django.core.management import CommandError, call_command
from cms.djangoapps.contentstore.management.commands.force_publish import Command
from cms.djangoapps.contentstore.management.commands.utils import get_course_versions
from ... | edx/edx-platform | cms/djangoapps/contentstore/management/commands/tests/test_force_publish.py | Python | agpl-3.0 | 4,997 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | jmesteve/saas3 | openerp/addons/portal/tests/test_portal.py | Python | agpl-3.0 | 14,149 |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Florent Fourcot
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | laurent-george/weboob | modules/colisprive/pages.py | Python | agpl-3.0 | 2,773 |
# -*- coding: utf-8 -*-
# © 2016 Tecnativa, S.L. - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
| Tecnativa/website | website_odoo_debranding/__init__.py | Python | agpl-3.0 | 136 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | Johnzero/erp | openerp/addons/product/report/product_pricelist.py | Python | agpl-3.0 | 5,509 |
"""
This config file extends the test environment configuration
so that we can run the lettuce acceptance tests.
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=W0401, W0614
from .test import *
from .sauce import *
# You ... | pelikanchik/edx-platform | lms/envs/acceptance.py | Python | agpl-3.0 | 5,619 |
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
# pylint: disable=redefined-builtin,wrong-import-position,wildcard-import,useless-suppression,line-too-long
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('contentstore.tests.test_import_draft_order', 'cms.... | eduNEXT/edunext-platform | import_shims/studio/contentstore/tests/test_import_draft_order.py | Python | agpl-3.0 | 449 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RSpatial(RPackage):
"""spatial: Functions for Kriging and Point Pattern Analysis"""
h... | iulian787/spack | var/spack/repos/builtin/packages/r-spatial/package.py | Python | lgpl-2.1 | 725 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
from os import listdir
class Cntk1bitsgd(Package):
"""CNTK1bitSGD is the header-only
1-bit s... | iulian787/spack | var/spack/repos/builtin/packages/cntk1bitsgd/package.py | Python | lgpl-2.1 | 833 |
#!/usr/bin/python -u
# Dedicated Control handler script for OpenLieroX
# (http://openlierox.sourceforge.net)
import time
import os
import sys
import threading
import traceback
import math
import dedicated_control_io as io
setvar = io.setvar
formatExceptionInfo = io.formatExceptionInfo
import dedicated_control_rankin... | ProfessorKaos64/openlierox | share/gamedir/scripts/dedicated_control_usercommands.py | Python | lgpl-2.1 | 13,799 |
from waflib.Build import BuildContext
import subprocess
import os
class dumpconfig(BuildContext):
'''dumps the libs connected to the targets'''
cmd = 'dumpconfig'
fun = 'build'
def execute(self):
self.restore()
if not self.all_envs:
self.load_envs()
self.recurse([s... | mdaus/nitro | externals/coda-oss/build/dumpconfig.py | Python | lgpl-3.0 | 1,463 |
#!/usr/bin/env python
"""
Usage: synapse_densities.py --help
Voxelizes and optionally shows synapse densities.
"""
import argparse
import hashlib
import os
import subprocess
__author__ = "Daniel Nachbaur"
__email__ = "daniel.nachbaur@epfl.ch"
__copyright__ = "Copyright 2016, EPFL/Blue Brain Project"
def _find_execu... | BlueBrain/Fivox | apps/synapseDensities/synapse_densities.py | Python | lgpl-3.0 | 5,654 |
import unittest
from construct import *
from construct.text import *
class NodeAdapter(Adapter):
def __init__(self, factory, subcon):
Adapter.__init__(self, subcon)
self.factory = factory
def _decode(self, obj, context):
return self.factory(obj)
#=====================================... | Joev-/HoNCore | honcore/lib/construct/tests/test_ast.py | Python | unlicense | 3,908 |
# Copyright 2016 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... | nolanliou/tensorflow | tensorflow/contrib/py2tf/__init__.py | Python | apache-2.0 | 1,489 |
# Copyright (c) 2018 PaddlePaddle 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 app... | lcy-seso/Paddle | python/paddle/fluid/tests/unittests/test_crop_op.py | Python | apache-2.0 | 3,089 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Instance manager class definition
:author: Thomas Calmant
:copyright: Copyright 2016, Thomas Calmant
:license: Apache License 2.0
:version: 0.6.4
..
Copyright 2016 Thomas Calmant
Licensed under the Apache License, Version 2.0 (the "License");
you... | isandlaTech/cohorte-devtools | qualifier/deploy/cohorte-home/repo/pelix/ipopo/instance.py | Python | apache-2.0 | 27,681 |
# Copyright (c) 2015-2016 Claudiu Popa <pcmanticore@gmail.com>
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING
"""JSON reporter"""
from __future__ import absolute_import, print_function
import cgi
import json
import s... | arju88nair/projectCulminate | venv/lib/python3.5/site-packages/pylint/reporters/json.py | Python | apache-2.0 | 1,662 |
"""Representation of a deCONZ remote or keypad."""
from pydeconz.sensor import (
ANCILLARY_CONTROL_EMERGENCY,
ANCILLARY_CONTROL_FIRE,
ANCILLARY_CONTROL_INVALID_CODE,
ANCILLARY_CONTROL_PANIC,
AncillaryControl,
Switch,
)
from homeassistant.const import (
CONF_DEVICE_ID,
CONF_EVENT,
C... | Danielhiversen/home-assistant | homeassistant/components/deconz/deconz_event.py | Python | apache-2.0 | 5,074 |