code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | nvoron23/hue | desktop/core/src/desktop/models.py | Python | apache-2.0 | 24,907 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2016-2018, Eric Jacob <erjac77@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/LICENS... | erjac77/ansible-module-f5bigip | library/f5bigip_util_get_dossier.py | Python | apache-2.0 | 5,751 |
# 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 (t... | apache/allura | ForgeImporters/setup.py | Python | apache-2.0 | 2,033 |
import numpy as np
from scipy.stats import rv_continuous
class customDist(rv_continuous):
""""
Distribution F(x)=1-exp(-exp(0.1x)
"""
#TODO поменять тут на своё распределение
def _cdf(self, x, *args):
return 1 - np.exp(-np.exp(x / 10.))
d = customDist()
#Генерируем выборку из 100 случа... | ivlukin/math_stat_python | problem1.py | Python | apache-2.0 | 1,341 |
# Copyright 2015 Michael Broxton
#
# 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 writi... | samklr/spark-gce | setup.py | Python | apache-2.0 | 1,354 |
# 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 u... | sxjscience/tvm | python/tvm/relay/backend/vm.py | Python | apache-2.0 | 9,793 |
import subprocess
asm_code_path='asm_code_'
data_path='.'
cmd='mkdir '+' '.join([asm_code_path+'train',asm_code_path+'test'])
subprocess.call(cmd,shell=True)
cmd='pypy writeasm.py xid_train.p '+' '.join([data_path+'/train',asm_code_path+'train'])
subprocess.call(cmd,shell=True)
cmd='pypy writeasm.py xid_test.p '+' '.... | bikash/kaggleCompetition | microsoft malware/Malware_Say_No_To_Overfitting/kaggle_Microsoft_malware_small/gen_code_img.py | Python | apache-2.0 | 592 |
import pytest
from waterbutler.providers.osfstorage.exceptions import OsfStorageQuotaExceededError
class TestExceptionSerialization:
@pytest.mark.parametrize(
'exception_class',
[(OsfStorageQuotaExceededError),]
)
def test_tolerate_dumb_signature(self, exception_class):
"""In orde... | CenterForOpenScience/waterbutler | tests/providers/osfstorage/test_exceptions.py | Python | apache-2.0 | 803 |
# -*- coding: utf-8 -*-
# Copyright 2014 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 l... | fredericlepied/os-net-config | os_net_config/tests/test_cli.py | Python | apache-2.0 | 4,656 |
#!/usr/bin/python2
# Copyright 2012 Anton Beloglazov
#
# 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 ... | raphapr/openstack-neat | vm-placement.py | Python | apache-2.0 | 3,249 |
#! /usr/bin/env python
# File: udf/ext_has_spouse_features.py
import sys, json
# For each input tuple
# TODO: Sample Data and the input schema.
# sample json
for row in sys.stdin:
obj = json.loads(row)
# Library/DSL??? This is a span, it should be an object.
p1_start = obj["p1.start_position"]
... | gaapt/deepdive | ddlib/without_ddlib.py | Python | apache-2.0 | 1,813 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | phenoxim/cinder | cinder/tests/unit/volume/test_init_host.py | Python | apache-2.0 | 14,005 |
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0003_auto_20150503_2026'),
]
operations = [
migrations.AddField(
model_name='membership',
name='membership_type',
field=models.IntegerField(choi... | manhhomienbienthuy/pythondotorg | users/migrations/0004_auto_20150503_2100.py | Python | apache-2.0 | 776 |
#!/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... | essamjoubori/girder | girder/utility/s3_assetstore_adapter.py | Python | apache-2.0 | 29,780 |
"""Demo platform that has two fake alarm control panels."""
import datetime
from homeassistant.components.manual.alarm_control_panel import ManualAlarm
from homeassistant.const import (
STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_CUSTOM_BYPASS,
STATE_ALARM_ARMED_HOME,
STATE_ALARM_ARMED_NIGHT,
STATE_AL... | Cinntax/home-assistant | homeassistant/components/demo/alarm_control_panel.py | Python | apache-2.0 | 2,364 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
import django.core.files.storage
import mptt.fields
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Category',
... | miceno/django-categories | categories/migrations/0001_initial.py | Python | apache-2.0 | 3,406 |
# Copyright 2014
# The Cloudscaling Group, 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... | stackforge/ec2-api | ec2api/cmd/api_metadata.py | Python | apache-2.0 | 1,007 |
#!/usr/bin/env python3
# This script connects to and performs queries on an SQLite database using Python.
# Jen Thomas, Oct 2016.
#########################################################
import sqlite3
import shutil
def connect_to_sqlite_db(sqlite_file):
""" Connect to an SQLite database. Return a connection... | Smelly-London/datavisualisation | python_utils/sqlite_utilities.py | Python | apache-2.0 | 2,385 |
# 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 (t... | apache/allura | Allura/allura/model/notification.py | Python | apache-2.0 | 30,127 |
# Copyright 2013 Donald Stufft
#
# 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, so... | mattrobenolt/warehouse | warehouse/__about__.tmpl.py | Python | apache-2.0 | 1,202 |
from django.db.models import Max
from django.db.models import Q
from django.utils import timezone
from pydoc import locate
from orchestra.core.errors import SanityBotError
from orchestra.models import Project
from orchestra.models import SanityCheck
from orchestra.models import WorkflowVersion
from orchestra.utils.not... | b12io/orchestra | orchestra/bots/sanitybot.py | Python | apache-2.0 | 3,750 |
# Webhooks for external integrations.
from typing import Any, Dict, List, Mapping
from django.http import HttpRequest, HttpResponse
from zerver.decorator import webhook_view
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import c... | rht/zulip | zerver/webhooks/sonarqube/view.py | Python | apache-2.0 | 4,276 |
# Copyright 2016 - SUSE Linux GmbH
#
# 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... | ArchiFleKs/magnum | contrib/drivers/k8s_opensuse_v1/version.py | Python | apache-2.0 | 683 |
# Copyright 2022. ThingsBoard
#
# 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 ... | thingsboard/thingsboard-gateway | thingsboard_gateway/extensions/request/custom_request_uplink_converter.py | Python | apache-2.0 | 3,676 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2020 T. Zachary Laine
#
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
prop_lookup_test_form = decls = '''\
// Copyright (C) 2020 T. Zachary Laine
//
... | wiltonlazary/arangodb | 3rdParty/iresearch/external/text/scripts/generate_unicode_break_tests.py | Python | apache-2.0 | 22,214 |
#
# This program 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 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be use... | statsbiblioteket/newspaper-jpylizer-deprecated | src/main/extras/jpylyzer-1.10.1/boxvalidator.py | Python | apache-2.0 | 81,418 |
from __future__ import print_function
import numpy as np
import sys
import bisect
import datetime
import gzip
def my_print(s):
print("[" + str(datetime.datetime.now()) + "] " + s, file=sys.stderr)
if len(sys.argv) < 3:
print("Usage: process_mz_query.py dump_file[.gz] query_file")
exit(0)
my_print("Readi... | alexandrovteam/pyImagingMSpec | pyImagingMSpec/scripts/process_mz_query.py | Python | apache-2.0 | 1,468 |
# Copyright 2013 NTT Data
# 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 appl... | sebrandon1/tempest | tempest/api/compute/admin/test_security_groups.py | Python | apache-2.0 | 3,588 |
# -*- coding:utf-8 -*-
# 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 ... | mjwtom/swift | test/unit/obj/test_diskfile.py | Python | apache-2.0 | 221,579 |
from .Beta import *
from .Unit import *
#import warnings
#warnings.warn("This __init__.py is deprecated. Pysnptools includes newer version", DeprecationWarning)
def factory(s):
s = s.capitalize()
if s == "Unit" or s=="Unit()":
return Unit()
if s=="Beta":
return Beta()
i... | MicrosoftGenomics/FaST-LMM | fastlmm/util/standardizer/__init__.py | Python | apache-2.0 | 2,365 |
"""HTTP views to interact with the entity registry."""
import voluptuous as vol
from homeassistant.components import websocket_api
from homeassistant.components.websocket_api.const import ERR_NOT_FOUND
from homeassistant.components.websocket_api.decorators import (
async_response,
require_admin,
)
from homeass... | leppa/home-assistant | homeassistant/components/config/entity_registry.py | Python | apache-2.0 | 4,820 |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
"""Tests for FileReporters"""
import os
import sys
from coverage.plugin import FileReporter
from coverage.python import PythonFileReporter
from tests.coveragetes... | jayhetee/coveragepy | tests/test_filereporter.py | Python | apache-2.0 | 4,402 |
# Copyright 2016 Brian Innes
#
# 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, ... | brianinnes/vPiP | python/test2.py | Python | apache-2.0 | 1,586 |
# 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 u... | argv0/cloudstack | tools/test/apisession.py | Python | apache-2.0 | 2,419 |
from pych.extern import Chapel
import os.path
currentloc = os.path.dirname(os.path.realpath(__file__))
# Don't have a way to specify where the Chapel module arbitraryfile would live
# The intention seems to be the addition of an argument lib to @Chapel
@Chapel(module_dirs=[os.path.join(currentloc + '/sfiles/chapel/')... | chapel-lang/pychapel | docs/source/examples/test_inline_arbitrary_chapel.py | Python | apache-2.0 | 1,131 |
# Copyright (C) 2013-2014 Computer Sciences Corporation
#
# 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 a... | ezbake/ezbake-common-python | configuration/lib/tests/testThriftConfiguration.py | Python | apache-2.0 | 1,434 |
import requests
import os
from multiprocessing import Pool, Queue, Manager
from flask import Flask, url_for, render_template, json
app = Flask(__name__)
API_KEY=YOUR_API_KEY
def get_image(resource, entity, article, queue):
try:
i_get_url = 'http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbped... | a25patel/whos-in-the-news | newsApp.py | Python | apache-2.0 | 2,605 |
# Copyright 2014 Cloudera 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... | mariusvniekerk/impyla | impala/dbapi/beeswax.py | Python | apache-2.0 | 9,904 |
from django.template.defaultfilters import slugify
from factory import DjangoModelFactory, lazy_attribute
from workflow.models import ROLE_PROGRAM_ADMIN
class User(DjangoModelFactory):
class Meta:
model = 'auth.User'
django_get_or_create = ('username',)
first_name = 'Thom'
last_name = 'Y... | toladata/TolaActivity | factories/django_models.py | Python | apache-2.0 | 848 |
# Copyright 2015 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, s... | tseaver/google-cloud-python | bigtable/tests/unit/test_instance.py | Python | apache-2.0 | 37,126 |
# -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, 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 requi... | huntxu/fuel-web | nailgun/nailgun/test/unit/test_version_handler.py | Python | apache-2.0 | 1,730 |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import RadioButtons
t = np.arange(0.0, 2.0, 0.01)
s0 = np.sin(2*np.pi*t)
s1 = np.sin(4*np.pi*t)
s2 = np.sin(8*np.pi*t)
fig = plt.figure(1)
rax = plt.subplot2grid((1,1), (0,0))
radio = RadioButtons(rax, ('2 Hz', '4 Hz', '8 Hz', 'Clear'))
def... | cduff4464/2016_summer_XPD | out_of_date/matplotlib_demo/Open_New_Plot_Demo.py | Python | bsd-2-clause | 646 |
# Import analysis/plotting modules
import analysis.event
import analysis.hitfinding
import analysis.pixel_detector
import analysis.sizing
import plotting.image
import plotting.line
import plotting.correlation
import plotting.histogram
from backend.record import add_record
import numpy as np
import time
import ipc
impor... | FXIhub/hummingbird | examples/flash/holo-2017/conf_tof.py | Python | bsd-2-clause | 6,533 |
from unittest import TestCase
import pytest
from cymbology.validation import val_check_digit, length_error_message
from cymbology import Isin, Cusip, Sedol
from cymbology.exceptions import (InvalidCharacterError, CheckDigitError, CheckSumError,
CountryCodeError, LengthError, NullErro... | pmart123/security_id | tests/test_validation.py | Python | bsd-2-clause | 5,859 |
# -*- coding: utf-8 -*-
import pytest
from gmaps import errors
from gmaps import Geocoding
from .testutils import retry
geocoding = Geocoding(sensor=False)
@retry
def test_geocode():
results = geocoding.geocode(u"Wrocław, Hubska")
assert results
assert len(results) > 0
@retry
def test_geocode_override... | swistakm/python-gmaps | tests/test_geocoding.py | Python | bsd-2-clause | 3,380 |
# -*- coding: utf-8 -*-
from .context import sample
import unittest
class AdvancedTestSuite(unittest.TestCase):
"""Advanced test cases."""
def test_thoughts(self):
self.assertIsNone(sample.main())
if __name__ == '__main__':
unittest.main()
| azafred/skeletor | tests/test_advanced.py | Python | bsd-2-clause | 267 |
import os
from ast import literal_eval
from datetime import datetime
from django.conf import settings
from django.contrib import auth, messages
from django.contrib.auth.models import User
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.models import Site
from django.core.except... | safwanrahman/kitsune | kitsune/users/views.py | Python | bsd-3-clause | 28,388 |
"""Feed to Zinnia command module"""
import os
import sys
from urllib2 import urlopen
from datetime import datetime
from optparse import make_option
from django.conf import settings
from django.utils import timezone
from django.core.files import File
from django.utils.text import Truncator
from django.utils.html import... | westinedu/similarinterest | zinnia/management/commands/feed2zinnia.py | Python | bsd-3-clause | 7,134 |
# -*- coding: utf8 -*-
"""Autogenerated file - DO NOT EDIT
If you spot a bug, please report it on the mailing list and/or change the generator."""
from nipype.interfaces.base import CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, Directory, traits, isdefined, InputMultiPath, OutputMultiPath
i... | wanderine/nipype | nipype/interfaces/semtools/segmentation/specialized.py | Python | bsd-3-clause | 35,561 |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
import olympia.core.logger
from olympia import amo
from olympia.addons.models import Addon
from olympia.amo.utils import chunked
from olympia.reviewers.utils import ReviewHelper
log = olympia.core.logger.getLogger('z.addons')
... | aviarypl/mozilla-l10n-addons-server | src/olympia/addons/management/commands/approve_addons.py | Python | bsd-3-clause | 3,058 |
import csv
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
UCSD = 'UCSD'
BUCKETS = [0.1, 0.2, 1.0, 10.0, 60.0 ] # range(500, 3001, 500)
COLORS=['#90B0D4', '#90D492', '#D4B490', '#D490D2']
#COLORS=['#348ABD', '#7A68A6', '#A60628', '#467821', '#CF4457', '#188487', '#E24A33']
SAFE = ['S', 'T']
SAFE... | ucsd-progsys/nanomaly | paper/icfp16-cameraready/plots.py | Python | bsd-3-clause | 12,754 |
# -*- coding: utf-8 -*-
import os
from django.conf import settings
from django.core.management.base import BaseCommand
from django.http import HttpRequest
from django.utils import translation
from django.utils.encoding import force_text
from django.views.i18n import javascript_catalog
class Command(BaseCommand):
... | aviarypl/mozilla-l10n-addons-server | src/olympia/amo/management/commands/generate_jsi18n_files.py | Python | bsd-3-clause | 909 |
import pytest
from pybind11_tests import ConstructorStats
def test_smart_ptr(capture):
# Object1
from pybind11_tests import (MyObject1, make_object_1, make_object_2,
print_object_1, print_object_2, print_object_3, print_object_4)
for i, o in enumerate([make_object_1(), mak... | gedare/gem5 | ext/pybind11/tests/test_smart_ptr.py | Python | bsd-3-clause | 7,322 |
from survey.management.commands.import_location import Command
__all__ = [''] | antsmc2/mics | survey/management/commands/__init__.py | Python | bsd-3-clause | 77 |
from __future__ import absolute_import
import six
from collections import defaultdict
from django.conf import settings
from sentry.app import env
from sentry.api.serializers import Serializer, register
from sentry.models import AuthIdentity, Authenticator, User, UserAvatar, UserOption
from sentry.utils.avatar import... | alexm92/sentry | src/sentry/api/serializers/models/user.py | Python | bsd-3-clause | 4,943 |
from __future__ import absolute_import
from __future__ import print_function
from copy import deepcopy
from six.moves import range
def get_formulae(mass,tol=5,charge=0,tol_type='ppm',max_tests=1e7,
min_h=0,max_h=200,
min_c=0,max_c=200,
min_n=0,max_n=6,
min_o=0,max_o=20,
min_p=0,max_p=4,
min_s=0,max_s=4,
min_na=0... | metabolite-atlas/metatlas | metatlas/tools/formula_generator.py | Python | bsd-3-clause | 4,342 |
#!/usr/bin/env python
"""
This script is a python version of TimingAccuracyDHC. We use numpy functions to
simplify the creation of random coefficients.
"""
import os
import sys
import time
import numpy as np
sys.path.append(os.path.join(os.path.dirname(__file__), "../../.."))
import pyshtools as shtools
#==== MAIN F... | ian-r-rose/SHTOOLS | examples/python/TimingAccuracy/TimingAccuracyDHC.py | Python | bsd-3-clause | 2,509 |
from __future__ import division
import warnings
import numpy as np
from menpo.feature import no_op
from menpo.visualize import print_dynamic
from menpo.model import PCAModel
from menpo.transform import Scale
from menpo.shape import mean_pointcloud
from menpo.base import name_of_callable
from menpofit import checks
fr... | yuxiang-zhou/menpofit | menpofit/aam/base.py | Python | bsd-3-clause | 66,618 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from .ufuncs import *
from .reduction import * | zeeshanali/blaze | blaze/compute/ops/__init__.py | Python | bsd-3-clause | 136 |
class PublishService():
def __init__(self, providers, experiment):
self.rc_providers = providers
self.experiment = experiment
self.provider = self._get_provider()
def _get_provider(self):
from tardis.tardis_portal.publish.provider.rifcsprovider import RifCsProvider... | steveandroulakis/mytardis | tardis/tardis_portal/publish/publishservice.py | Python | bsd-3-clause | 2,367 |
import unittest
class TestLogTrace(unittest.TestCase):
def test_log_trace(self):
# self.assertEqual(expected, log_trace(errmsg))
assert True # TODO: implement your test here
class TestLogErrmsg(unittest.TestCase):
def test_log_errmsg(self):
# self.assertEqual(expected, log_errmsg(errms... | GhostshipSoftware/avaloria | src/tests/test_utils_logger.py | Python | bsd-3-clause | 979 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for the command-line scripts in the top-level I{bin/} directory.
Tests for actual functionality belong elsewhere, written in a way that doesn't
involve launching child processes.
"""
from os import devnull, getcwd, chdir
fro... | hlzz/dotfiles | graphics/VTK-7.0.0/ThirdParty/Twisted/twisted/scripts/test/test_scripts.py | Python | bsd-3-clause | 6,855 |
import json
import os
import math
import pytest
def calculate_max_velocity(**kwargs):
"""
Calculate the maximum velocity the ADCP can measure including the boat speed in m/s. This speed is the
speed the ADCP is capable of measuring, if the speed exceeds this value, then the data will be incorrect
due... | ricorx7/rti_python | ADCP/Predictor/MaxVelocity.py | Python | bsd-3-clause | 6,635 |
"""
Goal: Define the routes for general pages
@authors:
Andrei Sura <sura.andrei@gmail.com>
Ruchi Vivek Desai <ruchivdesai@gmail.com>
Sanath Pasumarthy <sanath@ufl.edu>
@see https://flask-login.readthedocs.org/en/latest/
@see https://pythonhosted.org/Flask-Principal/
"""
import hashlib... | ctsit/barebones-flask-app | app/routes/pages.py | Python | bsd-3-clause | 11,826 |
from django.template.loader import render_to_string
from django.utils.importlib import import_module
from pressgang.actions.options import Option, Options
from pressgang.utils.registry import create_registry
SiteOptionRegistry = create_registry('id')
class SiteOption(Option):
"""Base class for a single site option... | oberlin/pressgang | pressgang/actions/options/site/__init__.py | Python | bsd-3-clause | 2,352 |
#
# Copyright (c) 2009, Novartis Institutes for BioMedical Research 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 copyri... | rdkit/rdkit-orig | Contrib/LEF/ClusterFps.py | Python | bsd-3-clause | 2,812 |
from pylab import *;
import RungeKutta;
def dummy(t, f, args):
return zeros(f.shape);
def dummyVel(f, args):
return 1.3;
u = zeros((10,10));
v = zeros((10,10));
z = zeros((10,10));
delta = 0.1;
stepfwd = RungeKutta.RungeKutta4(delta, dummy, dummy, dummyVel);
tnew, fnew = stepfwd.integrate(0, [u,v,z],0.... | JoyMonteiro/parSpectral | pspec/testIntegrator.py | Python | bsd-3-clause | 337 |
from django.test import SimpleTestCase
from corehq.apps.app_manager.models import _parse_xml
import os
class XMLParsingTest(SimpleTestCase):
def testUnicodeError(self):
"""Tests a bug found in Unicode processing of a form"""
file_path = os.path.join(os.path.dirname(__file__), "data", "unicode_err... | puttarajubr/commcare-hq | corehq/apps/app_manager/tests/test_xml_parsing.py | Python | bsd-3-clause | 713 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import numpy as np
import pytest
from pandas.compat import product as cart_product, range
from pandas import DataFrame, MultiIndex, Period, Series, Timedelta, Timestamp
from pandas.util.testing import assert_frame_equal, assert_series_equal
class TestCo... | GuessWhoSamFoo/pandas | pandas/tests/groupby/test_counting.py | Python | bsd-3-clause | 7,838 |
import foauth.providers
def draft10(service, token, r):
headers = r.headers or {}
headers[u'Authorization'] = u'OAuth %s' % token
r.headers = headers
return r
class DeviantArt(foauth.providers.OAuth2):
# General info about the provider
provider_url = 'http://deviantart.com/'
docs_url = '... | foauth/oauth-proxy | services/deviantart.py | Python | bsd-3-clause | 863 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from click.testing import CliRunner
from BioCompass import cli
def test_importcli():
runner = CliRunner()
result = runner.invoke(cli.main)
assert result.exit_code == 0
#assert 'BioCompass.cli.main' in result.output
help_result = runner.invoke(c... | tiagolbiotech/BioCompass | BioCompass/tests/test_BioCompass.py | Python | bsd-3-clause | 1,027 |
"""
Different implementations of the ``./setup.py test`` command depending on
what's locally available.
If Astropy v1.1 or later is available it should be possible to import
AstropyTest from ``astropy.tests.command``. Otherwise there is a skeleton
implementation that allows users to at least discover the ``./setup.py ... | astropy/astropy-helpers | astropy_helpers/commands/test.py | Python | bsd-3-clause | 1,466 |
# Time: O(n)
# Space: O(1)
#
# The API: int read4(char *buf) reads 4 characters at a time from a file.
#
# The return value is the actual number of characters read. For example, it returns 3 if there is only 3 characters left in the file.
#
# By using the read4 API, implement the function int read(char *buf, int n) ... | yiwen-luo/LeetCode | Python/read-n-characters-given-read4-ii-call-multiple-times.py | Python | mit | 1,921 |
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2016-04-20 23:24:08
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2016-04-21 00:08:03
import string
def choose(list, a, b):
for x in list:
if x != a and x != b:
return x
def solve(s):
for i in xrange(0, len(s), 1a):
... | zeyuanxy/code-forces | contest/665/C.py | Python | mit | 688 |
from __future__ import unicode_literals
from django.utils import six
from reviewboard.attachments.models import FileAttachment
from reviewboard.webapi.base import WebAPIResource
class BaseFileAttachmentResource(WebAPIResource):
"""A base resource representing file attachments."""
added_in = '1.6'
model... | sgallagher/reviewboard | reviewboard/webapi/resources/base_file_attachment.py | Python | mit | 2,246 |
from .. import InstanceResource, ListResource
class IpAccessControlListMapping(InstanceResource):
def delete(self):
"""
Remove this mapping (disassociate the ACL from the Domain).
"""
return self.parent.delete_instance(self.name)
class IpAccessControlListMappings(ListResource):
... | danielvdao/facebookMacBot | venv/lib/python2.7/site-packages/twilio/rest/resources/sip/domains.py | Python | mit | 5,827 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" A script to manage development tasks """
from __future__ import (
absolute_import, division, print_function, with_statement,
unicode_literals)
from os import path as p
from manager import Manager
from subprocess import call
manager = Manager()
_basedir = p.d... | reubano/ckanutils | manage.py | Python | mit | 2,296 |
#!/usr/bin/env python
#---coding=utf8---
from HomeHandler import HomeHandler
from LoginHandler import LoginHandler
from LogoutHandler import LogoutHandler
from ArchivesHandler import ArchivesHandler
from CategoryHandler import CategoryHandler
from TagHandler import TagHandler
from PageHandler import PageHandler
from Se... | grepcook/blog | blog/handlers.py | Python | mit | 1,071 |
# coding=utf-8
"""
Diamond collector that monitors relevant MySQL performance_schema values
For now only monitors replication load
[Blog](http://bit.ly/PbSkbN) announcement.
[Snippet](http://bit.ly/SHwYhT) to build example graph.
#### Dependencies
* MySQLdb
* MySQL 5.5.3+
"""
from __future__ import division
... | MichaelDoyle/Diamond | src/collectors/mysqlstat/mysql55.py | Python | mit | 8,223 |
# redis-import-set
import sys
from csv import reader
from itertools import count, groupby, islice
import redis
if __name__ == '__main__':
r = redis.Redis()
pipeline_redis = r.pipeline()
count = 0
try:
keyname = sys.argv[1]
except IndexError:
raise Exception("You must specify the... | unbracketed/RedLine | redline/examples/redis-import-set_groupby.py | Python | mit | 554 |
#
# Copyright (C) 2010-2017 Samuel Abels
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy,... | maximumG/exscript | Exscript/interpreter/__init__.py | Python | mit | 1,329 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-mgmt-web/azure/mgmt/web/models/network_access_control_entry.py | Python | mit | 1,490 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class QuotesbotPipeline(object):
def process_item(self, item, spider):
return item
| thetypist/scrappybot | quotesbot/pipelines.py | Python | mit | 289 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from indico.util.i18n import _
from indico.web.breadcrumbs import render_breadcrumbs
from indico.web.flask... | pferreir/indico | indico/modules/admin/views.py | Python | mit | 1,087 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file was generated with PyScaffold 3.0.2.
PyScaffold helps you to put up the scaffold of your new Python project.
Learn more under: http://pyscaffold.org/
"""
import sys
from setuptools import setup
import versioneer
# Add here console scripts and oth... | theQRL/QRL | setup.py | Python | mit | 1,072 |
from django.conf.urls import *
from apps.profile import views
urlpatterns = patterns('',
url(r'^get_preferences?/?', views.get_preference),
url(r'^set_preference/?', views.set_preference),
url(r'^set_account_settings/?', views.set_account_settings),
url(r'^get_view_setting/?', views.get_view_setting),
... | mihaip/NewsBlur | apps/profile/urls.py | Python | mit | 2,216 |
import scipy.io
from sklearn.metrics import accuracy_score
from sklearn import cross_validation
from sklearn import svm
from skfeature.function.information_theoretical_based import CMIM
def main():
# load data
mat = scipy.io.loadmat('../data/colon.mat')
X = mat['X'] # data
X = X.astype(float)
y... | jundongl/scikit-feast | skfeature/example/test_CMIM.py | Python | gpl-2.0 | 1,485 |
# -*- coding: utf-8 -*-
#
# This file is part of JSONAlchemy.
# Copyright (C) 2013, 2014, 2015 CERN.
#
# JSONAlchemy 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 yo... | tiborsimko/jsonalchemy | jsonalchemy/jsonext/functions/util_split.py | Python | gpl-2.0 | 1,313 |
from .crud_helper import CrudHelper
class TestEventType(CrudHelper):
def test_permissions(self, app, db_session):
CrudHelper.test_permissions(self, app, db_session, dont_get_pages='view')
def test_view(self):
pass # No view page, block crud helper
| zookeepr/zookeepr | zkpylons/tests/functional/test_event_type.py | Python | gpl-2.0 | 274 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio 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
## Licens... | lnielsen/invenio | invenio/legacy/external_authentication/sso.py | Python | gpl-2.0 | 8,392 |
from django.views.generic import TemplateView
from regions.views import RegionMixin
from pages.models import Page, slugify
from .models import Link
class LinksForPageView(RegionMixin, TemplateView):
template_name = 'links/links_for_page.html'
def get_context_data(self, *args, **kwargs):
context = s... | evangeline97/localwiki-backend-server | localwiki/links/views.py | Python | gpl-2.0 | 942 |
import os
from enigma import eEPGCache, getBestPlayableServiceReference, eStreamServer, eServiceReference, iRecordableService, quitMainloop, eActionMap, setPreferredTuner
from Components.config import config
from Components.UsageConfig import defaultMoviePath
from Components.SystemInfo import SystemInfo
from Component... | openNSS/enigma2 | RecordTimer.py | Python | gpl-2.0 | 54,247 |
# Copyright 2001 by Gavin E. Crooks. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
# Gavin E. Crooks 2001-10-10
"""ASTRAL RAF (Rapid Access Format) Sequence Maps.
The ASTRAL... | BlogomaticProject/Blogomatic | opt/blog-o-matic/usr/lib/python/Bio/SCOP/Raf.py | Python | gpl-2.0 | 12,101 |
# -*- coding: UTF-8 -*-
__revision__ = '$Id$'
# Copyright (c) 2011 Ivo Nunes
#
# 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 ... | santiavenda2/griffith | lib/plugins/movie/PluginMovieIMDB-pt.py | Python | gpl-2.0 | 7,570 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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;... | majorcs/fail2ban | fail2ban/tests/fail2banregextestcase.py | Python | gpl-2.0 | 6,546 |
# Xlib.ext.xfixes -- XFIXES extension module
#
# Copyright (C) 2010-2011 Outpost Embedded, LLC
# Forest Bond <forest.bond@rapidrollout.com>
#
# 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 F... | cristian99garcia/xjoy | xevents/Xlib/ext/xfixes.py | Python | gpl-3.0 | 2,944 |
# -*- coding: utf-8 -*-
# This file is part of CairoSVG
# Copyright © 2010-2012 Kozea
#
# 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 3 of the License, or (at your option... | aESeguridad/GERE | venv/lib/python2.7/site-packages/cairosvg/surface/image.py | Python | gpl-3.0 | 5,593 |
#!/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)
# ... | tyc85/nwsdr-3.6.3-dsc | gr-analog/python/qa_rail_ff.py | Python | gpl-3.0 | 2,038 |
from ase import *
from gpaw import *
atoms = Atoms('H')
atoms.center(vacuum=4.)
params = dict(h=.3, convergence=dict(density=.005, eigenstates=1e-6))
# No magmom, no hund
atoms.set_calculator(GPAW(**params))
E_nom_noh = atoms.get_potential_energy()
assert np.all(atoms.get_magnetic_moments() == 0.)
assert atoms.calc.... | qsnake/gpaw | oldtest/hund.py | Python | gpl-3.0 | 1,082 |
# Copyright 2013 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 ... | GirlsCodePy/girlscode-coursebuilder | modules/search/search.py | Python | gpl-3.0 | 20,482 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.