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 |
|---|---|---|---|---|---|
# Midi note chart
NOTE_TO_MIDI = {
# octave -2
'C-2' : 0, 'C#-2': 1, 'Db-2': 1, 'D-2' : 2, 'D#-2': 3,
'Eb-2': 3, 'E-2' : 4, 'F-2' : 5, 'F#-2': 6,
'Gb-2': 6, 'G-2' : 7, 'G#-2': 8,
'Ab-2': 8, 'A-2' : 9, 'A#-2': 10, 'Bb-2': 10, 'B-2' : 11,
# octave -1
'C-1' : 12, 'C#-1': 13, 'Db-1': 13, 'D-1' : 14, 'D#-1': 15,
'Eb-... | hashbangstudio/Sonic-Pi-Extras | midiNotes.py | Python | bsd-3-clause | 4,970 |
options = [
["empty_options", "", {}],
["single_basic", "no-user-rc", {
"no-user-rc": [True]
}],
[
"single_quoted", 'from="*.sales.example.net,!pc.sales.example.net"', {
'from': ['*.sales.example.net,!pc.sales.example.net']
}
],
["equals_in_quotes", 'environme... | ojarva/python-sshpubkeys | tests/valid_options.py | Python | bsd-3-clause | 826 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup script for wger Workout manager
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
from setuptools import (
setup,
find_packages
)
from wger import get_version
with open('README.rst'... | DeveloperMal/wger | setup.py | Python | agpl-3.0 | 1,671 |
# -*- coding: utf-8 -*-
"""**Postprocessors package.**
"""
__author__ = 'Marco Bernasocchi <marco@opengis.ch>'
__revision__ = '$Format:%H$'
__date__ = '13/03/2014'
__license__ = "GPL"
__copyright__ = 'Copyright 2012, Australia Indonesia Facility for '
__copyright__ += 'Disaster Reduction'
import unittest
from safe.... | Samweli/inasafe | safe/postprocessors/test/test_age_postprocessor.py | Python | gpl-3.0 | 2,140 |
"""
"""
import unittest
def sort_scores(unsorted_scores, highest_possible_scores):
counted_scores = [0] * (highest_possible_scores + 1)
for score in unsorted_scores:
counted_scores[score] += 1
sorted_scores = []
for i, scores in enumerate(counted_scores):
for _ in range(scores):
... | MFry/pyAlgoDataStructures | Interview_Cake/p32_top_scores.py | Python | mit | 544 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import urllib.request, urllib.error, urllib.parse
import ui
from PyQt4 import QtCore, QtGui, uic
import models
from utils import validate_ISBN, SCRIPTPATH
from metadata import BookMetadata
from pluginmgr import manager, isPluginEnabled
from templite... | webmedic/booker | src/book_editor.py | Python | mit | 16,997 |
#!/usr/bin/env python
#
# Wrapper script for Java Conda packages that ensures that the java runtime
# is invoked with the right options. Adapted from the bash script (http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/246128#246128).
#
#
# Program Parameters
#
import os
import... | jerowe/bioconda-recipes | recipes/multivcfanalyzer/multivcfanalyzer.py | Python | mit | 2,663 |
from django import forms
from django.contrib.auth.models import User
from .models import Video
CHOICES = [('defaultKey', 'default')]
class VideosForm(forms.ModelForm):
"""
The form used to create a video
"""
class Meta(object):
"""
The fields used when creating the video form
... | ProtonHackers/Incredible-Filter | web/website/forms.py | Python | lgpl-2.1 | 695 |
#!/usr/bin/python
#
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview... | alexlo03/ansible | lib/ansible/modules/cloud/azure/azure_rm_deployment.py | Python | gpl-3.0 | 27,348 |
"""
This module contains fixups for using nose under different versions of Python.
"""
import sys
import os
import traceback
import types
import inspect
import nose.util
__all__ = ['make_instancemethod', 'cmp_to_key', 'sort_list', 'ClassType',
'TypeType', 'UNICODE_STRINGS', 'unbound_method', 'ismethod',
... | Byron/bdep-oss | lib/nose/py2_1.3.1/noarch/nose/pyversion.py | Python | lgpl-3.0 | 7,382 |
"""
Support for SQLite3
"""
try:
import sqlite3
HAS_SQLITE3 = True
except ImportError:
HAS_SQLITE3 = False
# pylint: disable=C0103
def __virtual__():
if not HAS_SQLITE3:
return (
False,
"The sqlite3 execution module failed to load: the sqlite3 python library is"
... | saltstack/salt | salt/modules/sqlite3.py | Python | apache-2.0 | 2,602 |
"""A simple distributed shuffle implementation in Ray.
This utility provides a `simple_shuffle` function that can be used to
redistribute M input partitions into N output partitions. It does this with
a single wave of shuffle map tasks followed by a single wave of shuffle reduce
tasks. Each shuffle map task generates ... | ray-project/ray | python/ray/experimental/shuffle.py | Python | apache-2.0 | 11,695 |
#! -*- coding: utf8 -*-
import errors
import copy
import json
import uuid
import redis
class DataFactory:
def create(self, store_type, url):
if store_type == "local":
return LocalJsonStorage(url)
# For debuging and testing locallly
class LocalJsonStorage:
def __init__(self, url=None):
... | plusplus7/EasyMemo2 | data.py | Python | mit | 5,347 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Day'
db.delete_table('tafe_day')
# Deleting field 'Session.day'
db.delete... | datakid/tvet | tafe/migrations/0004_auto__del_day__del_field_session_day__add_field_session_date.py | Python | gpl-3.0 | 8,453 |
"""example_project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
C... | cdriehuys/django_helpcenter | example_project/example_project/urls.py | Python | mit | 823 |
"""
Version module.
This module defines the package version for use in __init__.py and setup.py.
"""
__version__ = '0.1.20'
| Intelworks/cabby | cabby/_version.py | Python | bsd-3-clause | 125 |
from . import items
from .curses_menu import CursesMenu
from .item_group import ItemGroup
__all__ = ["CursesMenu", "ItemGroup", "items"]
__version__ = "0.6.0"
| pmbarrett314/curses-menu | cursesmenu/__init__.py | Python | mit | 161 |
from gssapi.raw import oids as roids
from gssapi._utils import import_gssapi_extension
from gssapi.raw import misc as rmisc
from gssapi import _utils
rfc5587 = import_gssapi_extension('rfc5587')
rfc5801 = import_gssapi_extension('rfc5801')
class Mechanism(roids.OID):
"""
A GSSAPI Mechanism
This class re... | pythongssapi/debian-python-gssapi | gssapi/mechs.py | Python | isc | 5,719 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Creates a C code lookup table for doing ADC to temperature conversion
# on a microcontroller
# based on: http://hydraraptor.blogspot.com/2007/10/measuring-temperature-easy-way.html
# Modified Thu 10 Feb 2011 02:02:28 PM MST jgilmore for 5D_on_arduino firmware
# temps are no... | Axford/AFRo_Firmware | createTemperatureLookup.py | Python | gpl-2.0 | 9,122 |
#
# GingaCanvasQt.py -- classes for the display of FITS files in
# Matplotlib FigureCanvas
#
# 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.
fr... | Cadair/ginga | ginga/mplw/FigureCanvasQt.py | Python | bsd-3-clause | 2,413 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from base import PagueVelozClient
VERSAO = 'v3'
class Boleto(PagueVelozClient):
'''Serviço de emissão e consulta de Boletos Bancários.'''
def __init__(self, chave=None):
PagueVelozClient.__init__(self, VERSAO, 'Boleto', chave) | PagueVeloz/ClientAPI | python/pagueveloz/api/v3.py | Python | mit | 295 |
import functools
import flask_login
import signals
import inspect
from mocha import (utils,
abort,
request,
)
from mocha.core import apply_function_to_members
from . import (is_authenticated,
not_authenticated,
ROLES_ADMIN,
... | mardix/Mocha | mocha/contrib/auth/decorators.py | Python | mit | 5,732 |
from fauxfactory import gen_string
from robottelo.constants import DEFAULT_CV
from robottelo.constants import ENVIRONMENT
def create_fake_host(
session,
host,
interface_id=gen_string('alpha'),
global_parameters=None,
host_parameters=None,
extra_values=None,
):
if extra_values is None:
... | rplevka/robottelo | robottelo/ui/utils.py | Python | gpl-3.0 | 1,733 |
from ansible.compat.tests.mock import MagicMock
from ansible.utils.path import unfrackpath
mock_unfrackpath_noop = MagicMock(spec_set=unfrackpath, side_effect=lambda x, *args, **kwargs: x)
| tsdmgz/ansible | test/units/mock/path.py | Python | gpl-3.0 | 191 |
from twisted.trial import unittest
from twisted.internet import defer, reactor
from mock import Mock
from cyclone import web
from cyclone.template import DictLoader
class TestUrlSpec(unittest.TestCase):
def test_reverse(self):
spec = web.URLSpec("/page", None)
self.assertEqual(spec.reverse(), "/p... | dpnova/cyclone | cyclone/tests/test_web.py | Python | apache-2.0 | 4,657 |
# Copyright 2017, Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | eoogbe/api-client-staging | generated/python/gapic-google-cloud-spanner-admin-instance-v1/test/google/cloud/gapic/spanner_admin_instance/v1/test_instance_admin_client.py | Python | bsd-3-clause | 21,088 |
"""
Support for interacting with Digital Ocean droplets.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/switch.digital_ocean/
"""
import logging
import voluptuous as vol
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
from ... | kyvinh/home-assistant | homeassistant/components/switch/digital_ocean.py | Python | apache-2.0 | 3,012 |
# TFL Line Status Server written in Flask and Redis
# Part of the Final Year Project by Suhail Patel
# at the University of Birmingham Computer Science 2013
#
# Copyright 2013 Suhail Patel/University of Birmingham
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | suhailpatel/tfl-linestatus | src/cron/platform_status.py | Python | gpl-3.0 | 2,414 |
import passwordHelper
import gameModes
import glob
def getID(username):
"""
Get username's user ID
db -- database connection
username -- user
return -- user id or False
"""
# Get user ID from db
userID = glob.db.fetch("SELECT id FROM users WHERE username = ?", [username])
# Make sure the query returned som... | osuripple/ripple | c.ppy.sh/userHelper.py | Python | mit | 6,735 |
#!/usr/bin/env python3
import argparse
import csv
import cv2
import skvideo.io # pip3 install sk-video
import json
import math
import numpy as np
import os
from tqdm import tqdm
from props import PropertyNode
import props_json
import sys
sys.path.append('../scripts')
from lib import transformations
im... | UASLab/ImageAnalysis | motion/motion2.py | Python | mit | 9,330 |
import supriya.osc
from supriya.commands.Request import Request
from supriya.enums import RequestId
class BufferNormalizeRequest(Request):
"""
A `/b_gen normalize` request.
::
>>> import supriya.commands
>>> request = supriya.commands.BufferNormalizeRequest(
... buffer_id=23,... | Pulgama/supriya | supriya/commands/BufferNormalizeRequest.py | Python | mit | 2,022 |
import re
import uuid as py_uuid
from common import * # NOQA
from test_volume import VOLUME_CLEANUP_LABEL
TEST_IMAGE = 'ibuildthecloud/helloworld'
TEST_IMAGE_LATEST = TEST_IMAGE + ':latest'
TEST_IMAGE_UUID = 'docker:' + TEST_IMAGE
if_docker = pytest.mark.skipif("os.environ.get('DOCKER_TEST') == 'false'",
... | vincent99/cattle | tests/integration-v1/cattletest/core/test_docker.py | Python | apache-2.0 | 32,770 |
"""Utility functions to safely evaluate mathematical expressions."""
import ast
import operator as op
# supported operators
operators = {ast.Add: op.add, ast.Sub: op.sub, ast.Mult: op.mul,
ast.Div: op.truediv, ast.BitXor: op.xor,
ast.USub: op.neg} # ast.Pow: op.pow
def eval_expr(expr):
"... | Armored-Dragon/goldmine | util/safe_math.py | Python | mit | 1,013 |
import numpy as np
from scipy.ndimage import label
def generate_test_vecs(infile, strelfile, resultfile):
"test label with different structuring element neighborhoods"
def bitimage(l):
return np.array([[c for c in s] for s in l]) == '1'
data = [np.ones((7, 7)),
bitimage(["1110111",
... | ales-erjavec/scipy | scipy/ndimage/utils/generate_label_testvectors.py | Python | bsd-3-clause | 1,672 |
# Copyright (c) 2013 Jose Cruz-Toledo
# 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, merge, publish, dis... | jctoledo/ligandneighbours | ligandneighbours.py | Python | mit | 10,769 |
#
# Vortex OpenSplice
#
# This software and documentation are Copyright 2006 to TO_YEAR ADLINK
# Technology Limited, its affiliated companies and licensors. All rights
# reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in ... | PrismTech/opensplice | src/api/dcps/python/test/__init__.py | Python | gpl-3.0 | 776 |
# -*- coding: utf-8 -*-
"""
Service for working with password resets.
"""
import uuid
from flask import current_app
_tokens_by_user = lambda u: 'pw_reset_tokens_{uid}'.format(uid=u.id)
def _generate_token():
return uuid.uuid4().hex
def tokens_for_user(user):
return current_app.redis.lrange(_tokens_by_use... | notifico/notifico | notifico/services/reset.py | Python | mit | 1,126 |
from __future__ import division
from lin_alg import *
from collections import Counter
def mean(x):
return sum(x) / len(x)
def median(v):
n = len(v)
sorted_v = sorted(v)
midpoint = n // 2
# gotta handle the even case and odd case
if n%2 == 1:
return sorted_v[midpoint]
else:
... | cwharland/data-science-from-scratch | stats.py | Python | mit | 1,388 |
# 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
# distrib... | ctrlaltdel/neutrinator | vendor/openstack/image/image_signer.py | Python | gpl-3.0 | 2,498 |
#!@PYTHON@
import re
import sys
PROGRAM = sys.argv[0]
VERSION = sys.argv[1]
defs = []
for i in open (VERSION).readlines ():
i = re.sub ('#.*','', i)
m = re.search ('([^ =]*)[\t ]*=[ \t]*([^ \t]*)[ \t]*\n', i)
if m:
defs.append ((m.group (1), m.group (2)))
sys.stdout.write (r'''
/*
Automatically ... | thSoft/lilypond-hu | scripts/build/make-version.py | Python | gpl-3.0 | 985 |
from django.test import TestCase
from objetos.models import Ingredient
class IngredientTestCase(TestCase):
def test_str(self):
ingredient = Ingredient.objects.create(description='Some description')
self.assertIsInstance(ingredient, Ingredient)
self.assertEqual(ingredient.description, str... | lucasgr7/silverplate | objetos/tests/test_model/test_ingredient.py | Python | mit | 334 |
from lazyrunner import pmodule, PModule, preset, presetTree, defaults
from treedict import TreeDict
p = defaults()
p.data_defaults.a = 1
p.data_defaults.b = 2
@preset
def change_default_a(p):
p.data_defaults.a = 10
@pmodule
class Data(PModule):
# Use this to set up the local branch of the preset tree. Ca... | hoytak/lazyrunner | test/test_environment/data/data.py | Python | bsd-3-clause | 2,204 |
import unittest
import numpy as np
import numpy.linalg as la
import numpy.random as rnd
import numpy.testing as np_testing
from scipy.linalg import logm, expm
from pymanopt.tools.multi import (multiprod, multitransp, multieye,
multisym, multilog, multiexp)
class TestMulti(unittest... | j-towns/pymanopt | tests/test_multi.py | Python | bsd-3-clause | 3,017 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/py-xlsxwriter/package.py | Python | lgpl-2.1 | 1,596 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2015 Akretion (<http://www.akretion.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the ... | algiopensource/server-tools | sql_export/__openerp__.py | Python | agpl-3.0 | 1,580 |
#
# 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... | alanconway/dispatch | python/qpid_dispatch_internal/management/agent.py | Python | apache-2.0 | 37,447 |
import _plotly_utils.basevalidators
class OpacityValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="opacity", parent_name="carpet", **kwargs):
super(OpacityValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/carpet/_opacity.py | Python | mit | 472 |
from setuptools import find_packages, setup
pkgname = "vdt.versionplugin.fpm"
setup(name=pkgname,
version="0.1.1",
description="Version Increment Plugin that builds with fpm",
author="Martijn Jacobs",
author_email="martijn@kamaramusic.nl",
maintainer="Martijn Jacobs",
maintainer_em... | devopsconsulting/vdt.versionplugin.fpm | setup.py | Python | bsd-3-clause | 641 |
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | leighpauls/k2cro4 | third_party/WebKit/Tools/Scripts/webkitpy/common/system/path_unittest.py | Python | bsd-3-clause | 3,531 |
# -*- coding: utf-8 -*-
import unittest
import os
import os.path
import tempfile
from nose.plugins.skip import SkipTest
import ansible.utils
import ansible.utils.template as template2
import ansible.constants as C
class TestUtils(unittest.TestCase):
#####################################
### varReplace func... | retr0h/ansible | test/TestUtils.py | Python | gpl-3.0 | 8,765 |
#
# 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... | nathanielvarona/airflow | airflow/contrib/hooks/datastore_hook.py | Python | apache-2.0 | 1,172 |
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | annarev/tensorflow | tensorflow/python/keras/saving/saved_model/json_utils_test.py | Python | apache-2.0 | 2,996 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 th... | grengojbo/st2 | st2client/st2client/client.py | Python | apache-2.0 | 5,863 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# http://peak.telecommunity.com/DevCenter/setuptools#developer-s-guide
# from distutils.core import setup
from setuptools import setup, find_packages
def read_text(filename, dir=None):
import codecs
import os
if dir is None:
dir = os.path.abspath(os.p... | nandoflorestan/poorbox | setup.py | Python | bsd-3-clause | 2,232 |
# coding: utf-8
class MaxipagoException(Exception):
def __init__(self, message):
self.message = message
def __str__(self):
return self.message
class ValidationError(MaxipagoException):
def __repr__(self):
return 'ValidationError(%s)' % self.message
# customer
class CustomerExc... | maxipago/Python-integration-lib | maxipago/exceptions.py | Python | mit | 582 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | llhe/tensorflow | tensorflow/contrib/layers/python/layers/layers.py | Python | apache-2.0 | 100,777 |
# -*- coding: utf-8 -*-
# Copyright 2007 Javier Kohen
# 2010,2014 Nick Boultbee
#
# 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 ... | elbeardmorez/quodlibet | quodlibet/quodlibet/util/string/titlecase.py | Python | gpl-2.0 | 3,592 |
import os
import re
import pandas as pd
import numpy as np
from sklearn.externals import joblib
from functools import wraps
from datetime import datetime, timedelta
from flask import g, session, abort, redirect, url_for, request, Flask, render_template, jsonify, flash
from flask_bootstrap import Bootstrap
from titan... | yvan/titanicdeath | titanicdeath/app.py | Python | mit | 2,685 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2006-2008, 2011 Lukáš Lalinský
# Copyright (C) 2009, 2011, 2019-2021 Philipp Wolfer
# Copyright (C) 2011-2013 Michael Wiencek
# Copyright (C) 2018, 2020-2021 Laurent Monin
#
# This program is free software; you can redistribute... | metabrainz/picard | picard/ui/options/matching.py | Python | gpl-2.0 | 2,553 |
# Copyright 2015 Cisco 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 requir... | noironetworks/networking-cisco | networking_cisco/plugins/cisco/common/utils.py | Python | apache-2.0 | 2,877 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
"""
Boot session from cache or build
Session bootstraps info needed by common client side activities including
permission, homepage, default variables, system defaults etc
"""
im... | elba7r/builder | frappe/sessions.py | Python | mit | 11,802 |
#!/usr/bin/python
# This file is part of pulseaudio-dlna.
# pulseaudio-dlna 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.
# pulsea... | sorrowless/pulseaudio-dlna | setup.py | Python | gpl-3.0 | 2,328 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Christophe Benz
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the... | laurentb/weboob | modules/ina/module.py | Python | lgpl-3.0 | 2,548 |
"""
Suspend any jobs and tasks from datasets that are suspended / errors.
Initial delay: rand(15 minutes)
Periodic delay: 60 minutes
"""
import logging
import random
import time
from tornado.ioloop import IOLoop
logger = logging.getLogger('dataset_cleanup')
def dataset_cleanup(module):
"""
Initial entrypoi... | WIPACrepo/iceprod | iceprod/server/scheduled_tasks/dataset_cleanup.py | Python | mit | 3,691 |
import xml.etree.ElementTree as ET
import httplib, urllib
import argparse
import sys
def send_tx_command(ip, command, timeout = 1.0):
try:
res = ""
params = urllib.urlencode({'param': command})
headers = {'Content-Type':'application/x-www-form-urlencoded'}
conn = httplib.HTTPConne... | polovnikov/txcommand | txcommand.py | Python | gpl-3.0 | 2,003 |
##-*- Mode: python -*-
## state.py - Persistance State of Simulation
## --------------------------------------------------------------------------
## Copyright (C) 2009, Matthew Hagy (hagy@gatech.edu)
## All rights reserved.
##
## This program is free software: you can redistribute it and/or modify
## it under the term... | matthagy/pbd | pbd/state.py | Python | apache-2.0 | 8,749 |
import logging
import luigi
import target
from luigi_gcloud.dataproc import DataProcPigTask, DataProcSparkTask
from storage_tasks import CopyLocalToStorage
logger = logging.getLogger('luigi-interface')
class DataProcPigCopy(DataProcPigTask):
day = luigi.DateParameter()
def requires(self):
return C... | alexvanboxel/luigiext-gcloud | examples/dataproc_tasks.py | Python | apache-2.0 | 1,807 |
from zope.i18nmessageid import MessageFactory
MessageFactory = MessageFactory('meetshaus.landingpage')
| potzenheimer/meetshaus | src/meetshaus.landingpage/meetshaus/landingpage/__init__.py | Python | mit | 104 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-28 01:16
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('item', '__first__'),
('enemy', '0005_auto_20151227_235... | ej2/pixelpuncher | pixelpuncher/enemy/migrations/0006_enemytype_drop_table.py | Python | bsd-3-clause | 608 |
class BaseCmd(object):
"""Docstring for Search """
name = 'wonk'
help_text = ("wonk it")
aliases = []
def __init__(self, sub_parser):
"""todo: to be defined
:param sub_parser: arg description
:type sub_parser: type description
"""
self._sub_parser = sub_pa... | jeffbuttars/upkg | upkg/cmds/base.py | Python | gpl-2.0 | 687 |
# -*- coding: utf-8 -*-
import hashlib
import hmac
import json
import logging
import urllib3
import config
CONTENT_TYPE_JSON = 'application/json'
pool = urllib3.PoolManager()
class NotificationRequest(object):
def __init__(self, subscription, payload):
self.url = subscription.request_url
sel... | Yelp/love | logic/notification_request.py | Python | mit | 1,657 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import (absolute_import, divi... | mganeva/mantid | scripts/SANS/sans/gui_logic/models/create_state.py | Python | gpl-3.0 | 3,721 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from xbmcswift2 import Plugin,xbmcaddon, xbmc
import urlfetch
from BeautifulSoup import BeautifulSoup
import json
import re
import urllib
plugin = Plugin()
crawurl = 'https://fptplay.net/livetv'
def getLinkById(id = None, quality = "2"):
#if id.startswith('https://... | jijarf/ahihi | plugin.video.kminus/fptplay.py | Python | apache-2.0 | 3,159 |
def identity(x):
return x
inline = identity
| szopu/jsython | jsython/decorators.py | Python | mit | 50 |
import pytest
from h5preserve import H5PreserveFile, new_registry_list
class TestFile(object):
@pytest.mark.xfail
def test_context_manager(self, tmpdir, registry_container):
assert 0
@pytest.mark.xfail
def test_create(self, tmpdir, registry_container):
assert 0
@pytest.mark.xfail
... | h5preserve/h5preserve | tests/test_file.py | Python | bsd-3-clause | 540 |
"""
BR_Random app implements DuelingBanditsPureExplorationPrototype
author: Kevin Jamieson, kevin.g.jamieson@gmail.com
last updated: 11/4/2015
BR_Random implements random sampling using the Borda reduction described in detail in
Jamieson et al "Sparse Borda Bandits," AISTATS 2015.
"""
import numpy
import numpy.random... | lalitkumarj/NEXT | apps/DuelingBanditsPureExploration/algs/BR_Random/BR_Random.py | Python | apache-2.0 | 2,722 |
#!/usr/bin/env python
import aurorawatchuk
import aurorawatchuk.snapshot
import datetime
import logging
import os
import time
__author__ = 'Steve Marple'
__version__ = '0.0.6'
__license__ = 'MIT'
logger = logging.getLogger(__name__)
# Set logging level to debug to that HTTP GETs are indicated
logging.basicConfig(l... | stevemarple/python-aurorawatchuk | aurorawatchuk/examples/get_status.py | Python | mit | 2,580 |
#!/usr/bin/env python3
"""
headless_client.py
We're using Python 3 because it supports descriptor passing.
"""
from __future__ import print_function
import pty
import optparse
import os
import socket
import sys
import py_fanos
from py_fanos import log
def main(argv):
p = optparse.OptionParser(__doc__)
p.add_op... | oilshell/blog-code | fd-passing/headless_client.py | Python | apache-2.0 | 3,305 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Enable the admin
url(r'^admin/', include(admin.site.urls)),
# Simple static example
url(r'^bar/$', 'example.views.test', name='example_test'),
url(r'^bar/(?P<var>... | ddanier/django_url_alias | example/example/urls.py | Python | bsd-3-clause | 491 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
import unittest
from meridian.acupoints import tianyou13
class TestTianyou13Functions(unittest.TestCase):
def setUp(self):
pass
def test_xxx(self):
pass
if __name__ == '__main__':
unittest.main()
| sinotradition/meridian | meridian/tst/acupoints/test_tianyou13.py | Python | apache-2.0 | 299 |
# -*- encoding: utf-8 -*-
from django.test import TestCase
from main.apps import *
import os
class FormsTest(TestCase):
def setUp(self):
class temp:
__path__ = "."
self.a = temp()
self.main_app = MainConfig("main", self.a)
def test_appNamesCorrect(self):
self.asser... | Scriptodude/EnceFAL | django/main/tests/test_apps.py | Python | gpl-3.0 | 355 |
import urllib
import xml.etree.ElementTree as ET
import pandas as pd
from serenata_toolbox import log
from serenata_toolbox.datasets.helpers import (
save_to_csv,
translate_column,
xml_extract_text,
)
class DeputiesDataset:
URL = 'http://www.camara.leg.br/SitCamaraWS/deputados.asmx/ObterDeputados'
... | datasciencebr/serenata-toolbox | serenata_toolbox/chamber_of_deputies/deputies_dataset.py | Python | mit | 2,519 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2016 CERN.
#
# INSPIRE 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... | jacenkow/inspire-next | tests/integration/test_detailed_records.py | Python | gpl-2.0 | 2,020 |
import pandas as pd
import shutil, os
import os.path as osp
import torch
import numpy as np
from dgl.data.utils import load_graphs, save_graphs, Subset
import dgl
from ogb.utils.url import decide_download, download_url, extract_zip
from ogb.io.read_graph_dgl import read_graph_dgl, read_heterograph_dgl
from ogb.utils.to... | snap-stanford/ogb | ogb/linkproppred/dataset_dgl.py | Python | mit | 7,161 |
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/users/')
def user():
names = ['simon', 'ryan', 'thomas', 'lee', 'sylvester']
return render_template('loops.html', names=names)
if __name__ == "__main__":
app.run(host='0.0.0.0', debug=True)
| rdthomson/set09103 | src/workbook/templates_collections.py | Python | gpl-3.0 | 271 |
# -*- coding: utf-8 -*-
# **********************************************************************
#
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# ***********************************... | aitormf/JdeRobot | src/tools/3DVizWeb/test/jderobot/kinectleds_ice.py | Python | gpl-3.0 | 4,618 |
# encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib/python3/dist-packages/PyQt4/QtGui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
from .QValidator import QValidator
class QIntValidator(QValidator):
"""
QIntValidator(QObject parent=None)
... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyQt4/QtGui/QIntValidator.py | Python | gpl-2.0 | 1,504 |
from numpy.testing import assert_array_equal
from landlab import HexModelGrid
def test_patches_at_node():
grid = HexModelGrid((3, 3))
assert_array_equal(
grid.patches_at_node,
[
[0, 2, -1, -1, -1, -1],
[1, 3, 0, -1, -1, -1],
[4, 1, -1, -1, -1, -1],
... | cmshobe/landlab | tests/grid/test_hex_grid/test_nodes.py | Python | mit | 572 |
####
###
##
# Don't delete stuff unless you want an error...
##
###
####
from extra import Configuration, Statistics
###
# Gentlemen, set your window width to 120 characters. You have been warned.
###
#------------------------------------------------------------------------------------------------------------------... | spydez/tgrep | config.py | Python | bsd-3-clause | 4,541 |
# coding: utf-8
# Simple module to handle versions
"""
Module for version handling:
provides:
* version = "1.2.3" or "1.2.3-beta4"
* version_info = named tuple (1,2,3,"beta",4)
* hexversion: 0x010203B4
* strictversion = "1.2.3b4
This is called hexversion since it only really looks meaningful when viewed as the
res... | kif/UPBL09a | version.py | Python | gpl-2.0 | 2,284 |
# Copyright 2018 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | quantumlib/Cirq | cirq-core/cirq/ops/op_tree.py | Python | apache-2.0 | 6,175 |
#------------------------------------------------------------------------------
# Copyright 2016, 2017, Oracle and/or its affiliates. All rights reserved.
#
# Portions Copyright 2007-2015, Anthony Tuininga. All rights reserved.
#
# Portions Copyright 2001-2007, Computronix (Canada) Ltd., Edmonton, Alberta,
# Canada. Al... | kawamon/hue | desktop/core/ext-py/cx_Oracle-6.4.1/samples/ReturnUnicode.py | Python | apache-2.0 | 1,307 |
# -*- coding: utf8 -*-
from . import logger
class WindowIndex:
"""Packet の index を生成する
>>> i = WindowIndex()
>>> i.curr()
0
>>> i.next()
0
>>> i.next()
1
>>> i.seek(5)
2
>>> i.curr()
7
>>> i.prev()
7
>>> i.seek(-5)
6
>>> i.curr()
1
"""
... | nosix/PyCraft | src/pycraft/network/window.py | Python | lgpl-3.0 | 5,075 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 NetApp, 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.or... | usc-isi/nova | nova/tests/test_netapp_nfs.py | Python | apache-2.0 | 7,099 |
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | tswast/google-cloud-python | billingbudgets/google/cloud/billing_budgets_v1beta1/types.py | Python | apache-2.0 | 1,563 |
import unittest
import random
try:
j = 0
l = int(raw_input("Adja meg a vektorok szamat: "))
while j<l:
vector_temp=[]
i=0
k=0
n = int(raw_input("Adja meg a vektor hosszat: "))
while i<n:
k = int(raw_input("Adjon meg egy vektorbeli erteket: "))
... | richardkundl/Clever-Algorithms | src/csharp/CleverAlgorithms/Python Scripts/Algorithms/RandomSearch.py | Python | mit | 842 |
import mock
from nose.tools import eq_, ok_, assert_raises
from funfactory.urlresolvers import reverse
from .base import ManageTestCase
class TestErrorTrigger(ManageTestCase):
def test_trigger_error(self):
url = reverse('manage:error_trigger')
response = self.client.get(url)
assert self... | zofuthan/airmozilla | airmozilla/manage/tests/views/test_errors.py | Python | bsd-3-clause | 1,278 |
import venusian
def entrypoint(cmds, args=None):
if args is None:
args = lambda _parser: None
def _entrypoint(wrapped):
def callback(scanner, name, ob):
scanner.entrypoints.append((cmds, args, ob))
venusian.attach(wrapped, callback, category='plugnparse')
return wrap... | brianthelion/plugnparse | plugnparse/decorators.py | Python | mit | 347 |
"""AppTEA URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | nico4021/RegistroTEA | ProyectoTEA/AppTEA/urls.py | Python | gpl-2.0 | 3,932 |
#!/usr/bin/python
import Axon
from Axon.AdaptiveCommsComponent import AdaptiveCommsComponent
from Axon.Ipc import shutdownMicroprocess, producerFinished
class undef(object):
pass
class DemuxRemuxTuple(AdaptiveCommsComponent):
"""\
#
# FIXME: derived from the PAR component.
# FIXME: This should really... | sparkslabs/kamaelia | Sketches/MPS/DemuxRemuxTuple.py | Python | apache-2.0 | 6,957 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.