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 |
|---|---|---|---|---|---|
"""Describes Rotest's test running handler class."""
# pylint: disable=too-many-arguments
from __future__ import absolute_import
import sys
from collections import defaultdict
from future.builtins import range
from rotest.common.utils import get_class_fields
from rotest.core.runners.base_runner import BaseTestRunner... | gregoil/rotest | src/rotest/core/runner.py | Python | mit | 10,057 |
from django import forms
from django.contrib.auth.forms import UserCreationForm
from .models import WhatTheUser
class RegistrationForm(UserCreationForm):
#first_name = forms.CharField()
#last_name = forms.CharField()
#email = forms.EmailField()
#password1 = forms.CharField()
#password2 = forms.Cha... | mikeshultz/whatthediff | whatthediff/forms.py | Python | gpl-2.0 | 818 |
import signal
from twisted.internet import reactor, defer
from pyrake.core.engine import ExecutionEngine
from pyrake.resolver import CachingThreadedResolver
from pyrake.extension import ExtensionManager
from pyrake.signalmanager import SignalManager
from pyrake.utils.ossignal import install_shutdown_handlers, signal_... | elkingtowa/pyrake | pyrake/crawler.py | Python | mit | 5,564 |
# -*- coding: utf-8 -*-
import pytest
import fauxfactory
from cfme import test_requirements
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.storage.volume import VolumeAllView
from cfme.utils.log import logger
from cfme.utils.update import update
pytestmark = [
pytest.mark.tier(3),
test... | lkhomenk/integration_tests | cfme/tests/storage/test_volume.py | Python | gpl-2.0 | 3,854 |
import time
import os
import platform
import sys
if platform.system() != 'Linux':
print 'Skipped for non Linux platform'
sys.exit(0)
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from nw_util import *
from selenium import webdriver
from selenium.webdriver.chrome.options import ... | nwjs/nw.js | test/sanity/issue5980-aws-sdk-embedded-youtobe-video-crash/test.py | Python | mit | 1,545 |
from __future__ import absolute_import
import six
from functools import total_ordering
from sentry.utils.compat import implements_to_string
@implements_to_string
@total_ordering
class Problem(object):
# Used for issues that may render the system inoperable or have effects on
# data integrity (e.g. issues ... | JackDanger/sentry | src/sentry/status_checks/base.py | Python | bsd-3-clause | 1,898 |
# Telnet login data
HOST = 'shpiler.net'
TELNET_PORT = 30004
PASSWORD = 'JebKerman'
# TCP params
SOCKET_CONTROL_LENGTH = 5
TCP_PORT = 42404
# workers collections
PARSERS = (
'parsers.chat.ChatParser',
'parsers.heartbeat.HeartBeatParser',
# 'parsers.playerenterpf.PlayerEnterPFParser',
# 'parsers.player... | Glucksistemi/EGS-DSM | core/settings.py | Python | bsd-3-clause | 1,413 |
import argparse
import progressbar
from baselines.common.azure_utils import Container
def parse_args():
parser = argparse.ArgumentParser("Download a pretrained model from Azure.")
# Environment
parser.add_argument("--model-dir", type=str, default=None,
help="save model in this dir... | ViktorM/baselines | baselines/deepq/experiments/atari/download_model.py | Python | mit | 1,779 |
# Copyright 2019 Oihane Crucelaegui - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo.tests import common
class ProductUsability(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(ProductUsability, cls).setUpClass()
cls.category_model = cl... | oihane/odoo-addons | product_usability/tests/common.py | Python | agpl-3.0 | 615 |
from django import template
from django.contrib.contenttypes.models import ContentType
from molo.commenting.models import MoloComment
# NOTE: heavily inspired by
# https://github.com/santiagobasulto/django-comments-utils
register = template.Library()
def get_molo_comments(parser, token):
"""
Get a l... | praekelt/molo.commenting | molo/commenting/templatetags/molo_commenting_tags.py | Python | bsd-2-clause | 5,536 |
# -*- Mode:Python -*-
##########################################################################
# #
# This file is part of AVANGO. #
# ... | jakobharlan/avango | avango-display/python/avango/display/setups/AutoStereoDisplay.py | Python | lgpl-3.0 | 2,055 |
import numpy as np
from scipy.stats import t
import manager.operations.method as method
from manager.operations.methodsteps.selectanalyte import SelectAnalyte
from manager.operations.methodsteps.selectrange import SelectRange
import manager.plotmanager as pm
import manager.models as mmodels
from manager.helpers.fithelp... | efce/voltPy | manager/operations/methods/RegularStandardAddition.py | Python | gpl-3.0 | 6,619 |
# Copyright (c) 2012 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | JioCloud/neutron | neutron/tests/unit/common/test_utils.py | Python | apache-2.0 | 25,134 |
from __future__ import unicode_literals
from datetime import datetime
from operator import attrgetter
from django.test import TestCase
from .models import (Person, Group, Membership, CustomMembership,
PersonSelfRefM2M, Friendship, Event, Invitation, Employee, Relationship,
Ingredient, Recipe, RecipeIngredien... | iambibhas/django | tests/m2m_through/tests.py | Python | bsd-3-clause | 15,767 |
#
# 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... | apache/incubator-airflow | airflow/providers/google/marketing_platform/operators/search_ads.py | Python | apache-2.0 | 9,547 |
#
# Copyright (C) 2012, Martin Zibricky
#
# 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 distribute... | joaormatos/anaconda | Anaconda/standalone/trunk/buildtests/setupenv_unix.py | Python | gpl-3.0 | 1,879 |
"""
This is an example that uses the MidiToText eventhandler. When an
event is triggered on it, it prints the event to the console.
It gets the events from the MidiInFile.
So it prints all the events from the infile to the console. great for
debugging :-s
"""
# get data
test_file = 'test/midifiles/minimal-cubase-... | JonathanRaiman/Dali | data/score_informed_transcription/midi/example_print_file.py | Python | mit | 494 |
"""
Test how many times newly loaded binaries are notified;
they should be delivered in batches instead of one-by-one.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class ModuleLoadedNotifysTest... | apple/swift-lldb | packages/Python/lldbsuite/test/functionalities/target-new-solib-notifications/TestModuleLoadedNotifys.py | Python | apache-2.0 | 4,683 |
#pack.py
from tkinter import * #导入tkinter模块所有内容
root = Tk()
root.title("登录")
f1 = Frame(root); f1.pack() #界面分为上下3个Frame,f1放置第1行标签和文本框
f2 = Frame(root); f2.pack() #f2放置第2行标签和文本框
f3 = Frame(root); f3.pack() #f3放置第3行2个按钮
Label(f1, text="用户名").pack(side=LEFT) #标签放置在f1中,左停靠
Entry(f1).pack(side=LEFT) #单行文本框放置在f1中,左对齐
Label(... | GH1995/tools | archives/Python_江老师给的代码/chapter16/pack.py | Python | gpl-3.0 | 782 |
# Lint as: python2, python3
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | mlperf/training_results_v0.7 | Google/benchmarks/transformer/implementations/transformer-research-TF-tpu-v4-16/lingvo/model_imports.py | Python | apache-2.0 | 2,689 |
import os
import sys
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst', format='md')
except (IOError, ImportError):
long_description = open('README.md').read()
try:
from setuptools import setup, find_packages, Extension
except ImportError:
sys.stderr.write('Setuptools not... | FALCONN-LIB/FALCONN | src/python/package/setup.py | Python | mit | 1,325 |
"""
Create SQL statements for QuerySets.
The code in here encapsulates all of the SQL construction so that QuerySets
themselves do not have to (and could be backed by things other than SQL
databases). The abstraction barrier only works one way: this module has to know
all about the internals of models in order to get ... | aleksandra-tarkowska/django | django/db/models/sql/query.py | Python | bsd-3-clause | 93,321 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
SPELL=u'jūliáo'
CN=u'居髎'
NAME=u'juliao12'
CHANNEL='gallbladder'
CHANNEL_FULLNAME='GallbladderChannelofFoot-Shaoyang'
SEQ='GB29'
if __name__ == '__main__':
pass
| sinotradition/meridian | meridian/acupoints/juliao12.py | Python | apache-2.0 | 242 |
from pywps.Process import WPSProcess
class FirstProcess(WPSProcess):
def __init__(self):
WPSProcess.__init__(self,identifier="complexVector",
title="First Process",
abstract="Get vector imput and return it to output",
statu... | jachym/PyWPS-SVN | tests/processes/moreInOne.py | Python | gpl-2.0 | 1,512 |
#!/usr/bin/env python
#
# Copyright 2006,2007,2010,2011,2013 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, ... | awalls-cx18/gnuradio | gr-digital/python/digital/qa_hdlc_framer.py | Python | gpl-3.0 | 2,222 |
import sys
sys.path.append("../build")
import os
here = os.path.dirname(os.path.realpath(__file__))
import numpy as np
import matplotlib.pyplot as plt
import pyrfr.regression
data_set_prefix = '%(here)s/../test_data_sets/diabetes_' % {"here":here}
features = np.loadtxt(data_set_prefix+'features.csv', delimiter=... | sfalkner/random_forest_run | pyrfr/examples/pyrfr_oob_error.py | Python | bsd-3-clause | 2,227 |
# 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 ... | julienvey/solum | solum/openstack/common/db/sqlalchemy/session.py | Python | apache-2.0 | 33,708 |
#!/usr/bin/python
import os, sys, re, time
import ParseGetPot, Factory
from MooseObject import MooseObject
from Warehouse import Warehouse
"""
Parser object for reading GetPot formatted files
"""
class Parser:
def __init__(self, factory, warehouse):
self.factory = factory
self.warehouse = warehouse
sel... | vityurkiv/Ox | python/FactorySystem/Parser.py | Python | lgpl-2.1 | 5,998 |
# Necessary to supress on error in Python 2.7.3 at the completion of
# python setup.py test.
# See http://bugs.python.org/issue15881#msg170215
import multiprocessing # NOQA
import distutils.command.clean
import os
import pkg_resources
import setuptools
import subprocess
class Clean(distutils.command.clean.cle... | bradsokol/PyLCP | setup.py | Python | bsd-3-clause | 2,835 |
#
# Tests for the lambertw function,
# Adapted from the MPMath tests [1] by Yosef Meller, mellerf@netvision.net.il
# Distributed under the same license as SciPy itself.
#
# [1] mpmath source code, Subversion revision 992
# http://code.google.com/p/mpmath/source/browse/trunk/mpmath/tests/test_functions2.py?spec=svn9... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/scipy/special/tests/test_lambertw.py | Python | mit | 4,318 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2017 Bitergia
#
# 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 ... | sduenas/perceval | perceval/utils.py | Python | gpl-3.0 | 8,300 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('information', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='informationdetail',
... | zacherytapp/wedding | weddingapp/apps/information/migrations/0002_auto_20151102_0334.py | Python | bsd-3-clause | 508 |
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | sebbrandt87/jenkins-job-builder | jenkins_jobs/modules/triggers.py | Python | apache-2.0 | 54,956 |
import os
import xml.dom.minidom
class Filter:
def __init__(self,_include,_items):
self.include = _include
self.items = _items
def match(self,msg):
for i in self.items:
if not i.match(msg):
return False
return True
def parseAll(xml):
fs = Filter.parse(xml.getElementsByTagName("fi... | stenbacka/irc2you | server/filter.py | Python | bsd-3-clause | 572 |
import copy
from typing import Type, TypeVar, MutableMapping, Any, Iterable
from collections import defaultdict
from datapipelines import DataSource, PipelineContext, Query, NotFoundError, validate_query
from ..data import Platform
from ..dto.staticdata.champion import ChampionDto, ChampionListDto
from ..dto.staticda... | sserrot/champion_relationships | venv/Lib/site-packages/cassiopeia/datastores/ddragon.py | Python | mit | 30,073 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | Inspq/ansible | lib/ansible/module_utils/ec2.py | Python | gpl-3.0 | 21,973 |
#! /usr/bin/env python
# coding: utf-8
#
# CCI's boto convenience functions.
#
# SVN: $Id: cci_boto.py 43293 2014-08-18 17:40:22Z svnsync $
# Created: 2014.06.11
# Copyright: Steven E. Pav, 2014
# Author: Steven E. Pav
# Comments: Steven E. Pav
from boto.glacier import connect_to_region
import time
from os.path import... | shabbychef/boto_wrapper | bin/cci_boto.py | Python | gpl-2.0 | 3,239 |
from cs50 import SQL
from flask import session
from helpers import usd
db = SQL("sqlite:///finance.db")
def get_cash():
return float(db.execute("SELECT cash FROM users WHERE id = :id",
id=session["user_id"])[0]["cash"])
def get_username():
return db.execute("SELECT username FROM ... | marzique/cs50_finance | sqlquery.py | Python | mit | 382 |
#!/usr/bin/env python
import socket
def tcpClient():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('192.168.0.101', 8889))
s.listen(10)
while True:
c, a = s.accept()
print 'got connection from', a
c.send('hello, this is server')
r = c.recv(400)
print 'read to server', r
c.send('hello ag... | oxnz/NZChat | cast/x.py | Python | mit | 409 |
# from sys import argv as a
# script, first, second, third = a
# print ("The script is called:", script)
# print ("Your first variable is:", first)
# print ("Your second variable is:", second)
# print ("Your third variable is:", third)
from sys import argv
script, txt1, txt2 = argv
print (argv) | ismk/Python-Examples | learn python the hard way/ex13.py | Python | mit | 315 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013, 2014 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
# Multi-tool support by Javier D. Garcia-Lasheras (javier@garcialasheras.com)
#
# This file is part of Hdlmake.
#
# Hdlmake is free software: you can redistribute it and/or modify
# it under the t... | JamesHyunKim/myhdl | hdlmake/action/remote_synthesis.py | Python | gpl-3.0 | 3,420 |
from flask import Blueprint, jsonify, request
routes_api = Blueprint('routes_api', __name__)
@routes_api.route('/v1/routes', methods=['GET'])
def routes_get():
'''
Get a list of routes
It is handler for GET /routes
'''
return jsonify()
| ridindirtyatl/truffle-api | routes.py | Python | agpl-3.0 | 261 |
from __future__ import unicode_literals
from .application import Application
from .current import get_app, set_app, NoRunningApplicationError
from .dummy import DummyApplication
from .run_in_terminal import run_in_terminal, run_coroutine_in_terminal
__all__ = [
# Application.
'Application',
# Current.
... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/prompt_toolkit/application/__init__.py | Python | mit | 499 |
#!/usr/bin/python
#-*- coding: utf-8 -*-
#encoding=utf-8
'''
/*
* Copyright (c) 2018, https://github.com/nebulaim
* 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 ... | nebulaim/telegramd | server/biz_server/langpack/model/codegen_lang_pack.py | Python | apache-2.0 | 2,877 |
"""
Openepr Console based on rconsole
A Python console you can embed in a program and attach to remotely.
"""
import getopt
import sys
import os
import rfoo.utils.rconsole as rconsole
def print_usage():
scriptName = os.path.basename(sys.argv[0])
sys.stdout.write("""
Start remote console:
%(name)s ... | chengdh/openerp-ktv | openerp-console.py | Python | agpl-3.0 | 1,002 |
import numpy as np
import scipy.sparse as sp
from scipy import linalg
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_a... | treycausey/scikit-learn | sklearn/linear_model/tests/test_ridge.py | Python | bsd-3-clause | 17,457 |
from httpobs.website.decorators import add_response_headers, sanitized_api_response
__all__ = ['add_response_headers',
'sanitized_api_response']
| april/http-observatory | httpobs/website/__init__.py | Python | mpl-2.0 | 157 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 University of Dundee & Open Microscopy Environment.
# All Rights Reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
"""
FOR TRAINING PURPOSES ONLY!
"""
from omero.gateway import BlitzGateway
from Parse_OMERO_Pr... | joansmith/openmicroscopy | examples/Training/python/Create_Image.py | Python | gpl-2.0 | 3,793 |
class Solution(object):
def compareVersion(self, version1, version2):
"""
:type version1: str
:type version2: str
:rtype: int
"""
vl1 = version1.split('.')
vl2 = version2.split('.')
mix = len(vl1)
if len(vl2) < mix:
mix = len(vl2)
... | CharlotteLock/LeetCode | 165. Compare Version Numbers.py | Python | gpl-3.0 | 671 |
# 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 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it w... | henrysher/urlgrabber | urlgrabber/grabber.py | Python | lgpl-2.1 | 96,279 |
from .qmpdsocket import QMPDSocket
assert QMPDSocket
| duganchen/qmpdsocket | qmpdsocket/__init__.py | Python | mit | 53 |
#
# Test database for rsvndump
# written by Jonas Gehring
#
import os
import test_api
def info():
return "Copying test with modifications on sub-directories [bugreport from Valentin Haenel]"
def setup(step,log):
if step == 0:
os.mkdir("a")
os.mkdir("a/dir1")
os.mkdir("a/dir2")
f = open("a/dir1/file1","w... | jgehring/rsvndump | tests/db/tests/copy_modify3.py | Python | gpl-3.0 | 990 |
import unittest
import common
import trezorlib.ckd_public as bip32
import trezorlib.types_pb2 as proto_types
import binascii
class TestMsgGetaddress(common.TrezorTest):
def test_show(self):
self.setup_mnemonic_nopin_nopassphrase()
self.assertEqual(self.client.get_address('Bitcoin', [1], show_displ... | runn1ng/python-trezor | tests/test_msg_getaddress_show.py | Python | lgpl-3.0 | 2,252 |
# -*- coding: utf-8 -*-
#!/usr/bin/python
import numpy as np
import scipy
from sklearn import preprocessing
from sklearn.feature_extraction import DictVectorizer
from sklearn.cross_validation import train_test_split
from sklearn.metrics import classification_report, confusion_matrix
from collections import Counter
fro... | ptoman/icgauge | icgauge/experiment_frameworks.py | Python | mit | 11,989 |
from __future__ import division
import numpy as np
np.seterr(divide='ignore') # these warnings are usually harmless for this code
from matplotlib import pyplot as plt
import matplotlib
import os
matplotlib.rcParams['font.size'] = 8
import pyhsmm
from pyhsmm.util.text import progprint_xrange
save_images = False
#### ... | theDataGeek/pyhsmm | examples/hmm-EM.py | Python | mit | 1,294 |
"""
Support for monitoring a Smappee energy sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.smappee/
"""
import logging
from datetime import timedelta
from homeassistant.components.smappee import DATA_SMAPPEE
from homeassistant.helpers.ent... | PetePriority/home-assistant | homeassistant/components/smappee/sensor.py | Python | apache-2.0 | 7,878 |
#
# 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 us... | DataReplyUK/datareplyuk | GenesAssociation/spark-2.0.0-bin-hadoop2.7/python/pyspark/graphframes/graphframe.py | Python | apache-2.0 | 12,224 |
# Copyright (C) 2015 Allen Li
#
# This file is part of Dantalian.
#
# Dantalian 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.
#
# Da... | darkfeline/dantalian | src/dantalian/pathlib.py | Python | gpl-3.0 | 2,387 |
# This file is part of Moksha.
# Copyright (C) 2008-2010 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 b... | lmacken/moksha | moksha/apps/feeds/moksha/apps/feeds/controllers/root.py | Python | apache-2.0 | 5,074 |
import logging
import testUtils as utils
import time
import threading
import pytest
from conftest import IPADDRESS1, \
RESOURCE, \
DUMMYVAL, \
OSCORECLIENTCONTEXT
from coap import coapDefines as d, \
coapException as... | openwsn-berkeley/coap | tests/func/test_timeout_CON.py | Python | bsd-3-clause | 1,466 |
# coding=utf-8
from functools import wraps
from flask import abort, flash, redirect, url_for, current_app
from flask.ext.login import current_user
from .models import Permission
def permission_required(permission):
def decorator(f):
@wraps(f)
def decorated_function(*args,**kwargs):
if not current_user.can(perm... | tianmaxingkonggrant/tianmaflaskblog | app/decorator.py | Python | mit | 824 |
from zerver.lib.test_classes import WebhookTestCase
class DialogflowHookTests(WebhookTestCase):
URL_TEMPLATE = "/api/v1/external/dialogflow?api_key={api_key}&email=AARON@zulip.com"
WEBHOOK_DIR_NAME = "dialogflow"
def test_dialogflow_default(self) -> None:
email = self.example_user("aaron").email
... | eeshangarg/zulip | zerver/webhooks/dialogflow/tests.py | Python | apache-2.0 | 1,732 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# 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 Lic... | thaim/ansible | lib/ansible/modules/network/fortios/fortios_system_dedicated_mgmt.py | Python | mit | 10,367 |
from ._paths import *
from ._pscmanipulate import *
| exe0cdc/PyscesToolbox | psctb/modeltools/__init__.py | Python | bsd-3-clause | 52 |
# Copyright 2004-2017 Tom Rothamel <pytom@bishoujo.us>
#
# 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, modify, m... | kfcpaladin/sze-the-game | renpy/__init__.py | Python | mit | 17,178 |
# encoding: utf-8
"""
Test suite for pptx.text.layout module
"""
from __future__ import absolute_import, print_function, unicode_literals
import pytest
from pptx.text.layout import (
_BinarySearchTree, _Line, _LineSource, TextFitter
)
from ..unitutil.mock import (
call, class_mock, function_mock, initializ... | kevingu1003/python-pptx | tests/text/test_layout.py | Python | mit | 10,588 |
import numpy as np
__all__ = ['gp_predict', 'gp_covariance']
def gp_kernel(x, y, kernel_type='gaussian', **kwargs):
"""
Gaussian process kernel score
"""
if kernel_type == 'gaussian':
beta = kwargs.get('beta', 0.3)
return np.exp(-((x[0] - y[0]) ** 2 +
(x[1] - y[... | makokal/scalable-irl | sirl/algorithms/function_approximation.py | Python | bsd-3-clause | 1,647 |
#!/usr/bin/env python3
import argparse
import sys
import re
import logging
from models import LineChange
module = sys.modules['__main__'].__file__
log = logging.getLogger(module)
class DiffParser:
def __init__(self, filename=None, diff_content=None):
if filename != None:
self.load_file(file... | chrisma/marvin | parse.py | Python | mit | 8,492 |
"""Module containing class `RecordingImporter`."""
from pathlib import Path
import itertools
import logging
import os
from django.db import transaction
from vesper.command.command import CommandExecutionError
from vesper.django.app.models import (
DeviceConnection, Job, Recording, RecordingChannel, RecordingFil... | HaroldMills/Vesper | vesper/command/recording_importer.py | Python | mit | 13,776 |
# author : Johann-Mattis List
# email : mattis.list@uni-marburg.de
# created : 2015-03-23 14:23
# modified : 2015-03-23 14:23
"""
<++>
"""
__author__="Johann-Mattis List"
__date__="2015-03-23"
from lingpy import *
import sys
list1 = csv2list(sys.argv[1])
header1 = list1[0]
list2 = csv2list(sys.argv[2])
header2... | digling/sinotibetan | scripts/compare_lists.py | Python | gpl-2.0 | 1,606 |
# -*- coding: utf-8 -*-
#
# satcfe/tests/conftest.py
#
# Copyright 2015 Base4 Sistemas Ltda ME
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | kmee/satcfe | satcfe/tests/conftest.py | Python | apache-2.0 | 8,960 |
#!/usr/bin/python
# coding: utf-8
"""
Generate graph of profit against Stratagem data for 2012.
"""
__author__ = 'riko'
import datetime
import matplotlib.pyplot as plt
import numpy as np
import pickle
import data_tools as dt
import models
import settings as stg
####################################################... | erix5son/Tennis-Modelling | demos/double_elo_profit.py | Python | mit | 2,546 |
#!/usr/bin/env python3
"""inject_repos.py - CI secret repos injection.
"""
import yaml
from lxml import etree
from lxml.etree import ElementTree as ET
import argparse
from six import iteritems
def main():
repos_file, beaker_file = parse_args()
repos = load_secret_data(repos_file)
inject_repos(repos, beaker... | oVirt/jenkins | stdci_libs/inject_repos.py | Python | gpl-3.0 | 1,611 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bill_board', '0003_auto_20151025_1339'),
]
operations = [
migrations.AlterField(
model_name='request',
... | refugeehackathon/interpreteer-backend | bill_board/migrations/0004_auto_20151109_1707.py | Python | gpl-2.0 | 420 |
# -*- coding: utf-8 -*-
__author__ = "Sergey Aganezov"
__email__ = "aganezov@gwu.edu"
__status__ = "develop"
| aganezov/fga | tests/assembly/fgr/__init__.py | Python | gpl-3.0 | 110 |
#!/usr/bin/env python
# Copyright (C) 2006-2021 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... | MTG/essentia | test/src/unittests/temporal/test_loudnessvickers.py | Python | agpl-3.0 | 2,639 |
import sqlite3
def main():
conn = sqlite3.connect("../database")
cursor = conn.cursor()
# I claim this gives the current score. Another formulation is
# select trackid, score, max(scoreid) from scores group by trackid;
# cursor.execute("""select trackid, score from scores
# gro... | erbridge/NQr | src/export.py | Python | bsd-3-clause | 834 |
#! /usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2014 Wen Shan Chang
#
# 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 r... | wschang/DrawQtree | display_qtree.py | Python | mit | 4,937 |
from __future__ import division
import importlib
import re
import time
class SkeletonMode(object):
"""Skeleton (base) mode.
This mode can take two commands:
- change to another mode
- print help
It is also able to send messages to the channel.
This mode must superclass all... | PyCon/pc-bot | pycon_bot/modes/base.py | Python | bsd-3-clause | 12,485 |
#!/usr/bin/env python
#############################################################
# ubi_reader
# (c) 2013 Jason Pruitt (jrspruitt@gmail.com)
#
# 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, e... | leonsio/YAHM | share/tools/ubi_reader/ubifs_extract_files.py | Python | cc0-1.0 | 3,501 |
import os
import sys
import os.path
import errno
import shutil
from distutils import util
from Config import Config
supportedLanguages = ["C", "C++", "Java", "Python"]
class ConfigInfo:
'''
This class contains information about the config file
while providing options to directly access the flags
sect... | caseycas/gitcproc | src/util/Util.py | Python | bsd-3-clause | 2,866 |
"""
mbed SDK
Copyright (c) 2016 ARM Limited
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... | fahhem/mbed-os | tools/default_settings.py | Python | apache-2.0 | 1,329 |
# -*- coding: utf-8 -*-
from openfisca_france.model.base import *
class chomeur_longue_duree(Variable):
cerfa_field = {
0: u"1AI",
1: u"1BI",
2: u"1CI",
3: u"1DI",
4: u"1EI",
}
value_type = bool
entity = Individu
label = u"Demandeur d'emploi inscrit dep... | antoinearnoud/openfisca-france | openfisca_france/model/revenus/remplacement/chomage.py | Python | agpl-3.0 | 889 |
# -*- coding: utf-8 -*-
"""
Base settings file, common to all environments.
These settings can be overridden in local.py.
"""
import datetime
import os
import json
import hashlib
import logging
from datetime import timedelta
from collections import OrderedDict
os_env = os.environ
def parent_dir(path):
'''Return... | caneruguz/osf.io | website/settings/defaults.py | Python | apache-2.0 | 46,262 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("GradientBoostingClassifier" , "FourClass_10" , "oracle")
| antoinecarme/sklearn2sql_heroku | tests/classification/FourClass_10/ws_FourClass_10_GradientBoostingClassifier_oracle_code_gen.py | Python | bsd-3-clause | 154 |
from __future__ import annotations
import pytest_mock
from xia2.cli.delta_cc_half import run
from xia2.Modules.DeltaCcHalf import DeltaCcHalf
def test_from_experiments_reflections(dials_data, tmpdir, capsys, mocker):
data_dir = dials_data("l_cysteine_4_sweeps_scaled")
input_files = data_dir.listdir("scaled_... | xia2/xia2 | tests/regression/test_delta_cc_half.py | Python | bsd-3-clause | 2,567 |
import fileinput
for line in fileinput.input(inplace=True, backup='.bak'):
if fileinput.isfirstline():
do_print = True
dash_num = 0
if do_print:
print (line, end='')
if line.startswith("---"):
dash_num += 1
if dash_num == 2:
do_print = False
| casutton/casutton.github.io | _scripts/before-dash.py | Python | mit | 299 |
# -*- coding: utf-8 -*-
'''
Little script meant to analyse elemental statistical stuff about the
sequence of dice numbers rolled during a TEG game. The primary goal is
to find out if different playes tend to score differently. I start by
making a histogram of each player's performance.
Part of the code in the functi... | sebalander/tegstatistics | tegstatistics.py | Python | gpl-3.0 | 6,985 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('VERSION', 'r') as version_file:
version = version_file.read().rstrip()
with open('README.rst', 'r') as readme_file:
long_desc = readme_file.read()
requires = ['Sphinx >= 1.0']
setup(
name='sphinxcontrib-cheader',
version... | Lemma1/MAC-POSTS | doc_builder/sphinx-contrib/cheader/setup.py | Python | mit | 1,194 |
"""
Models used by the block structure framework.
"""
from __future__ import absolute_import
import errno
from contextlib import contextmanager
from datetime import datetime
from logging import getLogger
import six
from six.moves import map
from django.conf import settings
from django.core.exceptions import Suspicio... | ESOedX/edx-platform | openedx/core/djangoapps/content/block_structure/models.py | Python | agpl-3.0 | 9,770 |
from django import forms
from django.core.exceptions import ImproperlyConfigured
from payment import signals
from payment.forms import SimplePayShipForm
from payment.modules.purchaseorder.models import PurchaseOrder
from satchmo_utils import app_enabled
from signals_ahoy import signals
class PurchaseorderPayShipForm(S... | russellmayhew/satchmo | satchmo/apps/payment/modules/purchaseorder/forms.py | Python | bsd-3-clause | 1,253 |
import argparse
import os
import subprocess
from platform import python_version
from py3status.version import version
def parse_cli_args():
"""
Parse the command line arguments
"""
# get config paths
home_path = os.path.expanduser("~")
xdg_home_path = os.environ.get("XDG_CONFIG_HOME", "{}/.co... | Andrwe/py3status | py3status/argparsers.py | Python | bsd-3-clause | 6,668 |
import os
import pathlib
# RELEASE-UPDATE
APP_DIR = pathlib.Path(os.path.realpath(__file__)).parent.parent
ROOT_DIR = APP_DIR.parent
DEFAULT_DB_PATH = '/instance/storage'
PROJECT_NAME = 'Zordon'
PROJECT_VERSION = '4.0.0'
PROJECT_FULL_NAME = '{} v{}'.format(PROJECT_NAME, PROJECT_VERSION)
| KrusnikViers/Zordon | app/core/info.py | Python | mit | 290 |
'''
'''
def main():
info('trap in pipette')
close(description='Bone to Minibone')
close(description='Minibone to Bone')
sleep(2)
open(description='Bone to Turbo')
sleep(15)
close(description='Bone to Turbo')
sleep(2)
open(description='Bone to Minibone')
| UManPychron/pychron | docs/user_guide/operation/scripts/examples/helix/extraction/felix/TrapInBonePipette.py | Python | apache-2.0 | 291 |
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above... | Marilynmontu/final-competiton | mk/VRBRAIN/Tools/genmsg/src/genmsg/srvs.py | Python | gpl-3.0 | 3,017 |
"""empty message
Revision ID: 01356afcc714
Revises: 356add9f6b39
Create Date: 2017-09-25 18:36:08.427994
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '01356afcc714'
down_revision = '356add9f6b39'
branch_labels = None
depends_on = None
def upgrade():
# ... | ahoarfrost/metaseek | server/migrations/versions/01356afcc714_.py | Python | mit | 670 |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import httplib
import urllib
import time
import re
from tweepy.error import TweepError
from tweepy.utils import convert_to_utf8_str
from tweepy.models import Model
re_path_template = re.compile('{\w+}')
def bind_api(**config):
class AP... | olemoudi/tweetdigest | tweepy/tweepy/binder.py | Python | apache-2.0 | 7,174 |
# -*- 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... | GRArmstrong/invenio-inspire-ops | modules/webjournal/lib/webjournal_utils.py | Python | gpl-2.0 | 69,087 |
import logging
from alvi.tests.test_client.base import TestContainer
import alvi.tests.pages as pages
logger = logging.getLogger(__name__)
class TestScenes(TestContainer):
def test_check_scenes(self):
home_page = pages.Home(self._browser.driver)
home_page.goto()
scene_links = home_page.s... | alviproject/alvi | alvi/tests/test_client/test_scenes.py | Python | mit | 515 |
"""
"""
from bs4 import BeautifulSoup
import requests
from framework import fields
from website.addons.base import AddonNodeSettingsBase
API_URL = 'https://api.zotero.org/groups/{zid}/items'
params = {
'order': 'dateAdded',
'sort': 'desc',
'limit': 5,
}
class AddonZoteroNodeSettings(AddonNodeSettings... | AndrewSallans/osf.io | website/addons/zotero/model.py | Python | apache-2.0 | 1,191 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.