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 |
|---|---|---|---|---|---|
# (c) 2018 Red Hat 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
DOCUMENTATION = """
---
author: Ansible Networking Team
connection: httpapi
short_description: Use httpapi to run... | veger/ansible | lib/ansible/plugins/connection/httpapi.py | Python | gpl-3.0 | 9,657 |
#!/usr/bin/env python
#
# Output classes for ETL.
#
# Author: Just van den Broecke
#
import subprocess
import os
import re
import shutil
from stetl.component import Config
from stetl.output import Output
from stetl.util import Util, gdal, ogr, osr
from stetl.packet import FORMAT
log = Util.get_log('ogroutput')
clas... | fsteggink/stetl | stetl/outputs/ogroutput.py | Python | gpl-3.0 | 12,260 |
from rest_framework import serializers
from rest_framework.pagination import PaginationSerializer
from rest_framework.serializers import HyperlinkedModelSerializerOptions
from oclapi.fields import HyperlinkedVersionedResourceIdentityField, HyperlinkedResourceVersionIdentityField
from django.conf import settings
class... | snyaggarwal/oclapi | ocl/oclapi/serializers.py | Python | mpl-2.0 | 4,544 |
# coding: utf-8
# 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/.
"""Amazon Elastic Cloud Computing API"""
import collections
import datetime
import logging
import ssl
imp... | MozillaSecurity/laniakea | laniakea/core/providers/ec2/manager.py | Python | mpl-2.0 | 15,959 |
# -*- coding: utf-8 -*-
# Read raw data
# Author: Jimmy Royer
# jimmy.royer@analysisgroup.com
# June 20, 2016
import pandas as pd
# Training Sample -- All the Mutations
data = pd.read_csv("./input/str.csv")
# Create target variable
data['y'] = (data['dr'] == "r") * 1
data.drop('dr', axis=1, inplace=True)
# List of ... | IQSS/gentb-site | R/Neural_Network/program/Load_Data_STR.py | Python | agpl-3.0 | 1,728 |
from rest_framework import serializers
from api.generics.serializers import DynamicFieldsModelSerializer
from iati.models import Activity
from traceability import models as chain_models
class SimpleActivitySerializer(serializers.ModelSerializer):
class Meta:
model = Activity
fields = (
... | openaid-IATI/OIPA | OIPA/api/chain/serializers.py | Python | agpl-3.0 | 3,050 |
from django.db import models
import pandas as pd
from qPRC.lib.parser import parse
from qPRC.lib.fitter import fit as _fit
from qPRC.lib.fitter import slice as _slice
class Dataset(models.Model):
file = models.FileField(upload_to='files/%Y/%m/%d')
def __str__(self):
return str(self.file)
def dat... | dpelc/qPRC | qPRC/apps/datasets/models.py | Python | agpl-3.0 | 1,059 |
# -*- coding: utf-8 -*-
# (c) 2017 Diagram Software S.L.
# Copyright 2017 Ignacio Ibeas <ignacio@acysos.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import aeat_certificate_password
| factorlibre/l10n-spain | l10n_es_aeat_certificate/wizards/__init__.py | Python | agpl-3.0 | 215 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-07 19:06
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("wizard_builder", "0020_choice_extra_info_text")]
operations = [... | project-callisto/callisto-core | callisto_core/wizard_builder/migrations/0021_choiceoption.py | Python | agpl-3.0 | 1,029 |
from queue import Queue
from bears.python.PyStringConcatBear import PyStringConcatBear
from coalib.testing.LocalBearTestHelper import LocalBearTestHelper
from coalib.results.Result import Result
from coalib.settings.Section import Section
valid_string = """
string = 'foo'
'bar'
"""
concat_non_string = """
... | coala/coala-bears | tests/python/PyStringConcatBearTest.py | Python | agpl-3.0 | 2,269 |
from .models import ExtendedRegisterForm
| yewsiang/botmother | app/auth/__init__.py | Python | agpl-3.0 | 41 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | xdevelsistemas/taiga-back-community | taiga/projects/userstories/apps.py | Python | agpl-3.0 | 5,467 |
# -*- coding: utf-8 -*-
# Kuulemma
# Copyright (C) 2014, Fast Monkeys Oy
#
# This program 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 option) any later... | fastmonkeys/kuulemma | kuulemma/views/comment.py | Python | agpl-3.0 | 4,693 |
"""
Content Type Gating Configuration Models
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation ... | a-parhom/edx-platform | openedx/features/content_type_gating/models.py | Python | agpl-3.0 | 9,344 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2016, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | cogmission/nupic.research | tests/extended_temporal_memory/etm_unit_test.py | Python | agpl-3.0 | 28,519 |
# easy_thumbnails face cropping processor
# Much of the below taken from http://stackoverflow.com/a/13243712/669631
try:
import cv
faceCascade = cv.Load('/usr/share/opencv/haarcascades/haarcascade_frontalface_alt.xml')
except:
faceCascade = False
# Select one of the haarcascade files:
# haarcascade_fron... | opencorato/sayit | speeches/thumbnail_processors.py | Python | agpl-3.0 | 2,093 |
from datetime import datetime
from luigi.date_interval import Date
from edx.analytics.tasks.tests.acceptance import AcceptanceTestCase, as_list_param, when_geolocation_data_available
class LocationByCourseAcceptanceTest(AcceptanceTestCase):
INPUT_FILE = 'location_by_course_tracking.log'
COURSE_ID = u'edX/... | edx/edx-analytics-pipeline | edx/analytics/tasks/tests/acceptance/test_location_per_course.py | Python | agpl-3.0 | 2,023 |
from django.contrib import admin
from django.db import models
from models import APIMetric
class APIMetricAdmin(admin.ModelAdmin):
list_display = ('apicall', 'user', 'created_at')
list_filter = ('apicall',)
admin.site.register(APIMetric, APIMetricAdmin) | rossjones/ScraperWikiX | web/api/admin.py | Python | agpl-3.0 | 278 |
import re
from functools import partial, update_wrapper
from schemagic.core import validate_against_schema
from schemagic.utils import merge
def predicate_validator(predicate, name=None, coercer=None, message=None, data=None):
"""Builds new validator function that tests, and optionally coerces, data against the ... | Mechrophile/schemagic | schemagic/validators.py | Python | lgpl-2.1 | 3,519 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | wscullin/spack | lib/spack/spack/test/make_executable.py | Python | lgpl-2.1 | 5,061 |
# -*- coding: utf-8 -*-
"""
ZUGBRUECKE
Calling routines in Windows DLLs from Python scripts running on unixlike systems
https://github.com/pleiszenburg/zugbruecke
src/zugbruecke/core/callback_server.py: Classes for managing callback routines
Required to run on platform / side: [UNIX, WINE]
Copyright (C) 2017-20... | pleiszenburg/zugbruecke | src/zugbruecke/core/callback_server.py | Python | lgpl-2.1 | 4,015 |
from boyle import define, File, Shell
a = define(
name='t1',
out=File('a'),
do=Shell('echo hello > {out}'))
b = define(
name='t2',
out=File('b'),
do=Shell('echo world > {out}'))
c = define(
name='t3',
out=File('jonatan.jpg'),
inp=[a, b],
do=Shell('cat {inp[0]} {inp[1]} > {out}... | boyleworkflow/boyle | notes/internal-python-dsl/simple_workflow.py | Python | lgpl-3.0 | 325 |
import cadquery as cq
# Set up the length, width, and thickness
(L, w, t) = (20.0, 6.0, 3.0)
s = cq.Workplane("XY")
# Draw half the profile of the bottle and extrude it
p = s.center(-L / 2.0, 0).vLine(w / 2.0) \
.threePointArc((L / 2.0, w / 2.0 + t), (L, w / 2.0)).vLine(-w / 2.0) \
.mirrorX().extrude(30.0, ... | jmwright/cadquery-freecad-module | Libs/cadquery/examples/FreeCAD/Ex022_Classic_OCC_Bottle.py | Python | lgpl-3.0 | 508 |
# 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.
#
# This program is distributed in ... | vfulco/scalpel | lib/gravity/tae/corpora/conll.py | Python | lgpl-3.0 | 19,418 |
# Copyright 2009-2010 10gen, 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 writing,... | marcelnicolay/mongotor | mongotor/helpers.py | Python | lgpl-3.0 | 3,825 |
#Asteroid class
import pyglet, random
import resources, physicalobject
class Asteroid(physicalobject.PhysicalObject):
def __init__(self, *args, **kwargs):
super(Asteroid, self).__init__(
resources.asteroid_image, *args, **kwargs)
self.rotate_speed = random.random() * 100.0 - 50.0
def handle_collision_wi... | CyanCorsair/asteroids | version_2/game/asteroid.py | Python | unlicense | 979 |
# Copyright 2016-2021 Lenovo
#
# 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 writing, ... | xcat2/confluent | confluent_server/confluent/discovery/core.py | Python | apache-2.0 | 57,545 |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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 requir... | HybridF5/tempest_debug | tempest/tests/common/test_credentials.py | Python | apache-2.0 | 1,461 |
#!/usr/bin/env python
# Copyright 2014 Open Connectome Project (http://openconnecto.me)
#
# 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
#
#... | openconnectome/m2g | MR-OCP/mrcap/utils/downsample.py | Python | apache-2.0 | 4,933 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | adaitche/luigi | test/mock_test.py | Python | apache-2.0 | 3,350 |
# AZURE TRANSLATOR DEMO
# this demo is minimal
# here you can see cooked things with voice change based on language
# https://github.com/MyRobotLab/inmoov/blob/develop/InMoov/services/G_Translator.py
#voice service
mouth=Runtime.createAndStart("mouth", "MarySpeech")
#azure service
AzureTranslator=Runtime.createAndS... | MyRobotLab/myrobotlab | src/main/resources/resource/AzureTranslator/AzureTranslator.py | Python | apache-2.0 | 3,645 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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 Lic... | citrix-openstack-build/trove | trove/tests/unittests/api/test_versions.py | Python | apache-2.0 | 12,853 |
#MenuTitle: Compare Font Info for Open Fonts
# -*- coding: utf-8 -*-
__doc__="""
Analyzes font info entries in all open fonts and outputs differences.
"""
import GlyphsApp
Glyphs.clearLog()
Glyphs.showMacroWindow()
listOfData = [
"File Path",
"Family Name",
"Version Number",
"Date",
"Copyright",
"Designer",
"D... | weiweihuanghuang/Glyphs-Scripts | Test/Compare Font Family.py | Python | apache-2.0 | 1,208 |
# -*- coding: utf-8 -*-
'''Example settings/local.py file.
These settings override what's in website/settings/defaults.py
NOTE: local.py will not be added to source control.
'''
import logging
from os import environ
from . import defaults
DEV_MODE = True
DEBUG_MODE = True # Sets app to debug mode, turns off templat... | caseyrollins/osf.io | website/settings/local-dist.py | Python | apache-2.0 | 3,862 |
from bottle import route, view, request, response
from datetime import datetime
import sqlite3
import bcrypt
from helpers import FHIR
from fitBitConnect import fitBitConnect
@route('/sign_up', method='GET')
@view('sign_up')
def get_sign_up():
return dict(year=datetime.now().year)
@route('/sign_up', method='POS... | omtinez/gatech-teamfin | controllers/sign_up.py | Python | apache-2.0 | 1,442 |
import hashlib
import json.decoder
import logging
import ntpath
import random
from docker.errors import DockerException
from docker.utils import parse_bytes as sdk_parse_bytes
from .errors import StreamParseError
from .timeparse import MULTIPLIERS
from .timeparse import timeparse
json_decoder = json.JSONDecoder()
l... | thaJeztah/compose | compose/utils.py | Python | apache-2.0 | 5,128 |
# 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 writing, software
# d... | rahulunair/nova | nova/tests/unit/objects/test_migration_context.py | Python | apache-2.0 | 6,945 |
#
# Copyright 2011, Robert Mela
#
# 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 ... | jbraeuer/yum-s3-plugin | test/testvalues.py | Python | apache-2.0 | 835 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This program will change the shrinking factor of a trained classifier
"""
from __future__ import print_function
#import sys
#sys.path.append("..")
#sys.path.append("../data_sequence")
#sys.path.append("../helpers")
from detections_pb2 import Box
from detector_model... | LevinJ/Pedestrian-detection-and-tracking | src/doppia/tools/objects_detection/models/change_shrinking_factor.py | Python | apache-2.0 | 6,372 |
click(Pattern("Flmnduana.png").targetOffset(34,0))
exit(0) | silverbulleters/vanessa-behavoir | tools/Sikuli/OpenDialogClickFolderSelect.sikuli/OpenDialogClick.py | Python | apache-2.0 | 58 |
# 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... | xzturn/tensorflow | tensorflow/python/keras/layers/gru_test.py | Python | apache-2.0 | 9,531 |
# Copyright 2014 - Rackspace Hosting
#
# 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... | ed-/solum | solum/cmd/worker.py | Python | apache-2.0 | 2,004 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/analytics-componentized-patterns | retail/recommendation-system/bqml-scann/index_builder/builder/indexer.py | Python | apache-2.0 | 3,305 |
'''
Created on Aug 16, 2011
@author: jklo
'''
from service_template import ServiceTemplate
from setup_utils import getInput, PublishDoc, isBoolean, YES, isInt
import pystache, uuid
import json
def install(server, dbname, setupInfo):
custom_opts = {}
active = getInput("Enable Slice?", "T", isBoolean)
cust... | jimklo/LearningRegistry | config/services/Slice.py | Python | apache-2.0 | 2,749 |
# 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 writing, software
# distributed under t... | trozet/tacker | tacker/common/clients.py | Python | apache-2.0 | 1,866 |
# Copyright 2015, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python tests originally created or extracted from other peoples work. The
# parts were too small to be protected.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... | wfxiang08/Nuitka | tests/programs/absolute_import/foobar/foobar.py | Python | apache-2.0 | 944 |
from public import public
from ... import util
from ...common import exceptions as com
from .. import rules as rlz
from .. import types as ir
from .core import Node, _safe_repr
def _to_sort_key(key, *, table=None):
if isinstance(key, DeferredSortKey):
if table is None:
raise com.IbisTypeError... | cpcloud/ibis | ibis/expr/operations/sortkeys.py | Python | apache-2.0 | 2,826 |
import tempfile
import pytest
from pyhocon import ConfigFactory
from pyhocon.tool import HOCONConverter
class TestHOCONConverter(object):
CONFIG_STRING = """
a = {b: 1}
b = [1, 2]
c = 1
d = "a"
e = \"\"\"1
2
3\"\"\"
... | acx2015/pyhocon | tests/test_tool.py | Python | apache-2.0 | 3,542 |
"""Config flow for Philips TV integration."""
from __future__ import annotations
import platform
from typing import Any
from haphilipsjs import ConnectionFailure, PairingFailure, PhilipsTV
import voluptuous as vol
from homeassistant import config_entries, core
from homeassistant.const import (
CONF_API_VERSION,
... | w1ll1am23/home-assistant | homeassistant/components/philips_js/config_flow.py | Python | apache-2.0 | 5,227 |
# Copyright 2011 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 req... | dsiddharth/access-keys | keystone/openstack/common/fixture/lockutils.py | Python | apache-2.0 | 1,886 |
# Copyright 2014 Red Hat
#
# 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... | flyingfish007/tempest | tempest/scenario/test_swift_telemetry_middleware.py | Python | apache-2.0 | 4,228 |
# coding=utf-8
# Copyright 2014 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 os
from conte... | sameerparekh/pants | src/python/pants/backend/jvm/tasks/jar_create.py | Python | apache-2.0 | 3,020 |
# Copyright (c) 2012-2016 Seafile Ltd.
from django.conf.urls import url
from .views import *
urlpatterns = [
url(r'^link/send/$', send_shared_link, name='send_shared_link'),
url(r'^link/save/$', save_shared_link, name='save_shared_link'),
url(r'^upload_link/send/$', send_shared_upload_link, name='send_sha... | miurahr/seahub | seahub/share/urls.py | Python | apache-2.0 | 535 |
# Server Specific Configurations
server = {
'port': '6382',
'host': '0.0.0.0'
}
# Pecan Application Configurations
app = {
'root': 'tuskar.api.controllers.root.RootController',
'modules': ['tuskar.api'],
'static_root': '%(confdir)s/public',
'template_path': '%(confdir)s/templates',
'debug':... | tuskar/tuskar | tuskar/api/config.py | Python | apache-2.0 | 498 |
# Copyright 2015, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python tests originally created or extracted from other peoples work. The
# parts were too small to be protected.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... | tempbottle/Nuitka | tests/programs/deep/DeepProgramMain.py | Python | apache-2.0 | 865 |
# coding=utf-8
"""
ComicStreamer bookmark manager thread class
"""
"""
Copyright 2012-2014 Anthony Beville
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... | sebdelsol/ComicStreamer | comicstreamerlib/bookmarker.py | Python | apache-2.0 | 2,089 |
"""Validate integration translation files."""
from __future__ import annotations
from functools import partial
from itertools import chain
import json
import re
import voluptuous as vol
from voluptuous.humanize import humanize_error
import homeassistant.helpers.config_validation as cv
from homeassistant.util import ... | w1ll1am23/home-assistant | script/hassfest/translations.py | Python | apache-2.0 | 10,183 |
# 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/PostProcessors/ExternalPostProcessor/testHistorySetDeletingHistories/partitionHistorySetAndRemoveSomeHistories.py | Python | apache-2.0 | 2,721 |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | raju249/oppia | core/domain/summary_services_test.py | Python | apache-2.0 | 36,554 |
#!/usr/bin/env python
# Copyright 2015 The Kubernetes Authors.
#
# 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 appli... | dqminh/kubernetes | cluster/juju/layers/kubernetes-worker/reactive/kubernetes_worker.py | Python | apache-2.0 | 35,127 |
# taken from http://code.activestate.com/recipes/363602/
def cached_property(f):
"""returns a cached property that is calculated by function f"""
def get(self):
try:
return self._property_cache[f]
except AttributeError:
self._property_cache = {}
x = self._p... | prongs/rbt-jira | apache_dev_tool/utils.py | Python | apache-2.0 | 490 |
# Tweepy
# Copyright 2009 Joshua Roesslein
# See LICENSE
import htmlentitydefs
import re
from datetime import datetime
import time
from tweepy.models import models
def _parse_cursor(obj):
return obj['next_cursor'], obj['prev_cursor']
def parse_json(obj, api):
return obj
def parse_return_true(obj, api):
... | gabelula/b-counted | tweepy/parsers.py | Python | apache-2.0 | 5,676 |
#
# Copyright 2018 Quantopian, 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 wr... | chayapan/pyfolio | pyfolio/utils.py | Python | apache-2.0 | 16,144 |
from setuptools import setup, Extension
import platform
version = '1.5.0'
ext_modules = []
setup (name = 'droneapi',
zip_safe=True,
version = version,
description = 'Python language bindings for the DroneApi',
long_description = '''Python language bindings for the DroneApi''',
url ... | trishhyles/dronekit-python | setup.py | Python | apache-2.0 | 1,223 |
from __future__ import absolute_import, print_function, unicode_literals
import sys
import os
here = os.path.split(os.path.abspath(__file__))[0]
root = os.path.abspath(os.path.join(here, '../../'))
sys.path[0:0] = [root]
from streamparse.bolt import Bolt
class DummyBoltAutoAck(Bolt):
auto_ack = True
auto_... | scrapinghub/streamparse | test/ipc/dummy_bolt_auto_ack.py | Python | apache-2.0 | 571 |
# Copyright 2016 Google 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 writing, ... | sharbison3/python-docs-samples | bigquery/cloud-client/query_params_test.py | Python | apache-2.0 | 1,551 |
# Copyright 2017 Google Inc. 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 applicable law or a... | tensorflow/deepmath | deepmath/guidance/wavenet.py | Python | apache-2.0 | 4,883 |
# Copyright (c) 2010-2012 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 agree... | swiftstack/swift | test/unit/obj/test_updater.py | Python | apache-2.0 | 49,085 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | citrix-openstack/horizon | horizon/horizon/dashboards/nova/access_and_security/security_groups/tests.py | Python | apache-2.0 | 10,202 |
# 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 writing, software
# d... | steveb/heat | heat_integrationtests/functional/test_lbaasv2.py | Python | apache-2.0 | 5,460 |
import yaml
import os
from utils import to_bool
config_path = os.environ.get('SIXPACK_CONFIG', None)
if config_path:
try:
CONFIG = yaml.safe_load(open(config_path, 'r'))
except IOError:
raise RuntimeError('SIXPACK_CONFIG - {0} - is an invalid path'.format(config_path))
except yaml.YAMLErro... | blackskad/sixpack | sixpack/config.py | Python | bsd-2-clause | 2,380 |
"""
Copyright (c) 2011, 2012, Regents of the University of California
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 l... | jf87/smap | python/smap/archiver/help.py | Python | bsd-2-clause | 2,264 |
#!/usr/bin/python
import sys
import serial
import glob
from traits.api import (HasTraits, Int, Str, List, Float, Instance, Bool, Tuple,
Either, Range, Property, ReadOnly, cached_property, on_trait_change)
class Fixture(HasTraits):
base = ReadOnly
slots = Property(depends_on='-ignore'... | jonathanhogg/coderdojo-sequencer | light_controller/dmx.py | Python | bsd-2-clause | 3,970 |
from __future__ import with_statement
from __future__ import print_function
import os
from os import path
import re
from blazeutils.helpers import pprint
import six
from werkzeug.serving import run_simple
from werkzeug import Client
from werkzeug.wrappers.base_response import BaseResponse
from blazeweb.globals import... | level12/blazeweb | blazeweb/commands.py | Python | bsd-3-clause | 11,047 |
# Copyright 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import fnmatch
import inspect
import os
import re
import sys
from py_utils import camel_case
def DiscoverModules(start_dir, top_level_dir, pattern='*'):
... | catapult-project/catapult-csm | common/py_utils/py_utils/discover.py | Python | bsd-3-clause | 6,734 |
'''
#;+
#; NAME:
#; radec
#; Version 1.1
#;
#; PURPOSE:
#; 2014 Written by JXP
#;-
#;------------------------------------------------------------------------------
'''
# Import libraries
import numpy as np
from astropy.table import QTable, Column, Table
from astropy.coordinates import SkyCoord
from astropy impor... | profxj/xastropy | xastropy/obs/radec.py | Python | bsd-3-clause | 6,434 |
# Copyright (c) 2011, Willow Garage, 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 cond... | allenh1/rosdep | test/test_rosdep_installers.py | Python | bsd-3-clause | 22,802 |
"""contains a cache to store router's certificates
Two lists are kept:
- ApprovedCert which contains the certificate of router that provided a valid Certification Path
- TBApprovedCert that temporarily store certificates that can't be yet verified
"""
from __future__ import with_statement
import tempfile
imp... | daveti/NDprotector | NDprotector/CertCache.py | Python | bsd-3-clause | 12,772 |
# Django settings for tumblelog project.
import sys
import os
PROJECT_ROOT = os.path.dirname(__file__)
sys.path.append(os.path.join(PROJECT_ROOT, '../../../'))
DEBUG = True
TEMPLATE_DEBUG = False
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
# MongoDB Databases
MONGODB_DATABASES = ... | seraphlnWu/django-mongoengine | tests/settings.py | Python | bsd-3-clause | 4,488 |
from ctypes import *
from ctypes.test import need_symbol, xfail
import unittest
import os
import _ctypes_test
class BITS(Structure):
_fields_ = [("A", c_int, 1),
("B", c_int, 2),
("C", c_int, 3),
("D", c_int, 4),
("E", c_int, 5),
("F"... | yotchang4s/cafebabepy | src/main/python/ctypes/test/test_bitfields.py | Python | bsd-3-clause | 10,212 |
import gc
import pytest
from pluginbase import PluginBase
@pytest.fixture(scope='function')
def base():
return PluginBase(package='dummy.plugins')
@pytest.fixture(scope='function')
def dummy_internal_name():
return 'pluginbase._internalspace._sp7bb7d8da1d24ae5a5205609c951b8be4'
@pytest.fixture(scope='fun... | bailaohe/pluginbase | tests/conftest.py | Python | bsd-3-clause | 621 |
from django.urls import include, path, reverse
from django.utils.translation import gettext_lazy as _
from wagtail.admin.menu import MenuItem
from wagtail.contrib.forms import urls
from wagtail.contrib.forms.utils import get_forms_for_user
from wagtail.core import hooks
@hooks.register("register_admin_urls")
def reg... | wagtail/wagtail | wagtail/contrib/forms/wagtail_hooks.py | Python | bsd-3-clause | 881 |
from django.test import TestCase
from django.contrib.auth.models import User
from enroll.backends import ModelBackend
class TestModelBackend(TestCase):
def test_authenticate(self):
User.objects.create_user('bob', 'bob@domain.com', 'secret')
backend = ModelBackend()
self.assertIsInstance(... | farin/django-enroll | tests/testproject/test_app/tests/backends.py | Python | bsd-3-clause | 525 |
from __future__ import absolute_import
from datetime import timedelta
from django.core.urlresolvers import reverse
from django.utils import timezone
from mock import patch
from sentry.models import (
EventMapping, Group, GroupBookmark, GroupSeen, GroupStatus
)
from sentry.testutils import APITestCase
from sentry.... | hongliang5623/sentry | tests/sentry/api/endpoints/test_project_group_index.py | Python | bsd-3-clause | 18,112 |
from __future__ import absolute_import
import socket
from mock import patch
from kombu import common
from kombu.common import (
Broadcast, maybe_declare,
send_reply, isend_reply, collect_replies,
declaration_cached, ignore_errors,
QoS, PREFETCH_COUNT_MAX,
entry_to_queue,
)
from kombu.exceptions i... | mathom/kombu | kombu/tests/test_common.py | Python | bsd-3-clause | 15,811 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the BSD 3-clause license.
"""The Project class."""
import os
import textwrap
import pprint
import logging
import json
from ConfigParser import RawConfigParser
import os.path as op... | jaidevd/pysemantic | pysemantic/project.py | Python | bsd-3-clause | 23,738 |
from __future__ import print_function
import unittest
import abstract_rendering.util as util
class EmptyListTests(unittest.TestCase):
def test_without_length(self):
ls = util.EmptyList()
self.assertIsNone(ls[0])
self.assertIsNone(ls[-1])
self.assertIsNone(ls[30])
self.asse... | kcompher/abstract_rendering | abstract_rendering/test/utilTests.py | Python | bsd-3-clause | 3,232 |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | jensreeder/scikit-bio | skbio/tree/_tree.py | Python | bsd-3-clause | 88,386 |
from django.conf.urls import url
from corehq.messaging.smsbackends.twilio.views import (TwilioIncomingSMSView,
TwilioIncomingIVRView)
urlpatterns = [
url(r'^sms/(?P<api_key>[\w-]+)/?$', TwilioIncomingSMSView.as_view(),
name=TwilioIncomingSMSView.urlname),
url(r'^ivr/(?P<api_key>[\w-]+)/?$', Twilio... | dimagi/commcare-hq | corehq/messaging/smsbackends/twilio/urls.py | Python | bsd-3-clause | 394 |
"""
Plot the columns of the output files
"""
import sys
from matplotlib import pyplot as plt
import numpy as np
data = np.loadtxt(sys.argv[1], unpack=True)
shape = (int(sys.argv[2]), int(sys.argv[3]))
lon = np.reshape(data[0], shape)
lat = np.reshape(data[1], shape)
for i, value in enumerate(data[3:]):
value = np.... | leouieda/tesseroids-original | cookbook/custom_ratio/plot.py | Python | bsd-3-clause | 509 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.template.defaultfilters import slugify
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
for park in orm.Park.objec... | codeforboston/bostongreenmap | parks/migrations/0003_fix_slugify.py | Python | bsd-3-clause | 8,645 |
"""Automatically download MLdata datasets."""
# Copyright (c) 2011 Pietro Berkes
# License: Simplified BSD
import os
from os.path import join, exists
import re
from scipy import io
from shutil import copyfileobj
import urllib2
from .base import get_data_home, Bunch
MLDATA_BASE_URL = "http://mldata.org/repository/da... | cdegroc/scikit-learn | sklearn/datasets/mldata.py | Python | bsd-3-clause | 6,501 |
"""
System commands
These are the default commands called by the system commandhandler
when various exceptions occur. If one of these commands are not
implemented and part of the current cmdset, the engine falls back
to a default solution instead.
Some system commands are shown in this module
as a REFERENCE only (the... | jamesbeebop/evennia | evennia/commands/default/syscommands.py | Python | bsd-3-clause | 4,841 |
""" An action that sets the active perspective. """
# Enthought library imports.
from pyface.workbench.api import IPerspective
from traits.api import Delegate, Instance, on_trait_change
# Local imports.
from workbench_action import WorkbenchAction
class SetActivePerspectiveAction(WorkbenchAction):
""" An actio... | brett-patterson/pyface | pyface/workbench/action/set_active_perspective_action.py | Python | bsd-3-clause | 2,020 |
from pyexcel.internal.common import get_book_headers_in_array
from pyexcel.internal.generators import BookStream
from nose.tools import eq_
def test_book_stream():
bs = BookStream()
assert bs.number_of_sheets() == 0
def test_load_from_empty_sheets():
bs = BookStream()
bs.load_from_sheets(None)
... | chfw/pyexcel | tests/test_book_stream.py | Python | bsd-3-clause | 773 |
#
# Copyright (c) 2014, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
__author__ = 'Nick Shor... | Instagram/neti | neti/__init__.py | Python | bsd-3-clause | 444 |
###############################################################################
##
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary for... | Nikea/VisTrails | vistrails/db/versions/v0_9_3/translate/v0_9_1.py | Python | bsd-3-clause | 4,011 |
# -*- test-case-name: twisted.web.test.test_web -*-
#
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
"""A twisted web component framework.
This module is DEPRECATED.
"""
import warnings
warnings.warn("This module is deprecated, please use Woven instead.", DeprecationWarning)
# Sy... | santisiri/popego | envs/ALPHA-POPEGO/lib/python2.5/site-packages/twisted/web/widgets.py | Python | bsd-3-clause | 36,525 |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
__all__=["radar_sim"]
from .radar_sim import *
| barney-NG/pyCAMTracker | src/filterpy/examples/__init__.py | Python | mit | 183 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django_countries.fields
class Migration(migrations.Migration):
dependencies = [
('transtech_directory', '0004_address_contactinfo'),
]
operations = [
migrations.AddField(
... | nanuxbe/transtech-directory | transtech_directory/migrations/0005_auto_20150921_1047.py | Python | mit | 3,744 |