code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
"""
Generalized Linear Models with Exponential Dispersion Family
"""
# Author: Christian Lorentzen <lorentzen.ch@googlemail.com>
# some parts and tricks stolen from other sklearn files.
# License: BSD 3 clause
import numbers
import numpy as np
import scipy.optimize
from ...base import BaseEstimator, RegressorMixin
... | ogrisel/scikit-learn | sklearn/linear_model/_glm/glm.py | Python | bsd-3-clause | 25,041 |
# Copyright (c) 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 required by applicable law or agreed to in writ... | rnirmal/savanna | savanna/middleware/auth_valid.py | Python | apache-2.0 | 2,332 |
from cassandra.query import SimpleStatement
from nose.plugins.attrib import attr
from dtest import TRACE, Tester, debug, create_ks
from tools.decorators import no_vnodes
@no_vnodes()
class TestPendingRangeMovements(Tester):
@attr('resource-intensive')
def pending_range_test(self):
"""
@jira_... | krummas/cassandra-dtest | pending_range_test.py | Python | apache-2.0 | 2,722 |
import unittest
from pathlib import Path
import DnD.modules.lib.interface as iface
import DnD.modules.lib.spellcastingLib as cast
from DnD.modules.lib.settingsLib import RestLength
iface.JsonInterface.OBJECTSPATH = Path('DnD/objects')
class MockCharacter:
def __init__(self, classes):
self.classes = clas... | the-nick-of-time/DnD | tests/test_spellcasting.py | Python | gpl-2.0 | 3,173 |
import time
import socket
import threading
import traceback
from pyroute2.common import basestring
from pyroute2.common import dqn2int
from pyroute2.netlink import NetlinkError
from pyroute2.netlink.rtnl.req import IPLinkRequest
from pyroute2.netlink.rtnl.ifinfmsg import IFF_MASK
from pyroute2.netlink.rtnl.ifinfmsg imp... | alexliyu/CDMSYSTEM | pyroute2/ipdb/interface.py | Python | mit | 25,356 |
##==============================================================#
## SECTION: Imports #
##==============================================================#
from testlib import *
import auxly
from auxly.filesys import cwd, isempty, makedirs, move
##===========================... | jeffrimko/Auxly | tests/filesys_test_4.py | Python | mit | 5,636 |
#! /usr/bin/python
import datetime
import logging
import select
import socket
import time
from fix_protocol import FixParser, FixMessage, print_fix
logging.basicConfig(level=logging.DEBUG)
class Session(object):
def __init__(self, sock, addr):
self._socket = sock
self._address = addr
... | da4089/exsim | exsim/fix.py | Python | gpl-3.0 | 7,196 |
import socket
import time
from marvin.cloudstackAPI import (
stopRouter,
destroyRouter
)
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.base import (
PublicIPAddress,
VirtualMachine,
Network,
NetworkACL,
NATRule,
VPC,
Account
)
from marvin.lib.common import ... | MissionCriticalCloud/cosmic | cosmic-core/test/integration/smoke/test_vpc_ip_tables_policies.py | Python | apache-2.0 | 11,682 |
# -*- coding: utf-8 -*-
############################################################
#from django.db import models
#from django.conf import settings
# Testing multiple database routing..
"""
############################################################
class ReanalyseRouter(object):
"""A router to control all databas... | medialab/reanalyse | reanalyseapp/databases.py | Python | lgpl-3.0 | 1,824 |
import unittest
import re
from _query_generator import Evaluator
def clean_query(query_to_clean):
''' Helper function to clean query template from line endings and consuctive whitespaces '''
query_to_clean = query_to_clean.replace('\n',' ')
query_to_clean = re.sub(r'\s+',' ', query_to_clean)
query_to_... | andreashuebner/sqltester | sqltester/tests/test_query_generator.py | Python | mit | 20,316 |
# Copyright 2012-2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ac... | mnahm5/django-estore | Lib/site-packages/awscli/customizations/cloudtrail/utils.py | Python | mit | 1,224 |
# Python - 2.7.6
Test.describe('Basic tests')
Test.assert_equals(monkey_count(5), [1, 2, 3, 4, 5])
Test.assert_equals(monkey_count(3), [1, 2, 3])
Test.assert_equals(monkey_count(9), [1, 2, 3, 4, 5, 6, 7, 8, 9])
Test.assert_equals(monkey_count(10), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
Test.assert_equals(monkey_count(20), [... | RevansChen/online-judge | Codewars/8kyu/count-the-monkeys/Python/test.py | Python | mit | 392 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ConvertLead
# Converts a lead to a potential, account, or contact in your Zoho CRM account.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (t... | jordanemedlock/psychtruths | temboo/core/Library/Zoho/CRM/ConvertLead.py | Python | apache-2.0 | 6,692 |
# ECB wrapper skeleton file for 50.020 Security
# Oka, SUTD, 2014
from present import *
import argparse
nokeybits=80
blocksize=64
def ecb(infile,outfile,keyfile,mode):
key = 0x0
with open(keyfile, 'rb') as fkey:
for i in range(nokeybits / 8):
key |= ord(fkey.read(1)) << i * 8
with ope... | LYZhelloworld/Courses | 50.020/08/ecb.py | Python | mit | 1,521 |
# 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... | lym/allura-git | Allura/allura/model/filesystem.py | Python | apache-2.0 | 6,878 |
from paver.easy import task, needs, path, sh, cmdopts, options
from paver.setuputils import setup
import os
import sys
# add the current directory as the first listing on the python path
# so that we import the correct version.py
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
import version
setup(na... | Lucaszw/jupyter-helpers | pavement.py | Python | bsd-3-clause | 1,109 |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Tests ensuring codebase style compliance for Rust."""
from framework import utils
def test_rust_style():
"""
Test that rust code passes style checks.
@type: style
"""
# Check that t... | firecracker-microvm/firecracker | tests/integration_tests/style/test_rust.py | Python | apache-2.0 | 1,748 |
import numpy as np, resource, sys
from operator import itemgetter
sys.setrecursionlimit(1500)
resource.setrlimit(resource.RLIMIT_STACK, [0x10000000, resource.RLIM_INFINITY])
sys.setrecursionlimit(0x100000)
class TreeNode(object):
"""MCTS agacindaki bir dugum. Her dugum kendi Q degerini, onceki
olasiligi P'yi,... | burakbayramli/classnotes | algs/algs_055_go/mcts.py | Python | gpl-3.0 | 6,162 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('django_th', '0004_rss_uuid_remove_uuid_nu... | foxmask/django-th | django_th/migrations/0005_userservice_altered.py | Python | bsd-3-clause | 1,572 |
import scipy
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import _delaunay_d_python as _delaunayd
def plot_triang_2d(triang, title=None, show_concave=False):
fig = plt.figure()
ax = Axes3D(fig)
(all_segments, min_coords, max_coords) = triang.get_line_segments()
for segment in all_segm... | rncarpio/delaunay_linterp | delaunay_d_test.py | Python | gpl-3.0 | 1,216 |
import os.path
import tables
from numpy import isnan
from sapphire import CoincidenceQuery
DATASTORE = "/Users/arne/Datastore/check_reconstructions"
def analyse_reconstructions(data):
cq = CoincidenceQuery(data)
total_count = cq.reconstructions.nrows
succesful_direction = sum(~isnan(cq.reconstructions... | HiSPARC/topaz | 160307_check_reconstructions/analyse_reconstructions.py | Python | gpl-3.0 | 1,130 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('taskManager', '0016_auto_20141227_0256'),
]
operations = [
migrations.RemoveField(
model_name='task',
... | nVisium/django.nV | taskManager/migrations/0017_auto_20141227_0427.py | Python | gpl-2.0 | 556 |
"""TestSuite"""
import sys
import unittest
from django.utils.unittest import case, util
__unittest = True
class BaseTestSuite(unittest.TestSuite):
"""A simple test suite that doesn't provide class or module shared fixtures.
"""
def __init__(self, tests=()):
self._tests = []
self.addTests... | sam-tsai/django-old | django/utils/unittest/suite.py | Python | bsd-3-clause | 9,426 |
# -*- coding: utf-8 -*-
import datetime
def date_context_processor(request):
return {
"TODAY": datetime.date.today(),
"NOW": datetime.datetime.now()
} | arkanister/minitickets | lib/utils/context_processors.py | Python | apache-2.0 | 176 |
import argparse
import re
def process_qasm(fname):
qgates = ['H','X','CNOT','Y','Z','S','T','Tdag','Sdag','Rz','PrepX','PrepZ','MeasX','MeasZ','Toffoli','Fredkin']
qgates_1 = ['H','X','Y','Z','S','T','Tdag']
qgates_1a = ['Sdag']
qgates_2 = ['CNOT']
qgates_3 = ['Toffoli','Fredkin']
qga... | ajavadia/ScaffCC | scaffold/flatten-qasm.py | Python | bsd-2-clause | 8,016 |
import csv
import matplotlib.pyplot as plt
import numpy as np
from os import listdir
directory='/media/aashish/0C0091CC0091BCE0/BLUED-D1-1/events'
files=listdir(directory)
count=0
completed=False
while(completed==False):
try:
for f in files:
plt.close('all')
print(count,f)
... | aashish-jain/BLUED-events | plot_ipeak.py | Python | unlicense | 1,306 |
"""Test class for UserGroup UI
:Requirement: Usergroup
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: UsersRoles
:Assignee: sganar
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import pytest
from fauxfactory import gen_string
from fauxfactory import gen_utf8
from nailgun impor... | SatelliteQE/robottelo | tests/foreman/ui/test_usergroup.py | Python | gpl-3.0 | 3,040 |
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from string import Template
import time
from itertools import izip
from sql import Flavor
from ..model import ModelView, ModelSQL, fields, Check
from ..tools import datetime_s... | kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/ir/sequence.py | Python | gpl-3.0 | 13,562 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Partially based on AboutMethods in the Ruby Koans
#
from runner.koan import *
def my_global_function(a,b):
return a + b
class AboutMethods(Koan):
def test_calling_a_global_function(self):
self.assertEqual(5, my_global_function(2,3))
# NOTE: Wron... | dewaka/python-koans | python3/koans/about_methods.py | Python | mit | 5,446 |
# Copyright (c) 2015. Mount Sinai School of Medicine
#
# 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... | hammerlab/varcode | test/test_dbnsfp_validation.py | Python | apache-2.0 | 3,483 |
# -*- coding: utf-8 -*-
# Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.
# The Sudoku board could be partially filled, where empty cells are filled with the character '.'.
# A partially filled sudoku which is valid.
# Note:
# A valid Sudoku board (partially filled) is not necessarily sol... | pengkobe/leetcode | questions/Valid_Sudoku.py | Python | gpl-3.0 | 1,179 |
# coding=utf-8
Version = "0.2.0"
Description = "LOTRO/DDO Launcher"
Author = "Alan Jackson"
Email = "ajackson@bcs.org.uk"
WebSite = "http://www.lotrolinux.com"
LongDescription = "Lord of the Rings Online and Dungeons & Dragons Online\nLauncher for Linux & Mac OS X"
Copyright=" (C) 2009-2010 AJackson"
CLIReference = ... | Lynx3d/pylotro | PyLotROLauncher/Information.py | Python | gpl-3.0 | 441 |
# Copyright 2015, Ansible, Inc.
# Luke Sneeringer <lsneeringer@ansible.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | jangsutsr/tower-cli | tests/test_commands_version.py | Python | apache-2.0 | 2,116 |
#-*- coding:utf-8 -*-
#
#
# Copyright (C) 2011,2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# 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,... | bwrsandman/openerp-hr | hr_security/__openerp__.py | Python | agpl-3.0 | 1,476 |
from suggest import suggest
from hypothesis import given
from hypothesis.strategies import text, integers
import re
import string
def check(repository, s):
# We expect the suggestions to be like
# T - 1, T - 123, Ti - 1234, user1 - 123, etc.
pat = re.compile('\S+ - \d+')
return pat.match(s) and s not i... | amitsaha/learning | python/unique_suggestion/test_suggest_unique.py | Python | unlicense | 1,317 |
# Copyright (c) 2012 Citrix Systems, 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 ... | SUSE-Cloud/nova | nova/tests/api/openstack/compute/contrib/test_aggregates.py | Python | apache-2.0 | 18,885 |
# -*- coding: utf-8 -*-
"""
urlresolver XBMC Addon
Copyright (C) 2016 tknorris
Derived from Shani's LPro Code (https://github.com/Shani-08/ShaniXBMCWork2/blob/master/plugin.video.live.streamspro/unCaptcha.py)
This program is free software: you can redistribute it and/or modify
it under the terms of... | azumimuo/family-xbmc-addon | script.mrknow.urlresolver/lib/urlresolver9/plugins/lib/recaptcha_v2.py | Python | gpl-2.0 | 7,531 |
from django.conf.urls import url
from . import views
from .views.discount import remove_voucher_view
checkout_urlpatterns = [
url(r'^$', views.checkout_index, name='index'),
url(r'^start$', views.checkout_start, name='start'),
url(r'^update/(?P<variant_id>\d+)/$',
views.update_checkout_line, name=... | UITools/saleor | saleor/checkout/urls.py | Python | bsd-3-clause | 953 |
"""
Utility functions for the UEA multivariate time series classification
archive.
"""
# Author: Johann Faouzi <johann.faouzi@gmail.com>
# License: BSD-3-Clause
import numpy as np
import os
import pickle
from scipy.io.arff import loadarff
from sklearn.utils import Bunch
from urllib.request import urlretrieve
import z... | johannfaouzi/pyts | pyts/datasets/uea.py | Python | bsd-3-clause | 9,597 |
import sys
from platform_detect import PlatformDetect
def parse():
tPlatform = PlatformDetect()
tPlatform.detect()
argc = len(sys.argv)
if argc == 1:
# No platform was specified on the command line.
strJonchkiDistributionID = tPlatform.strHostDistributionId
strJonchkiDistribut... | muhkuh-sys/org.muhkuh.tests-iomatrix | jonchki/cli_args.py | Python | gpl-2.0 | 3,209 |
# Copyright 2005-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import logging
import subprocess
import portage
from portage import os
from portage.util import writemsg_level
from portage.output import create_color_func
good = create_color_func("GOOD")
bad = create_color_fun... | gmt/portage | pym/portage/sync/modules/git/git.py | Python | gpl-2.0 | 3,109 |
from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
setup(
name='ploader',
version='0.6.0',
description='A pure cli-based download manager',
long_description=readme(),
url='https://github.com/kpj/PLoader',
author='kpj',
author_email='kpjkpjkpjkpjkpjkpj@gmail.com',
licen... | kpj/PLoader | setup.py | Python | mit | 528 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""bamai URL Configuration
"""
from django.conf.urls import include, url
from center.tools.view import views
urlpatterns = [
url(r'^lock/(\d+)/$', views.tools_lock_views),
url(r'^todo/(\d+)/$', views.tools_todo_views),
] | swxs/web | cloudplat/center/tools/urls.py | Python | mit | 277 |
from django import db
from django.core.management.base import NoArgsCommand
from django.core.exceptions import MultipleObjectsReturned
from data.models import State, Msn, EnergyProductionStateRaw, EnergyProductionState
# National Priorities Project Data Repository
# load_energy_production_state.py
# Created 4/17/2012... | npp/npp-api | data/management/commands/load_energy_production_state.py | Python | mit | 3,075 |
import urllib2
import logging
import os
import re
import string
import types
import glob
import ConfigParser
import StringIO
import commands
from distutils import dir_util # virtualenv problem pylint: disable=E0611
from avocado.utils import process
from avocado.utils import genio
from avocado.utils import crypto
from... | PandaWei/avocado-vt | virttest/asset.py | Python | gpl-2.0 | 21,221 |
# -*- coding: utf-8 -*-
from peewee import *
db = SqliteDatabase('db.db')
class User(Model):
email = CharField(max_length=50)
username = CharField(max_length=25)
password = CharField(max_length=50)
class Meta:
database = db
#db.connect()
#User.create_table() | andreykko/bottle-auth | peewee_db/models.py | Python | mit | 286 |
#!/usr/bin/env python
import os
import csv
import json
output = u''
base_dir = os.path.realpath(os.path.dirname(os.path.dirname(__file__)))
csv_keys = [
'verb',
'impersonalForms',
'presentIndicative',
'imperfectIndicative',
'futureIndicative',
'pastRemoteIndicative',
'pastIndicative',
'... | Sinkler/italian-verbs-trainer | verbs/generate.py | Python | gpl-3.0 | 2,025 |
# -*- coding: utf-8 -*-
"""
Acceptance tests for CMS Video Editor.
"""
from nose.plugins.attrib import attr
from .test_studio_video_module import CMSVideoBaseTest
@attr('shard_2')
class VideoEditorTest(CMSVideoBaseTest):
"""
CMS Video Editor Test Class
"""
def setUp(self):
super(VideoEditorT... | B-MOOC/edx-platform | common/test/acceptance/tests/video/test_studio_video_editor.py | Python | agpl-3.0 | 24,711 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
utility functions and classes
"""
import codecs
import csv
import datetime
# from https://gist.github.com/nzjrs/207624
def humanize_date_difference(now, otherdate=None, offset=None):
if otherdate:
dt = otherdate - now
offset = dt.seconds + (dt.days ... | captnswing/prisinfo | util.py | Python | mit | 2,238 |
import bpy
from fashion_project.modules.draw.points.point_on_the_top import PointOnTheTop
class FP_PointOnTheTop(bpy.types.Operator):
'''
Позволяет строить точку на вершине
прямого угла прямоугольного треугольника
Требует четырех выделенных точек
'''
bl_idname = "fp.point_on_the_top"
bl_label = "FP_Poi... | TriumphLLC/FashionProject | modules/operators/tools/points/point_on_the_top.py | Python | gpl-3.0 | 730 |
#
# GingaQt.py -- Qt display handler for the Ginga reference viewer.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
# stdlib imports
import sys, os
import traceback
im... | eteq/ginga | ginga/qtw/GingaQt.py | Python | bsd-3-clause | 27,414 |
# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()
# Takes a screenshot
# result = device.takeSnapshot()
# Writes the screenshot to a file
... | valarpirai/HobbyProject | samples/clickTest.py | Python | mit | 512 |
from characteristic import Attribute, attributes
from rply.token import BaseBox
from rpython.tool.pairtype import extendabletype
class Node(BaseBox):
# Allows using __extend__ to extend the type
__metaclass__ = extendabletype
@attributes(
[
Attribute(name="operator"),
Attribute(name="lef... | Magnetic/cycy | cycy/parser/ast.py | Python | mit | 7,047 |
# HRGRN WebServices
# Copyright (C) 2016 Xinbin Dai, Irina Belyaeva
# This file is part of HRGRN WebServices API.
#
# HRGRN API 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... | Arabidopsis-Information-Portal/hrgrn_webservices | services/hrgrn_subnetwork_by_locus/gene_info_service.py | Python | gpl-2.0 | 3,219 |
# version code d345910f07ae
coursera = 1
# Please fill out this stencil and submit using the provided submission script.
## 1: (Task 1) Movie Review
## Task 1
from random import randint
def movie_review(name):
"""
Input: the name of a movie
Output: a string (one of the review options), selected at rand... | andrubrown/CodingTheMatrix | inverse_index_lab.py | Python | mit | 2,897 |
# Given a linked list, remove the nth node from the end of list and return its head.
# For example,
# Given linked list: 1->2->3->4->5, and n = 2.
# After removing the second node from the end, the linked list becomes 1->2->3->5.
# Note:
# Given n will always be valid.
# Try to do this in one pass.
# Defin... | abawchen/leetcode | solutions/019_remove_nth_node_from_end_of_list.py | Python | mit | 1,751 |
# -*- coding: utf-8 -*-
# * Authors:
# * TJEBBES Gaston <g.t@majerti.fr>
# * Arezki Feth <f.a@majerti.fr>;
# * Miotte Julien <j.m@majerti.fr>;
def admin_accounting_index_view(request):
menus = []
for label, route, title, icon in (
(u"Retour", "admin_index", "", "fa fa-step-backward")... | CroissanceCommune/autonomie | autonomie/views/admin/accounting/index.py | Python | gpl-3.0 | 1,304 |
"""The tests for the Buienradar sensor platform."""
from homeassistant.components.buienradar.const import DOMAIN
from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE
from homeassistant.helpers.entity_registry import async_get
from tests.common import MockConfigEntry
TEST_LONGITUDE = 51.5288504
TEST_LATITUDE ... | Danielhiversen/home-assistant | tests/components/buienradar/test_sensor.py | Python | apache-2.0 | 1,346 |
#!/usr/bin/env python
#encode=utf-8
#vim: tabstop=4 shiftwidth=4 softtabstop=4
#Created on 2013-8-17
#Copyright 2013 nuoqingyun xuqifeng
import re
from oslo.config import cfg
from glance import manager
from glance.utils import importutils
from glance.glance_agent import rpcapi
rpcapi_opts = [
... | homhei/glance | glance/glance_agent/manager.py | Python | apache-2.0 | 4,607 |
# -*- coding: utf-8 -*-
# <markment - markdown-based documentation generator for python>
# Copyright (C) <2013> Gabriel Falcão <gabriel@nacaolivre.org>
#
# 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 Fou... | grahamc/markment | tests/unit/test_core.py | Python | mit | 2,714 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
"""
WSGI config for a_site project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi... | needle-wang/blog_test | a_site/a_site/wsgi.py | Python | gpl-2.0 | 439 |
from __future__ import with_statement
import logging
import os
import traceback
from django.conf import settings
from django.core.mail import send_mail
from fabric.api import (
cd,
env,
hosts,
run,
)
from fabric.tasks import execute
import celery
from geonode.cephgeo.models import FTPStatus
from ge... | PhilLidar-DAD/geonode | geonode/tasks/ftp.py | Python | gpl-3.0 | 33,810 |
"""
Django settings for hello project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# B... | AlexRiina/django-s3direct | example/example/settings.py | Python | mit | 4,212 |
from email.mime.text import MIMEText
from email.header import Header
from subprocess import Popen, PIPE
from django.utils.encoding import smart_bytes, smart_text
class BogofilterException(Exception):
pass
def make_email_header(header):
if header is None:
header = ''
return Header(header.encode('u... | stefantalpalaru/django-bogofilter | bogofilter/utils.py | Python | bsd-3-clause | 2,274 |
'''
This file contains the basis for a color matching dummy db.
The utility of this file is to give a reference for viewed colors so that the colors viewed by the kinect can be matched to a medication.
author: Grace Chandler
date: 10-26-2015
'''
import sys
#a function will be added here to map RGB values (in a rang... | zimmermegan/smarda | Color_Match.py | Python | mit | 3,852 |
from base64 import b64encode
from zlib import crc32
from hashlib import sha1
def stable_hash(s):
return sum(map(ord, s)) << 32 | (
crc32(s.encode()) & 0xffffffff)
# XXX Ensure < 64bits. Use stronger algo.
def strong_hash(s, l=6):
return b64encode(sha1(s.encode()).digest()[:l])
def values_sorted_... | naure/PuppyParachute | puppyparachute/utils.py | Python | gpl-2.0 | 1,078 |
#!/usr/bin/python3
# Python 3.5.2
from runConfigs import *
from crochet import setup, wait_for, run_in_reactor
from flask import request
from flask import Flask
from flask_cors import CORS, cross_origin
from pprint import pprint
from threading import Thread
from twisted.internet import reactor
from twisted.internet im... | tonitran/dvc-embedded | sensor.py | Python | agpl-3.0 | 5,143 |
# -*- coding: utf-8 -*-
import os, datetime
from django.conf import settings
from django.contrib.auth.models import User
from django.core import mail
from django.core.urlresolvers import reverse
from django.test.client import Client
from transifex.txcommon.tests import base, utils
from transifex.projects.models import ... | hfeeki/transifex | transifex/releases/tests/notifications.py | Python | gpl-2.0 | 8,265 |
import math
import numbers
import os
import numpy as np
import taichi.lang
from taichi._kernels import (tensor_to_image, vector_to_fast_image,
vector_to_image)
from taichi._lib import core as _ti_core
from taichi.lang.field import Field, ScalarField
import taichi as ti
# For window crea... | yuanming-hu/taichi | python/taichi/ui/gui.py | Python | mit | 33,367 |
# Praca so zoznamom
#
# Tato sekcia sluzi na precvicenie si pace so zoznamom
#
# Pristupovanie k prvkom zoznamu
# Uloha 1:
def first(list):
pass
# Uloha 2:
def last(list):
pass
# Uloha 3:
def interval(list, a, b):
pass
# Uloha 4:
def no_first_two(list):
pass
# Uloha 5:
def no_last_three(list):
... | sevo/higher_order_functions | list_comprehension/lc_exercises.py | Python | mit | 1,028 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import codecs
import json
import traceback
import time
from os import environ as env
from bottle import route, run, get, request, response
from utils import *
from fra_cache import bbox_search
from fra_cache import info as fr... | mellowi/taukkis | backend/app.py | Python | mit | 21,522 |
import os
import random
from gensim.models import Doc2Vec
from helpers.data_path import model_data_path
from helpers.gensim_version_abstraction import save_doc2vec_model
from helpers.learning_rate_helper import alpha_for_epoch
from helpers.log_config import log_to_info
from helpers.random_helper import random_int
fro... | lukaselmer/hierarchical-paragraph-vectors | code/models/doc2vec_factory.py | Python | mit | 5,490 |
# Copyright (c) 2020 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 appli... | PaddlePaddle/Paddle | python/paddle/fluid/tests/unittests/test_imperative_data_loader_exit_func.py | Python | apache-2.0 | 3,353 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from .anpa i... | nistormihai/superdesk-core | superdesk/io/feed_parsers/ap_anpa.py | Python | agpl-3.0 | 7,807 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | anish/buildbot | master/buildbot/clients/base.py | Python | gpl-2.0 | 2,672 |
# 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 use ... | themarkypantz/kafka | tests/kafkatest/services/trogdor/network_partition_fault_spec.py | Python | apache-2.0 | 2,213 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# This file is the main file used when running tests with pytest directly,
# in particular if running e.g. ``pytest docs/``.
from importlib.util import find_spec
import os
import pkg_resources
import tempfile
try:
from pytest_astropy_header.display ... | MSeifert04/astropy | conftest.py | Python | bsd-3-clause | 1,526 |
from __future__ import unicode_literals
import sure # noqa
import moto.server as server
'''
Test the different server responses
'''
def test_elb_describe_instances():
backend = server.create_backend_app("elb")
test_client = backend.test_client()
res = test_client.get('/?Action=DescribeLoadBalancers')
... | pior/moto | tests/test_elb/test_server.py | Python | apache-2.0 | 383 |
#!/usr/bin/env python
### cut a fasta query (arg1) in "nbPart" (arg3)
### subFasta files and launches a blast programm (arg4)
### vs the bank (arg2) for each subfasta and then
### concatenates the tab delimited blast results in
### one file. You can add any additional blastall option in the
### arg5 with quotes like th... | alunem/bioman | blast/bmn-paraBlastKepler.py | Python | gpl-2.0 | 2,591 |
# Copyright 2013 IBM Corp.
#
# 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... | alvarolopez/nova | nova/tests/unit/objects/test_instance.py | Python | apache-2.0 | 80,126 |
import os
import cv2
import numpy as np
import pandas as pd
from keras.models import Sequential
from keras.layers.convolutional import Convolution2D
from keras.layers import Dense, Dropout, Flatten, Lambda
from keras.optimizers import Adam
import matplotlib.image as mpimg
SIZE_INPUT = (66, 200, 3)
MAX_TRANS_RANGE... | ruleva1983/udacity-selfdrivingcar | term1/P3_behavioral_cloning/model.py | Python | gpl-3.0 | 6,244 |
# -*- coding: utf-8 -*-
"""
Tests for WFS-T provider using QGIS Server through qgis_wrapped_server.py.
This is an integration test for QGIS Desktop WFS-T provider and QGIS Server
WFS-T that check if QGIS can talk to and uderstand itself.
The test uses testdata/wfs_transactional/wfs_transactional.qgs and three
initial... | fritsvanveen/QGIS | tests/src/python/test_qgsserver_wfst.py | Python | gpl-2.0 | 11,913 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | robotpilot/crazyflie-clients-python | lib/cflib/drivers/cfusb.py | Python | gpl-2.0 | 5,737 |
__author__ = 'Ryan Perkins'
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from crispy_forms.helper import FormHelper, Layout
from crispy_forms.layout import Submit
from userprofile.models import UserProfile
class MyRegistrationForm(UserCre... | cryanperkins/PoolRyde | poolryde/poolryde/forms.py | Python | apache-2.0 | 1,474 |
#
# 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... | bhardesty/qpid-dispatch | python/qpid_dispatch_internal/policy/policy_manager.py | Python | apache-2.0 | 5,904 |
# 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... | Huyuwei/tvm | tests/python/relay/test_vm_serialization.py | Python | apache-2.0 | 11,034 |
# -*- coding: utf-8 -*-
"""
tests.test_flask_authentic
~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests for the primary Authentic Flask Extension class
:copyright: (c) 2017 by Team8 Solutions, LLC.
:license: MIT, see LICENSE for more details.
"""
from flask_oauthlib.client import OAuthRemoteApp
from flask import Flask
from flask_a... | team8hq/flask-authentic | tests/test_flask_authentic.py | Python | mit | 3,937 |
# Copyright (c) 2006 The Regents of The University of Michigan
# 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 ... | ayoubg/gem5-graphics | gem5-gpu/tests/quick/se_gpu/20.bh/test.py | Python | bsd-3-clause | 1,653 |
#!/usr/bin/env python
# This file is part of nexdatas - Tango Server for NeXus data writer
#
# Copyright (C) 2012-2017 DESY, Jan Kotanski <jkotan@mail.desy.de>
#
# nexdatas is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... | nexdatas/configtool | test/DefinitionDlg_test.py | Python | gpl-3.0 | 85,762 |
# -*- coding: utf-8 -*-
"""
:mod:`neo.io` provides classes for reading and/or writing
electrophysiological data files.
Note that if the package dependency is not satisfied for one io, it does not
raise an error but a warning.
neo.io.iolist provides a list of succesfully imported io classes.
Classes:
.. autoclass:: ... | Blackfynn/python-neo | neo/io/__init__.py | Python | bsd-3-clause | 4,588 |
import os.path as op
import numpy as np
from numpy.testing import assert_array_almost_equal
from nose.tools import assert_true
from mne.datasets import sample
from mne import io, find_events, Epochs, pick_types
from mne.label import read_label
from mne.minimum_norm.inverse import (read_inverse_operator,
... | jaeilepp/eggie | mne/minimum_norm/tests/test_time_frequency.py | Python | bsd-2-clause | 6,362 |
"""
Django admin dashboard configuration for LMS XBlock infrastructure.
"""
from django.contrib import admin
from config_models.admin import ConfigurationModelAdmin
from mobile_api.models import MobileApiConfig
admin.site.register(MobileApiConfig, ConfigurationModelAdmin)
| ahmadiga/min_edx | lms/djangoapps/mobile_api/admin.py | Python | agpl-3.0 | 275 |
class NiprovError(Exception):
pass
class UnknownFileError(NiprovError):
pass
| ilogue/niprov | niprov/exceptions.py | Python | bsd-3-clause | 89 |
from django.shortcuts import render
from PollyUpload.models import MovieSub, TvSub
def management_index(request):
return render(request, 'management_index.html', {})
def render_data(request):
return
| antring/PollyPy | management/views.py | Python | mit | 211 |
import sys
import os
from PyQt4 import QtGui, QtCore
from PyQt4.uic import loadUiType
from PyQt4.QtCore import (QString,QRect,QObject,QRunnable, QThreadPool, Qt)
from PyQt4.Qt import (SIGNAL, SLOT, QObject)
import weakref
import multiprocessing
# TODO: Make changing the elevationPlacement trigger update
# On pro... | JensMunkHansen/sofus | python/gui/sofus.py | Python | gpl-3.0 | 22,268 |
# tests.utils_tests.rdfutils_tests
# Testing for the rdfutils package in Lene
#
# Author: Benjamin Bengfort <bengfort@cs.umd.edu>
# Created: Tue Mar 25 17:31:13 2014 -0400
#
# Copyright (C) 2014 UMD Metacognitive Lab
# For license information, see LICENSE.txt
#
# ID: rdfutils_tests.py [] bengfort@cs.umd.edu $
"""
T... | mclumd/lene | tests/utils_tests/rdfutils_tests.py | Python | mit | 3,247 |
# coding: utf-8
"""
Grafeas API
An API to insert and retrieve annotations on cloud artifacts. # noqa: E501
OpenAPI spec version: v1alpha1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import grafeas
from grafeas.m... | grafeas/client-python | test/test_api_project.py | Python | apache-2.0 | 836 |
import sys, string
import os.path
import unique
import itertools
dirfile = unique
############ File Import Functions #############
def filepath(filename):
fn = unique.filepath(filename)
return fn
def read_directory(sub_dir):
dir_list = unique.read_directory(sub_dir)
return dir_list
def returnDirecto... | wuxue/altanalyze | mergeFiles.py | Python | apache-2.0 | 13,724 |
#!/usr/bin/env python
"""
For this exercise, let's return to our cities infobox dataset. The question we would like you to answer
is as follows: Which region in India contains the most cities?
As a starting point, use the solution for the example question we looked at -- "Who includes the most
user mentions in their ... | xiiicyw/Data-Wrangling-with-MongoDB | Lesson_5_Analyzing_Data/12-Using_unwind/unwind.py | Python | agpl-3.0 | 2,260 |
# Copyright 2017 Rackspace, US 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 wri... | briancurtin/python-openstacksdk | openstack/tests/functional/load_balancer/base.py | Python | apache-2.0 | 2,686 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.