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 |
|---|---|---|---|---|---|
## Copyright (c) 2012-2015 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
""" test qibuild init """
import qisys.script
import pytest
def test_works_from_an_empty_dir(tmpdir, monkeypatch):
''' positive test '''
m... | dmerejkowsky/qibuild | python/qibuild/test/test_qibuild_init.py | Python | bsd-3-clause | 747 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# __init__.py
"""
Test suite.
Copyright (c) 2020, David Hoffman
"""
| david-hoffman/pyOTF | tests/__init__.py | Python | apache-2.0 | 115 |
# #
# Copyright 2013-2020 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (... | pescobar/easybuild-framework | test/framework/easyconfigformat.py | Python | gpl-2.0 | 2,082 |
'''
Created by auto_sdk on 2015.04.21
'''
from aliyun.api.base import RestApi
class Rds20140815ImportDataForSQLServerRequest(RestApi):
def __init__(self,domain='rds.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.DBInstanceId = None
self.FileName = None
def getapiname(self):
retur... | wanghe4096/website | aliyun/api/rest/Rds20140815ImportDataForSQLServerRequest.py | Python | bsd-2-clause | 376 |
#!/usr/bin/python
import sys, getopt, re, time , getpass
from pysphere import *
#############################
def usage():
print "\n * Usage: "+sys.argv[0]+" {--verbose|--host <vcenter host> | --user <user> | --pass <password> --myvm <vmname> --action [ON|OFF|RESET]}\n"
#####
def myArgument(opts):
verbose = False... | arunbagul/openinfra | infra-daemon/openinfra-vcenter-vmPowerCycle.py | Python | gpl-3.0 | 3,475 |
# coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# ... | emgerner-msft/azure-storage-python | tests/test_block_blob.py | Python | apache-2.0 | 27,242 |
"""
A pretty-printing dump function for the ast module. The code was copied from
the ast.dump function and modified slightly to pretty-print.
Alex Leone (acleone ~AT~ gmail.com), 2010-01-30
From http://alexleone.blogspot.co.uk/2010/01/python-ast-pretty-printer.html
"""
from ast import *
def dump(node, annotate_fie... | funkydelpueblo/pyredund | astpp.py | Python | gpl-2.0 | 3,317 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
supervisedclassification.py
---------------------
Date : July 2013
Copyright : (C) 2013 by Victor Olaya
Email : volayaf at gmail dot com
****************... | mhugo/QGIS | python/plugins/processing/algs/saga/ext/supervisedclassification.py | Python | gpl-2.0 | 1,160 |
from __future__ import unicode_literals
import os
def assert_env_var_defined(name):
value = os.environ.get(name)
if value is None:
raise Exception('{0} is not defined'.format(name))
print('{name}: {value}'.format(name=name, value=value))
def setup():
assert_env_var_defined('AGRAPH_PORT')
... | franzinc/agraph-python | src/franz/openrdf/tests/__init__.py | Python | mit | 364 |
import unittest
import VerbTrainer
import languages.spanish as es
import languages.french as fr
class TestMenus(unittest.TestCase):
def test_tense_menu_one(self):
expected = 'presente'
actual = VerbTrainer.construct_tense_menu(es._TENSES,1)
self.assertEqual(expected, actual['1'])
def ... | wmealem/VerbTrainer | tests/test_menus.py | Python | mit | 875 |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# 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 3 of the Licen... | cylc/cylc | tests/unit/test_host_select_remote.py | Python | gpl-3.0 | 6,193 |
"""initial migration
Revision ID: 338ed9e4e95d
Revises: None
Create Date: 2014-10-13 19:22:16.038576
"""
# revision identifiers, used by Alembic.
revision = '338ed9e4e95d'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust!... | AguNnamdi/flask_microblog | migrations/versions/338ed9e4e95d_initial_migration.py | Python | mit | 592 |
#!/usr/bin/env python
# coding:utf8
from event import models as event_models
from asset import models as asset_models
from alarm import engine
def check_event_type():
if not event_models.TopType.objects.filter(name='ceph'):
event_models.TopType.objects.create(name='ceph')
if not event_models.SecondTy... | zhaogaolong/oneFinger | event/ceph/osd.py | Python | apache-2.0 | 2,001 |
# Exercise 1
#
# Write a program that simulates a fortune cookie. The program should display one of five unique fortunes, at random,
# each time it's run.
#
import random
val = random.randint(1, 5)
if (val == 1):
print("You staying in the company till the end of times.")
elif (val == 2):
print("You will get fired... | dmartinezgarcia/Python-Programming | Chapter 3 - Branching and while loops/exercise_1.py | Python | gpl-2.0 | 617 |
from bottle import route, run, view, static_file, post, get, redirect
from bottle import jinja2_template as template
from db import Slide
from settings import STATIC_URL, CONFIG_ROOT
from forms import DemographicsForm
import os
__version__ = "0.2.0"
# Homebrewed JSONDB Manager on initialization
s = Slide()
s._tmpdb(... | LBConsulting/headroom | headroom/app.py | Python | mit | 2,458 |
import ctds
from .base import TestExternalDatabase
class TestConnectionEnter(TestExternalDatabase):
def test___doc__(self):
self.assertEqual(
ctds.Connection.__enter__.__doc__,
'''\
__enter__()
Enter the connection's runtime context. On exit, the connection is
closed automaticall... | zillow/ctds | tests/test_connection___enter__.py | Python | mit | 394 |
# -*- coding: utf-8 -*-
from .api import Funimation | ABusers/A-Certain-Magical-API | funimation/__init__.py | Python | mit | 51 |
# Copyright 2022 The Magenta 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 applicable law or agreed to in ... | magenta/magenta | magenta/models/latent_transfer/configs/joint_exp_2mnist_parameterized.py | Python | apache-2.0 | 2,401 |
# -*- coding: utf-8 -*-
"""
This module contais classes to package the model data necessary for plotting.
DataSeries is the main class of interest.
"""
class DataItem(object):
"""One line in a plot. It contains y-axis values and a title."""
def __init__(self, title, values, params):
"""Init the... | dolfandringa/AquaponicsModeler | AquaponicsModeler/plotdata.py | Python | gpl-3.0 | 1,869 |
# Generated by Django 2.1.7 on 2019-04-11 06:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('landing', '0044_section_order_index'),
]
operations = [
migrations.AddField(
model_name='section',
name='featured',
... | flavoi/diventi | diventi/landing/migrations/0045_section_featured.py | Python | apache-2.0 | 416 |
# encoding: 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/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divisi... | klahnakoski/ActiveData | vendor/jx_elasticsearch/es52/expressions/find_op.py | Python | mpl-2.0 | 2,491 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 University of Dundee & Open Microscopy Environment
# All Rights Reserved.
#
# 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 Foundat... | sbesson/snoopycrimecop | test/unit/Mock.py | Python | gpl-2.0 | 1,844 |
import logging
import json
import random
import hashlib
import collections
import datetime
import etcd.exceptions
import mr.constants
import mr.config.kv
import mr.models.kv.common
import mr.models.kv.data_layer
import mr.compat
_logger = logging.getLogger(__name__)
_logger.setLevel(logging.INFO)
class ValidationE... | dsoprea/JobX | mr/models/kv/model.py | Python | gpl-2.0 | 15,499 |
class MimeError(Exception):
pass
class DecodingError(MimeError):
"""Thrown when there is an encoding error."""
pass
class EncodingError(MimeError):
"""Thrown when there is an decoding error."""
pass
| alex/flanker | flanker/mime/message/errors.py | Python | apache-2.0 | 223 |
# Copyright 2019 Fortinet, Inc.
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the... | anryko/ansible | test/units/modules/network/fortios/test_fortios_vpn_certificate_ca.py | Python | gpl-3.0 | 10,627 |
# Copyright (C) 2011 Jason Anderson
#
#
# This file is part of PseudoTV.
#
# PseudoTV 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 of the License, or
# (at your option) any later version.... | yolanother/script.pseudotv.live | resources/lib/EPGWindow.py | Python | gpl-3.0 | 63,459 |
"""
================================
Digits Classification Exercise
================================
This exercise is used in the :ref:`clf_tut` part of the
:ref:`supervised_learning_tut` section of the
:ref:`stat_learn_tut_index`.
"""
print(__doc__)
from sklearn import datasets, neighbors, linear_model
digits = dat... | florian-f/sklearn | examples/exercises/plot_digits_classification_exercise.py | Python | bsd-3-clause | 816 |
# Copyright (c) 2010-2014, Lawrence Livermore National Security, LLC
# Produced at Lawrence Livermore National Laboratory
# LLNL-CODE-462894
# All rights reserved.
#
# This file is part of MixDown. Please read the COPYRIGHT file
# for Our Notice and the LICENSE file for the GNU Lesser General Public
# License.
#
# This... | tepperly/MixDown | md/__init__.py | Python | lgpl-3.0 | 1,016 |
from setuptools import setup
setup(
name='grabfeed',
packages=['grabfeed'],
version='0.4',
description='Detects and return RSS feeds for a given website.',
author='Sudip Kafle',
author_email='soodip.kafle@gmail.com',
url='https://github.com/kaflesudip/grabfeed',
download_url='https://git... | kaflesudip/grabfeed | setup.py | Python | apache-2.0 | 516 |
"""
Tests for lqcontrol.py file
"""
import sys
import unittest
import numpy as np
from numpy.testing import assert_allclose
from numpy import dot
from quantecon.lqcontrol import LQ, LQMarkov
class TestLQControl(unittest.TestCase):
def setUp(self):
# Initial Values
q = 1.
r = 1.
r... | oyamad/QuantEcon.py | quantecon/tests/test_lqcontrol.py | Python | bsd-3-clause | 7,700 |
#How to run this:
#Python libraries needed to run this file: Flask, Git Python, SQLAlchemy
#You will need to have Git installed, and it will need to be in your path.
#For example, on Windows you should be able to run a command like 'git pull' from the
#ordinary Windows command prompt and not just from Git Bash.
#You... | Hackers-To-Engineers/ghdata-sprint1team-2 | organizationHistory/pythonBlameHistoryTree.py | Python | mit | 12,918 |
# -*- coding: utf-8 -*-
from ...support.grammar import Grammar
from ...support.fluent import Fluent
from ...query.expression import QueryExpression
from ...dbal.column import Column
from ...dbal.table_diff import TableDiff
from ...dbal.comparator import Comparator
from ..blueprint import Blueprint
class SchemaGramma... | sdispater/orator | orator/schema/grammars/grammar.py | Python | mit | 9,880 |
#!/usr/bin/python
import random
from lib.singleton import Singleton
from lib import log
from srv.phase import Phase
from srv.game import Game
from srv.variable import Variable
from srv.logic.doublerphase import DoublerPhase
from srv.logic.withdrawphase import WithdrawPhase
class DicePhase(Phase,Singleton):
_name = ... | magwas/gamsrv | logic/dice.py | Python | gpl-3.0 | 2,718 |
#!/usr/bin/env python
from omics_pipe.parameters.default_parameters import default_parameters
from omics_pipe.utils import *
p = Bunch(default_parameters)
def macs(step, macs_flag):
'''Runs MACS to call peaks from ChIPseq data.
input:
.fastq file
output:
peaks and .bed file
citation... | adammaikai/OmicsPipe2.0 | omics_pipe/modules/macs.py | Python | mit | 1,388 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import division
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
class MainDisplay(object):
"""docstring for MainDisplay"""
def __init__(self, figsize=(11.7,8.3)):
super(Main... | celiacintas/candela_maps | pie_maps.py | Python | gpl-2.0 | 5,213 |
#!/usr/bin/env python
import glob
import fnmatch
import itertools
import os
import re
TODO_PATTERN = re.compile(r'\s*// TODO:')
DOC_PATTERN = re.compile(r'\s*//')
EXPECT_PATTERN = re.compile(r'// expect')
num_files = 0
num_docs = 0
num_code = 0
num_empty = 0
num_todos = 0
num_semicolons = 0
num_test_files = 0
num_te... | lluchs/wren | script/metrics.py | Python | mit | 2,793 |
"""
Component to interface with various media players.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/media_player/
"""
import asyncio
from datetime import timedelta
import functools as ft
import hashlib
import logging
import os
from random import Syste... | eagleamon/home-assistant | homeassistant/components/media_player/__init__.py | Python | apache-2.0 | 28,502 |
# -*- encoding: utf-8 -*-
import abc
from abjad.tools.abctools.AbjadObject import AbjadObject
class TypedCollection(AbjadObject):
r'''Abstract base class for typed collections.
'''
### CLASS VARIABLES ###
__slots__ = (
'_collection',
'_item_class',
)
### INITIALIZER ###
... | mscuthbert/abjad | abjad/tools/datastructuretools/TypedCollection.py | Python | gpl-3.0 | 4,949 |
from django.conf.urls import patterns, include, url
from django.contrib.auth.decorators import login_required
from views import uploadgrade, current_courselist, all_courselist
urlpatterns = patterns('',
url(r'^uploadgrade/(\d+)/$',uploadgrade, name='uploadgrade'),
url(r'currentlist/$', current_courselist, name... | Linktime/Chronus | teacher/urls.py | Python | gpl-3.0 | 393 |
# (c) 2017, Brian Coca <bcoca@ansible.com>
#
# Ansible 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 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in th... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/cli/inventory.py | Python | bsd-3-clause | 10,972 |
from datetime import datetime
import logging
from shutil import make_archive, copyfile
import os
from django.conf import settings
from mmc.mixins import BaseCommand as MonitoredCommand
from rest_framework.test import APIClient
from learn import export
logger = logging.getLogger(__name__)
class Command(MonitoredComm... | adaptive-learning/robomission | backend/learn/management/commands/export_data.py | Python | gpl-3.0 | 2,781 |
# Copyright (c) 2012 Phil Birkelbach
#
# 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 distrib... | birkelbach/python-canbus | canbus/exceptions.py | Python | gpl-2.0 | 1,265 |
'''
title = "Camel Case String"
level = "intro"
dificulty = "easy"
tags = ["strings", "functions", "camel-case"]
description = """
Write a function that receives a string and returns a camel case version of it.
Example:
camel_case('hello world') # Hello World
"""
'''
def camel_case(a_string):
pass
| rmotr/whooshercises | assignments/camel_case_string.py | Python | mit | 310 |
from django.conf import settings
from django.conf.urls import patterns, include, url
# There is a course creators admin table.
from ratelimitbackend import admin
from cms.djangoapps.contentstore.views.program import ProgramAuthoringView, ProgramsIdTokenView
from cms.djangoapps.contentstore.views.organization import Or... | marcore/edx-platform | cms/urls.py | Python | agpl-3.0 | 9,922 |
# Django settings for djangoajaxtest project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'N... | vincent-petithory/django-ajax | examples/djangoajaxtest/settings.py | Python | gpl-3.0 | 3,515 |
###############################################################################
# Copyright 2014 The University of Texas at Austin #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #... | ericblau/ipf-xsede | ipf/glue2/benchmark.py | Python | apache-2.0 | 2,610 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# Movie Ultra 7K Regex de Sawlive por Quequino
# Version 0.2 (7.12.2014)
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
# Gracias a la librería plugintools de Je... | corvorepack/REPOIVAN | plugin.video.movie.ultra.7k/resources/regex/sawlive.py | Python | gpl-2.0 | 4,208 |
"""
INFORM over multiple transports
+++++++++++++++++++++++++++++++
The following script sends SNMP INFORM notification using the following options:
* with SNMPv2c
* with community name 'public'
* over IPv4/UDP and IPv6/UDP
* send INFORM notification
* to a Manager at demo.snmplabs.com:162 and [::1]:162
* with TRAP I... | etingof/pysnmp | examples/v1arch/asyncore/agent/ntforg/send-inform-over-ipv4-and-ipv6.py | Python | bsd-2-clause | 2,835 |
import bpy
from bpy.types import Node
from .. import node_tree
from .. import export_utils
class FloatNode(Node, node_tree.AvangoCustomTreeNode):
bl_idname = "FloatInputNode"
bl_label = "Float"
def init(self, context):
self.inputs.new("NodeSocketFloat", "Value")
self.outputs.new("NodeSoc... | jakobharlan/avango | avango-blender/blender-addon/nodes/float_node.py | Python | lgpl-3.0 | 780 |
from django.contrib import admin
from blog.models import Post
from blog.models import Comment
admin.site.register(Post)
admin.site.register(Comment)
| I-prefer-the-front-end/I-prefer-the-front-end | iptfe/blog/admin.py | Python | mit | 151 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C)
# 2004-2011: Pexego Sistemas Informáticos. (http://pexego.es)
# 2013: Top Consultant Software Creations S.L.
# (http://www.topconsultant.es/)
# 2014: ... | otherway/loc-spain | l10n_es_aeat_mod349/wizard/export_mod349_to_boe.py | Python | agpl-3.0 | 15,781 |
from time import time as ti
from random import randrange as rr
from numpy import random
from affichage_bataille import affichage
def bataille():
def distribute():
"""distribue les cartes"""
cards = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
... | ZeeGabByte/War-cards-game-simulation | War/Alternativ_versions/Tirage/p_(perdant)/bataille_module_tirage_p.py | Python | gpl-3.0 | 5,709 |
#!usr/bin/env python
from argparse import ArgumentParser
from matplotlib import pyplot as plt
from ggraph import Greengraph
# execute iff we are on command line
if __name__ == "__main__":
parser = ArgumentParser(description = "Run Greengraph from command line")
parser.add_argument('--begin', '-b', type = str... | jscott6/greengraph | build/scripts-3.5/command_line.py | Python | mit | 653 |
import asyncio
import jinja2
import aiohttp_debugtoolbar
import aiohttp_jinja2
from aiohttp import web
@aiohttp_jinja2.template('index.html')
def basic_handler(request):
return {'title': 'example aiohttp_debugtoolbar!',
'text': 'Hello aiohttp_debugtoolbar!',
'app': request.app}
@asyncio... | realer01/aiohttp-debugtoolbar | examples/simple.py | Python | apache-2.0 | 1,624 |
from .base import *
DEBUG = False
ALLOWED_HOSTS = ['163.172.167.163', 'tweets.mikexine.com']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'tweets',
'USER': 'collector',
'PASSWORD': 'c0llect0r',
'HOST': 'localhost',
... | mikexine/tweetset | tweetset/tweetset/settings/production.py | Python | mit | 534 |
#!/usr/bin/env python
# encoding=utf-8
"""
爬取豆瓣电影TOP250 - 完整示例代码
我们已经得到的信息有如下:
1.每页有25条电影,共有10页。
2.电影列表在页面上的位置为一个class属性为grid_view的ol标签中。
3.每条电影信息放在这个ol标签的一个li标签里。
"""
import codecs
import requests
from bs4 import BeautifulSoup
DOWNLOAD_URL = 'http://movie.douban.com/top250/'
def download_page(url):
"""
... | zhangmianhongni/MyPractice | Python/WebCrawler/xlzd/03.豆瓣电影TOP250/main.py | Python | apache-2.0 | 3,140 |
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Copyright (c) 2019 The ARC developers are EternityGroup
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Helpful routines for regression testing
#
# Add python-bitco... | ArcticCore/arcticcoin | qa/rpc-tests/test_framework/util.py | Python | mit | 21,581 |
from typing import List
from flask_restx import Namespace, Resource
from CTFd.api.v1.helpers.request import validate_args
from CTFd.api.v1.helpers.schemas import sqlalchemy_to_pydantic
from CTFd.api.v1.schemas import (
APIDetailedSuccessResponse,
PaginatedAPIListSuccessResponse,
)
from CTFd.cache import clear... | LosFuzzys/CTFd | CTFd/api/v1/submissions.py | Python | apache-2.0 | 6,085 |
#!/usr/bin/env python
from pynocchio.pynocchio import Pynocchio
def main():
Pynocchio().run()
if __name__ == '__main__':
main()
| pynocchio-comic-reader/pynocchio-comic-reader | pynocchio-client.py | Python | gpl-3.0 | 142 |
"""Generic unit tests for Web API resources"""
from __future__ import unicode_literals
import json
from django.test.client import RequestFactory
from djblets.features import Feature, get_features_registry
from djblets.testing.decorators import add_fixtures
from djblets.webapi.errors import PERMISSION_DENIED
from re... | davidt/reviewboard | reviewboard/webapi/tests/test_base.py | Python | mit | 9,181 |
"""
Copyright 2013 Steven Diamond
This file is part of CVXPY.
CVXPY 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 of the License, or
(at your option) any later version.
CVXPY is distributed i... | halwai/cvxpy | cvxpy/tests/test_expressions.py | Python | gpl-3.0 | 26,292 |
# -*- coding: utf-8 -*-
# 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, softw... | dims/oslo.utils | tests/test_utils.py | Python | apache-2.0 | 750 |
from functools import wraps
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist
from django.shortcuts import resolve_url
from django.contrib.contenttypes.models import ContentType
from django.utils.decorators impor... | beedesk/django-trusts | trusts/decorators.py | Python | bsd-2-clause | 7,047 |
# -*- coding: utf-8 -*-
"""
Random Forest Regression in python - code example
- similar of Decision tree method
- A version of Ensemble learning - other Ensemble learning are gradient Boosting
- Ensemble - means taking multiple algorithms or same algorithms for multiple time and
put them together for making some thin... | moinulkuet/machine-learning | Part 2 - Regression/Section 9 - Random Forest Regression/random-forest-regression.py | Python | gpl-3.0 | 3,227 |
"""Module that creates and initialises application."""
import logging
import os
from flask import Flask
from flask_bootstrap import Bootstrap
from flask_moment import Moment
from flask_login import LoginManager
from flask_session import Session
from flask_migrate import Migrate
# from flask_paranoid import Paranoid
fro... | gregcowell/BAM | btt/__init__.py | Python | apache-2.0 | 2,788 |
from numpy import *
import matplotlib
from tools import *
# Constants
# Distances [m]
R = 1. # support points to geometric center
L = .995 # Length of the cables
Rg = .995 # g measure points to geometric center
# Weights [kg]
Mp = 0.848 # platform bare
Mpm = 1.003 # platform + mount
# Errors
DR = DL =... | morloy/trifilar-mass-prop | inc/constants.py | Python | gpl-2.0 | 706 |
i = 0
print("************************* Part 1 *****************************")
aList = ['Oxo', 'OXO', '123454321', 'ROTATOR', '12345 54321']
for i in range(len(aList)):
name = reversed(aList[i])
if list(name) == list(aList[i]):
print("True ", aList[i])
else:
print("False", aList[i])
print("******... | MajedAlshammari/cloud-computing | lab3/lab3-1.py | Python | mit | 519 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#controller.py
import copy, datetime, multiprocessing
import dataListener, strategyActuator
from DataApi_32 import CDataProcess
#载入策略
import signalStrategy, multipleStrategy
#-----------------------
#定义全局变量
#-----------------------
#数据监听对象
g_listenerList = [] #总共3个对象
#策略执行器对象... | sharmaking/BackTestSystem | controller.py | Python | mit | 3,944 |
# lib.vartools
import re
from string import letters
import random
import hashlib
import hmac
import json
secret = 'movethistoanimport'
USER_RE = re.compile(r"^[a-zA-Z0-9_-]{3,30}$")
EMAIL_RE = re.compile(r'^[\S]+@[\S]+\.[\S]+$')
PASS_RE = re.compile(r"^.{3,20}$")
def valid_username(username):
return username and... | oweninglese/filmofile | lib/vartools.py | Python | gpl-2.0 | 1,432 |
#!/bin/python3
""" This script contains functions to check wich packages are updatable on the
system.
Author: Julien Delplanque
"""
import subprocess
class PackageManagerDoesNotExists(Exception):
""" Exception launched if the package manager doesn't exists.
"""
pass
def pacman_packages_to_update()... | juliendelplanque/raspirestmonitor | server/pkgmanagers.py | Python | mit | 1,196 |
# encoding: utf-8
"""
Common shape-related oxml objects
"""
from __future__ import absolute_import
from ...enum.shapes import PP_PLACEHOLDER
from ..ns import qn
from ..simpletypes import (
ST_Angle, ST_Coordinate, ST_Direction, ST_DrawingElementId, ST_LineWidth,
ST_PlaceholderSize, ST_PositiveCoordinate, Xsd... | biggihs/python-pptx | pptx/oxml/shapes/shared.py | Python | mit | 11,160 |
data = [(x,y) for y in range (0,10) for x in range(0, 10)]
for x,y in data:
print "{} {}".format(x*1.0,y*1.0)
| maximg/comp-prog | uva/10034.gen.py | Python | mit | 115 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-authorization/azure/mgmt/authorization/models/role_definition_paged.py | Python | mit | 956 |
import platform
from copy import *
from ctypes import *
class Param(Structure): #Forward declaration
pass
class Value(Structure):
pass
class StringValue(Structure):
pass
class BoolValue(Structure):
pass
class NumberValue(Structure):
pass
class ListValue(Structure):
pass
PARAM_P = POINTER(Param)
VALUE_P = P... | zaibacu/zTemplate | lib/zTemplate.py | Python | mit | 2,885 |
from __future__ import print_function
from __future__ import division
import sys
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.model_selection import H2OModelSelectionEstimator as modelSelection
# test modelselection algorithm for regression only. Make sure the result f... | h2oai/h2o-3 | h2o-py/tests/testdir_algos/modelselection/pyunit_PUBDEV_8346_modelselection_result_frame.py | Python | apache-2.0 | 3,191 |
from blmath.geometry.primitives.box import Box
from blmath.geometry.primitives.plane import Plane
from blmath.geometry.primitives.polyline import Polyline
| bodylabs/blmath | blmath/geometry/__init__.py | Python | bsd-2-clause | 155 |
# 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 the... | openstack/zaqar | zaqar/conf/transport.py | Python | apache-2.0 | 6,180 |
#
# Copyright (C) 2010-2012 Vinay Sajip. All rights reserved. Licensed under the new BSD license.
#
import ctypes
import logging
import os
class ColorizingStreamHandler(logging.StreamHandler):
# color names to indices
color_map = {
'black': 0,
'red': 1,
'green': 2,
'yellow': 3,
... | Arvin-X/swarm | thirdparty/ansistrm/ansistrm.py | Python | gpl-3.0 | 4,788 |
default_app_config = 'machiavelli.apps.MachiavelliConfig'
| jantoniomartin/machiavelli | __init__.py | Python | agpl-3.0 | 58 |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# 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
... | brownian/frescobaldi | frescobaldi_app/musicview/__init__.py | Python | gpl-2.0 | 25,858 |
from scipy.integrate import quad
import numpy as np
from prettytable import PrettyTable
def integral_solution(interval_bounds, family):
answers = []
for function in family:
answers.append(quad(lambda x: eval(function), interval_bounds[0], interval_bounds[1])[0])
return answers
de... | Kosci/Approximate-Integrals | ApproxIntegrals.py | Python | mit | 3,252 |
# -*- coding:utf8 -*-
# File : callback.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 12/29/16
#
# This file is part of TensorArtist.
__all__ = ['CallbackManager']
class CallbackManager(object):
"""
A callable manager utils.
Using register(name, callback) to register a callback... | vacancy/TensorArtist | tartist/core/utils/callback.py | Python | mit | 3,198 |
import csv
import time
from datetime import timedelta
from django.shortcuts import render, redirect
from django.http import Http404, HttpResponse, HttpResponseForbidden, JsonResponse
from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _
f... | fallen/Pytition | pytition/petition/views.py | Python | bsd-3-clause | 64,345 |
# Copyright (c) 2015 David Wilson
# This file is part of Icarus.
# Icarus 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 of the License, or
# (at your option) any later version.
# Icarus is... | jeroanan/GameCollection | Tests/Interactors/Platform/TestGetPlatformsInteractor.py | Python | gpl-3.0 | 1,654 |
import os
from django.conf import settings
from openflow.optin_manager.sfa.trust.gid import GID
from openflow.optin_manager.sfa.trust.credential import Credential
from openflow.optin_manager.sfa.trust.certificate import Certificate, Keypair, convert_public_key
from openflow.optin_manager.sfa.trust.gid import create_uu... | dana-i2cat/felix | optin_manager/src/python/openflow/optin_manager/sfa/managers/MetaSfaRegistry.py | Python | apache-2.0 | 852 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | maljac/odoo-addons | account_journal_sequence/__openerp__.py | Python | agpl-3.0 | 1,536 |
import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame, MultiIndex
from pandas.util.testing import ensure_clean
from pandas.io.excel import ExcelWriter, _XlwtWriter
xlwt = pytest.importorskip("xlwt")
pytestmark = pytest.mark.parametrize("ext,", ['.xls'])
def test_excel_raise_error_on_mu... | cbertinato/pandas | pandas/tests/io/excel/test_xlwt.py | Python | bsd-3-clause | 2,485 |
import micropython
@micropython.native
def native_x(x):
print(x + 1)
@micropython.native
def native_y(x):
print(x + 1)
@micropython.native
def native_z(x):
print(x + 1)
| trezor/micropython | ports/qemu-arm/test-frzmpy/native_frozen_align.py | Python | mit | 184 |
"""Tests for tensorflow.kernels.edit_distance_op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.python.platform
import numpy as np
import tensorflow as tf
def ConstantOf(x):
x = np.asarray(x)
# Convert to int64 if it's not a str... | arunhotra/tensorflow | tensorflow/python/kernel_tests/edit_distance_op_test.py | Python | apache-2.0 | 5,651 |
from celery import Celery
from actions.fetch import Fetch
from actions.pickup import Pickup
from actions.judge import Judge
from actions.inform import InformTriche
from celery.bin.celery import result
from celery.result import AsyncResult
from sqlalchemy import create_engine
import config
from models import Project
fro... | steven-martins/ramassage.epitech.eu | tasks.py | Python | mit | 8,744 |
#
# network_gui.py: Network configuration dialog
#
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, Red Hat, Inc.
# 2007, 2008, 2009
#
# 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... | masami256/Anaconda-for-ore-ore-kernel | pyanaconda/iw/network_gui.py | Python | gpl-2.0 | 7,800 |
from os import path
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
path.join(path.dirname(__file__), '..',
'tardis_portal/templates/').replace('\\', '/'),
],
'OPTIONS': {
'context_processors': [
... | wettenhj/mytardis | tardis/default_settings/templates.py | Python | gpl-3.0 | 1,575 |
## begin license ##
#
# "Meresco PyLucene" contains JVM initialization for pylucene
#
# Copyright (C) 2015 Koninklijke Bibliotheek (KB) http://www.kb.nl
# Copyright (C) 2015 Seecr (Seek You Too B.V.) http://seecr.nl
#
# This file is part of "Meresco PyLucene"
#
# "Meresco PyLucene" is free software; you can redistribut... | seecr/meresco-pylucene | meresco/__init__.py | Python | gpl-2.0 | 1,077 |
# Gufw 12.10.0 - http://gufw.tuxfamily.org
# Copyright (C) 2008-2011 Marcos Alvarez Costales https://launchpad.net/~costales
#
# Gufw 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 of the Lic... | antiX-Linux/gufw-jessie | gui-ufw-12.10.0/gufw/model/Firewall.py | Python | gpl-3.0 | 7,258 |
#!/usr/bin/env python
"""Semantic protocol buffers can be created from proto2 .proto files.
For maintaining inter-operatibility with primitive protocol buffer
implementations, we can parse the field descriptors created by the standard
Google proto implementation, and generate Semantic proto descriptors.
This file con... | simsong/grr-insider | lib/rdfvalues/proto2.py | Python | apache-2.0 | 8,695 |
# -*- coding: utf-8 -*-
from itertools import product
import requests
import shutil
def api_list(apiargs):
"""Google Street View Image API results.
Constructs a list of `Google Street View Image API queries <https://developers.google.com/maps/documentation/streetview/>`_
from a dictionary.
Args:
ap... | rrwen/google_streetview | google_streetview/helpers.py | Python | mit | 2,418 |
'''Learning agent for learning with GPTD, using the
GPTDModule. Updates must be done with pairs (laststate, lastaction)
and (curstate, curaction), as specified in GPTDModule.
'''
class GPTDAgent(object):
curstate = None
nextaction = None
laststate = None
lastaction = None
lastreward = None
de... | alexandrwang/6882project | engel/agent.py | Python | mit | 1,058 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2016 CERN.
#
# Zenodo 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 v... | tiborsimko/zenodo | zenodo/modules/cache/__init__.py | Python | gpl-2.0 | 1,153 |
import urllib
import requests
import jwt
import ssl
from datetime import datetime
from binascii import a2b_base64
from Crypto.PublicKey import RSA
from Crypto.Util.asn1 import DerSequence
from django.core.cache import cache
from django.conf import settings
def get_auth0_public_key(cert_url):
"""
Using the URL ... | Techbikers/techbikers | server/auth/utils.py | Python | mit | 2,262 |
from rasmodel.scenarios.default import model
import numpy as np
from matplotlib import pyplot as plt
from pysb.integrate import Solver
from pysb import *
from tbidbaxlipo.util import fitting
# Zero out all initial conditions
for ic in model.initial_conditions:
ic[1].value = 0
KRAS = model.monomers['KRAS']
GDP =... | johnbachman/ras_model | gxp_exchange.py | Python | mit | 2,587 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.