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 |
|---|---|---|---|---|---|
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
# mail config
MAIL_SERVER = 'smtp.qq.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USERNAME = os.environ.ge... | blackerXHunter/X-blog | config.py | Python | mit | 1,300 |
from lacuna.building import MyBuilding
class fission(MyBuilding):
path = 'fission'
def __init__( self, client, body_id:int = 0, building_id:int = 0 ):
super().__init__( client, body_id, building_id )
| tmtowtdi/MontyLacuna | lib/lacuna/buildings/boring/fission.py | Python | mit | 219 |
from django.core.management.base import BaseCommand
import time
from datetime import datetime
from django.utils.timezone import utc
from cStringIO import StringIO
from server.forecasting import Forecast, get_initial_time
from server.forecasting.measurementstorage import MeasurementStorage
class Command(BaseCommand):
... | SEC-i/ecoControl | server/management/commands/line_profile.py | Python | mit | 2,377 |
"""
This module contains tasks for asynchronous execution of grade updates.
"""
from celery import task
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db.utils import DatabaseError
from logging import getLogger
from coursewar... | synergeticsedx/deployment-wipro | lms/djangoapps/grades/tasks.py | Python | agpl-3.0 | 8,400 |
# -*- test-case-name: openid.test.test_consumer -*-
"""OpenID support for Relying Parties (aka Consumers).
This module documents the main interface with the OpenID consumer
library. The only part of the library which has to be used and isn't
documented in full here is the store required to create an
C{L{Consumer}} in... | DataDog/python-openid | openid/consumer/consumer.py | Python | apache-2.0 | 76,694 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
im... | djkonro/client-python | kubernetes/client/apis/autoscaling_api.py | Python | apache-2.0 | 4,935 |
from django.db import models
from django.utils.html import escape, format_html
from django.utils.text import Truncator
from django.utils.translation import ugettext as _
from django import forms
from xadmin.sites import site
from xadmin.views import BaseAdminPlugin, ModelFormAdminView
from xadmin.util import vendor
c... | ly0/xxadmin | xadmin/plugins/relfield.py | Python | bsd-3-clause | 2,710 |
"""
Grades related signals.
"""
from django.dispatch import Signal
# Signal that indicates that a user's raw score for a problem has been updated.
# This signal is generated when a scoring event occurs within the core
# platform. Note that this signal will be triggered
# regardless of the new and previous values of t... | fintech-circle/edx-platform | lms/djangoapps/grades/signals/signals.py | Python | agpl-3.0 | 3,910 |
#!/usr/bin/python
from __future__ import print_function
def app(env, start_response):
if env['PATH_INFO'] == '/':
start_response('200 OK', [('Content-Type', 'text/html')])
return ["<b>hello world</b>"]
else:
start_response('404 Not Found', [('Content-Type', 'text/html')])
return... | val314159/pydocker | app.py | Python | unlicense | 480 |
#!/usr/bin/env python
"""
Python source code - replace this with a description of the code and write the code below this text.
"""
from train import load_list, path2uuid
def main():
import sys
valid_gifs = set(load_list(sys.argv[1]))
do_rm = True
if len(sys.argv) > 1:
do_rm = False
for ... | raingo/TGIF-Release | code/gifs-filter/c3d-models/filter-images.py | Python | bsd-3-clause | 606 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2016 F5 Networks Inc.
#
# This file is part of Ansible
#
# 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
# ... | mryanlam/f5-ansible | library/bigip_irule.py | Python | gpl-3.0 | 11,723 |
#ue.exec('pip2.py')
import subprocess
import sys
import os
import unreal_engine as ue
import _thread as thread
#ue.log(sys.path)
_problemPaths = ['']
def NormalizePaths():
problemPaths = _problemPaths
#replace '/' to '\\'
for i in range(len(sys.path)):
currentPath = sys.path[i]
sys.path[i] = currentPath.repl... | getnamo/UnrealEnginePython | Content/Scripts/upycmd.py | Python | mit | 2,925 |
# This script tests adding and removing polylines.
# Created by Toni Sagrista
from py4j.java_gateway import JavaGateway, GatewayParameters
gateway = JavaGateway(gateway_parameters=GatewayParameters(auto_convert=True))
gs = gateway.entry_point
gs.disableInput()
gs.cameraStop()
gs.minimizeInterfaceWindow()
gs.setCine... | ari-zah/gaiasky | assets/scripts/tests/add-line-test.py | Python | lgpl-3.0 | 931 |
from singleton import Singleton
from singleton_thread_safe import Singleton as SingletonThreadSafe
from threading import Thread
class TestSingleton:
"""
This class is used to test that only one instance of the Singleton class is
created at any given time
"""
def test_singleton(self) -> None:
... | lmregus/Portfolio | python/design_patterns/singleton_pattern/test_singleton.py | Python | mit | 1,006 |
import dill as pickle
import qelos as q
import numpy as np
import scipy.sparse as sparse
defaultp = "../../../../datasets/webqsp/flmats/"
defaultqp = "../../../../datasets/webqsp/webqsp"
def load_info_mats(p=defaultp):
tt = q.ticktock("loader")
tt.tick()
entity_dict = pickle.load(open(p+"webqsp.entity.d... | lukovnikov/qelos | qelos/scripts/webqa/preprocessing/loader.py | Python | mit | 6,655 |
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
u... | hcwiley/django_art | portfolio/portfolio/artist/urls.py | Python | gpl-2.0 | 370 |
from DataGathering.sanitizeString import sanitizeString
def checkProperNamePresence(text,namesList):
wordPresence = [word in namesList for word in sanitizeString(text).split()]
return True in wordPresence
def getProperNamePresence(df, namesList):
return df['Discurso'].map(lambda d: checkProperNamePresen... | hugolouzada/ImpeachmentPrediction | DataTransform/getProperNamePresence.py | Python | gpl-3.0 | 341 |
# -*- coding: utf-8 -*-
# Copyright 2007-2016 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | francisco-dlp/hyperspy | hyperspy/_components/lorentzian.py | Python | gpl-3.0 | 2,693 |
from pymongo import MongoClient
import json
client = MongoClient('proximus.modulusmongo.net:27017')
client.tepO9seb.authenticate('nasahack', 'hacking4nasa')
db = client.tepO9seb
if __name__ == '__main__':
data = json.load(open('data/nsf_ngram_np.json'))
db.datasets.insert(data) | jonroberts/nasaMining | mongoWork/insert_nsf_ngram_kwds.py | Python | mit | 289 |
from __future__ import absolute_import
import errno
import io
import itertools
import getopt
import os, signal, subprocess, sys
import re
import stat
import platform
import shutil
import tempfile
import threading
import io
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from lit... | pureqml/qmlcore | test/lit/TestRunner.py | Python | mit | 61,327 |
# Copyright 2017 Rackspace
# 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 applic... | jr0d/mercury | src/tests/common/unit/task_managers/redis/test_redis_task.py | Python | apache-2.0 | 1,912 |
# -*- coding: utf-8 -*-
from collections import defaultdict
__author__ = 'Sergey Aganezov'
__email__ = 'aganezov@gwu.edu'
__status__ = 'develop'
import unittest
from src.assembly import fga_assembly_fgr
class fgrConnectionCreationTestCase(unittest.TestCase):
def setUp(self):
self.storage = defaultdict(la... | aganezov/fga | tests/assembly/fgr/test_fgr_chain.py | Python | gpl-3.0 | 8,438 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Jesse Weinstein
#
# 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 t... | LordSputnik/beets | test/test_play.py | Python | mit | 3,976 |
from datetime import datetime
import pandas as pd
#
from django.db import models
class DataGroup(models.Model):
"""
Represents a group an Data Sets
"""
"""
Fields
"""
name = models.CharField(max_length=200)
"""
Methods
"""
def __unicode__(self):
return self... | TwistedHardware/roshanRush | data_set/models.py | Python | gpl-2.0 | 14,792 |
import complexism as cx
import complexism.agentbased.statespace as ss
import epidag as dag
dbp = cx.read_dbp_script(cx.load_txt('../scripts/SIR_BN.txt'))
pc = dag.quick_build_parameter_core(cx.load_txt('../scripts/pSIR.txt'))
dc = dbp.generate_model('M1', **pc.get_samplers())
ag = ss.StSpAgent('Helen', dc['Sus'], pc... | TimeWz667/Kamanian | example/OOP/O2.4 SS, Single agent model.py | Python | mit | 446 |
# -*- coding: utf-8 -*-
"""
wegene.Models.User
This file was automatically generated by APIMATIC BETA v2.0 on 02/22/2016
"""
from wegene.APIHelper import APIHelper
from wegene.Models.Profile import Profile
class User(object):
"""Implementation of the 'user' model.
Model for user infor... | xraywu/wegene-python-sdk | wegene/Models/User.py | Python | mit | 2,898 |
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Princessgladys/googleresourcefinder | lib/feedlib/tasks_external.py | Python | apache-2.0 | 1,467 |
"""
ENZYMATIC REACTIONS, ENZYMATIC GENES & PERCEPTION GENES
"""
enzymatic_reactions = {
"AB": ('M274', 'M77'), "AC": ('M162', 'M83'), "AD": ('M286', 'M108'),
"AE": ('M183', 'M184'), "AF": ('M250', 'M105'), "AG": ('M103', 'M239'),
"AH": ('M16', 'M247'), "AI": ('M277', 'M199'), "AJ": ('M94', 'M308'),
"A... | mauriceling/dose | dossier_examples/sunanda_metabolism.py | Python | gpl-3.0 | 10,617 |
# -*- coding: utf-8 -*-
"""
The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1.
Hence the first 12 terms will be:
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 13
F8 = 21
F9 = 34
F10 = 55
F11 = 89
F12 = 144
The 12th term, F12, is the first term to contain three di... | bsamseth/project-euler | 025/25.py | Python | mit | 748 |
"""
This module contains all the Data Access Objects for models which are persisted to Elasticsearch
at some point in their lifecycle.
Each DAO is an extension of the octopus ESDAO utility class which provides all of the ES-level heavy lifting,
so these DAOs mostly just provide information on where to persist the data... | JiscPER/jper | service/dao.py | Python | apache-2.0 | 3,957 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ============================================================================
# @file ostap/stats/ustat.py
#
# Helper module to get ``U-statistics'' useful for ``Goodnes-Of-Fit'' tests
#
# This is a simple translation of the original C++ lines written by Greig Cowan into p... | OstapHEP/ostap | ostap/stats/ustat.py | Python | bsd-3-clause | 8,564 |
from django.core.management import call_command
from django.core.management.commands.syncdb import Command as SyncDBCommand
class Command(SyncDBCommand):
def handle_noargs(self, **options):
# Run migrations first
if options.get("database"):
databases = [options.get("database")]
... | dcramer/nashvegas | nashvegas/management/commands/syncdb.py | Python | mit | 781 |
import random
class Tour:
_tour = []
_distance = 0
def __init__(self, tour=None):
if tour:
self._tour = list(tour._tour)
self._distance = tour._distance
def __str__(self):
gene_string = ''
for i in xrange(len(self._tour)):
gene_string += s... | rodolphopivetta/traveling-salesman | simulated_annealing/tour.py | Python | mit | 1,474 |
"""
Classes to be used for mock objects.
"""
from collections import defaultdict
from coilmq import auth
__authors__ = ['"Hans Lellelid" <hans@xmpl.org>']
__copyright__ = "Copyright 2009 Hans Lellelid"
__license__ = """Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in... | hozn/coilmq | tests/mock.py | Python | apache-2.0 | 3,447 |
from django.utils.timezone import utc as timezone_utc
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.timestamp import floor_to_hour, floor_to_day, ceiling_to_hour, \
ceiling_to_day, timestamp_to_datetime, datetime_to_timestamp, \
TimezoneNotUTCException, convert_to_UTC
from datetime import... | Galexrt/zulip | zerver/tests/test_timestamp.py | Python | apache-2.0 | 1,955 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 F5 Networks Inc.
# 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',
... | caphrim007/ansible | lib/ansible/modules/network/f5/bigip_snat_pool.py | Python | gpl-3.0 | 11,567 |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'chromium',
'depot_tools/bot_update',
'depot_tools/gclient',
'recipe_engine/json',
'recipe_engine/path',
'recipe_engine/prop... | eunchong/build | scripts/slave/recipes/chromium.fyi.win_misc_block.recipe_autogen.py | Python | bsd-3-clause | 30,661 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import print_function
from pkg_resources import safe_name
from .crawler import Crawler
from .fetcher import Fetcher, PyPIFetcher
from .http import Context
from .installer... | zhangzhonglai/heron | third_party/pex/pex/resolver_options.py | Python | apache-2.0 | 5,775 |
class Solution(object):
def getMoneyAmount(self, n):
"""
:type n: int
:rtype: int
"""
dp = [[0 for x in range(n+1)] for y in range(n+1)]
for i in range(2,n+1):
for x in range(n):
if x + i > n:
break
dp[x]... | FiveEye/ProblemSet | LeetCode/lc375.py | Python | mit | 578 |
import re
from django.utils.translation import ugettext_lazy as _
from django import forms
from django.contrib.auth import get_user_model
from allauth.account import app_settings
from allauth.account.adapter import DefaultAccountAdapter
USERNAME_REGEX = re.compile(r'^[\w-]+$', re.UNICODE)
class CustomAccountAdapte... | v1k45/blogghar | authapp/adapter.py | Python | mit | 2,012 |
###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# mod... | nielsbuwen/ilastik | tests/test_applets/thresholdTwoLevels/testOpAnisotropicGaussianSmoothing.py | Python | gpl-3.0 | 3,469 |
# Copyright 2014-2015 VPAC
# Copyright 2014 The University of Melbourne
#
# This file is part of Karaage.
#
# Karaage 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 y... | monash-merc/karaage | karaage/tests/people/test_models.py | Python | gpl-3.0 | 2,550 |
# ===============================================================================
# Copyright 2017 ross
#
# 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/LICE... | USGSDenverPychron/pychron | pychron/data_mapper/sources/wiscar_source.py | Python | apache-2.0 | 1,350 |
# -*- coding: utf-8 -*-
import datetime
import pendulum
from decimal import Decimal
from pendulumify import pendulumify
def isInstanceOfPendulum(arg):
return isinstance(arg, pendulum.Pendulum)
def test_dictionary():
d = pendulumify({
'example': datetime.datetime.now(),
'donottouch': 'safe',... | SpotOnInc/pendulumify | tests/test_pendulumify.py | Python | mit | 3,881 |
"""
Ensures that the lilypond module is producing expected output.
"""
import unittest
import datetime
from foox.lilypond import (
get_cantus_firmus,
get_simple_contrapunctus,
get_fourth_species,
render,
)
class TestLilypond(unittest.TestCase):
"""
Ensures the foox.lilypond module works as ex... | ntoll/foox | test/test_lilypond.py | Python | mit | 6,166 |
from common import *
def test_column_subset(ds_local):
ds = ds_local
dss = ds[['x', 'y']]
assert dss.get_column_names() == ['x', 'y']
np.array(dss) # test if all columns can be put in arrays
def test_column_subset_virtual(ds_local):
ds = ds_local
ds['r'] = ds.x + ds.y
dss = ds[['r']]
... | maartenbreddels/vaex | tests/getattr_test.py | Python | mit | 3,825 |
# -*- encoding: utf-8 -*-
"""Initialize model files."""
from . import models
| lithint/odoo | gentec_custom/__init__.py | Python | agpl-3.0 | 78 |
import sys, getopt
import sqlite3
import csv
import os
from create_cms_db import create_cms_db
#TODO: In blog, mention had to save this as CSV because only Excel provided
region_crosswalk_file = 'data/ZipHsaHrr11.csv'
inpatient_file = 'data/Medicare_Provider_Charge_Inpatient_DRG100_FY2011.csv'
outpatient_file... | jseppi/load-cms-data | load_cms_data.py | Python | mit | 7,893 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2018_11_01/operations/_ddos_protection_plans_operations.py | Python | mit | 30,476 |
# Copyright 2018 DT42
#
# This file is part of BerryNet.
#
# BerryNet 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.
#
# BerryNet is d... | DT42/BerryNet | berrynet/bndyda/output_processor.py | Python | gpl-3.0 | 2,751 |
# -*- coding: utf-8 -*-
"""Database helpers used in SkyLines."""
from werkzeug.exceptions import NotFound
from flask.ext.babel import _
from sqlalchemy import orm
def _patch_query(q, joinedload=(), patch_query=None):
if joinedload:
q = q.options(orm.joinedload(*joinedload))
if patch_query:
... | TobiasLohner/SkyLines | skylines/lib/dbutil.py | Python | agpl-3.0 | 2,042 |
import sys
import csv
from math import *
from quad_tree import *
from province_grid import *
from provinces import ProvinceSyncer
import shapefile
from matplotlib.path import Path
import numpy as np
def genSamplingPoints(startPoint, diff):
return [startPoint
# Inner round
, startPoint + dif... | takkasila/TwitGeoSpa | Province/province_qtree_shapefile.py | Python | mit | 6,101 |
"""
PluginManager, basic initialization and tracing.
pluggy is the cristallized core of plugin management as used
by some 150 plugins for pytest.
Pluggy uses semantic versioning. Breaking changes are only foreseen for
Major releases (incremented X in "X.Y.Z"). If you want to use pluggy in
your project you should thu... | pdxwebdev/yadapy | yada/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py | Python | gpl-3.0 | 30,741 |
# coding: utf-8
import unittest
from pyramid import testing
from articlemeta.decorators import LogHistoryChange
class LogHistoryChangeDecoratorTest(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
def tearDown(self):
testing.tearDown()
def test_invoke_without_params_m... | scieloorg/articles_meta | tests/test_decorators.py | Python | bsd-2-clause | 755 |
#!/usr/bin/python
# ex:set fileencoding=utf-8:
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from djangobmf.dashboards import Sales
from djangobmf.sites import Category
class QuotationCategory(Category):
name = _('Quotations')
slug = "quotations"
dashbo... | django-bmf/django-bmf | djangobmf/contrib/quotation/categories.py | Python | bsd-3-clause | 332 |
# The default ``config.py``
def set_prefs(prefs):
"""This function is called before opening the project"""
# Specify which files and folders to ignore in the project.
# Changes to ignored resources are not added to the history and
# VCSs. Also they are not returned in `Project.get_files()`.
# No... | alixedi/django_filtered_feed | filtered_feed/testproject/testproject/.ropeproject/config.py | Python | bsd-3-clause | 3,460 |
# Exercise 2
#
# Modify the Guess My Number chapter project from Chapter 3 by reusing the function ask_number().
#
import random
def ask_number(question, low, high, step = 1):
"""
Ask for a number within a range.
:param question: Question to ask.
:param low: Lowest number.
:param high: Highest number.
:pa... | dmartinezgarcia/Python-Programming | Chapter 6 - Functions/exercise_2.py | Python | gpl-2.0 | 1,062 |
# -*- coding: utf-8 -*-
'''
Created on Mon Sep 2 17:20:12 2013
@author: ozdemircili
'''
#Reference http://docs.python.org/2/library/time.html#time.strftime
import datetime
now = datetime.datetime.now()
print
print "Current date and time using str method of datetime object:"
print str(now)
print
print "Current da... | ozdemircili/pycheat | pycheat/datetime.py | Python | gpl-3.0 | 1,053 |
"""Common tools for building restful resources."""
import flask
import flask_restful
import flask_restful.reqparse
import functools
import sqlalchemy
import sqlalchemy.orm as orm
import backend
import backend.common.auth as auth
class RequestParser(flask_restful.reqparse.RequestParser):
"""RequestParser subcla... | andymcguinness/Planet-Lab | backend/src/backend/common/resource.py | Python | bsd-3-clause | 7,704 |
from django.db import models
from django import forms
from django.utils.html import strip_tags
from django.utils.text import Truncator
from wheelcms_axle.content import type_registry
from wheelcms_axle.content import Content
from wheelcms_axle.templates import template_registry
from wheelcms_axle.spoke import Spoke, ... | wheelcms/wheelcms_spokes | wheelcms_spokes/page.py | Python | bsd-2-clause | 3,064 |
import pygame
import pygame.midi
import ConfigParser
def main():
chords = {}
# C, G, Ami, F
#chords["c"] = [60, 64, 67]
#chords["d"] = [62, 66, 69]
#chords["g"] = [67, 71, 74]
#chords["f"] = [66, 69, 72]
# Ami
#chords["a"] = [69, 72, 76]
# Emi
#chords["e"] = [64, 67, 71]
pygame.init()
#pygame.event.set... | severak/lazyboard | lazyboard.py | Python | mit | 1,863 |
import json
import os
from flask import Flask, request, Response, jsonify, render_template
from datetime import datetime
# Import the database
import db
# Import API functions
import api
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST', 'PUT'])
def home():
# Handle GET
if request.method == 'GET'... | seanhold3n/obd-server-python | server.py | Python | mit | 2,816 |
#!/usr/bin/python3
'''
This is an example of creating a thread and passing it data via it's closure
'''
import threading # for Thread
# this function was written with NO consideratiion of threading...
def func(data):
print(data)
# this is a wrapper that creates a function with no argument
# that runs any oth... | nonZero/demos-python | src/examples/short/threading/threading_passing_args_closure.py | Python | gpl-3.0 | 547 |
__author__ = 'matt'
import pandas as pd
from itertools import permutations
def Splitter(cat):
cats = pd.read_pickle('Data/Chapter_2/LN_Cat_Dict.pickle')
cs = pd.read_pickle('Data/350/PPMI_CS_350_SBL_GNT_SVD_exp=1.45.pickle')
cat_words = list(set([list(word.keys())[0] for word in cats[cat]['words']]))
pairs = perm... | sonofmun/DissProject | Chapter_2/Cat_Splitter.py | Python | gpl-3.0 | 616 |
"""
The B{0install select} command-line interface.
"""
# Copyright (C) 2011, Thomas Leonard
# See the README file for details, or visit http://0install.net.
from __future__ import print_function
import sys
from zeroinstall import _, logger
from zeroinstall.cmd import UsageError
from zeroinstall.injector import mode... | slovenwd/0install | zeroinstall/cmd/select.py | Python | lgpl-2.1 | 9,192 |
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "AWS Budget Service"
prefix = "budgets"
class Action(BaseAction):
def __init__(self, action: str = None) -> None:
... | cloudtools/awacs | awacs/budgets.py | Python | bsd-2-clause | 1,133 |
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from .classifier import MILBoostClassifier
from .softmax import *
| hbldh/skboost | skboost/milboost/__init__.py | Python | mit | 216 |
from django.test import LiveServerTestCase
from django.urls import reverse
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.action_chains import ActionChains
from registration.forms import format_programmes... | Teknologforeningen/teknologr.io | teknologr/registration/browsertests/test-registration.py | Python | mit | 3,197 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This module is also sponsored by E.T.A.I. (www.etai.fr)
#
# This file is part of Ansible
#
# 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... | andreaso/ansible | lib/ansible/modules/cloud/vmware/vmware_guest_snapshot.py | Python | gpl-3.0 | 10,985 |
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007 Maryland Robotics Club
# Copyright (C) 2007 Joseph Lisee <jlisee@umd.edu>
# All rights reserved.
#
# Author: Joseph Lisee <jlisee@umd.edu>
#
# modified for pybert's vtk import to fit python-2.9@linux
# Standard python imports
import ctypes as __ctypes
import os.p... | florian-wagner/gimli | python/pygimli/gui/vtk/getHandleHack.py | Python | gpl-3.0 | 1,162 |
# Copyright (c) 2015 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 law or agreed to... | silenci/neutron | neutron/tests/unit/api/rpc/handlers/test_dvr_rpc.py | Python | apache-2.0 | 2,111 |
# ASCEND modelling environment
# Copyright (C) 2007 Carnegie Mellon University
#
# 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, or (at your option)
# any later version.
#
# Th... | georgyberdyshev/ascend | models/johnpye/framevis.py | Python | gpl-2.0 | 5,471 |
import logging
import os
import numpy as np
from cis.exceptions import FileFormatError
from cis.data_io.products import AProduct
from cis.utils import add_to_list_if_not_none, listify
from cis.data_io.netcdf import get_metadata, get_netcdf_file_attributes, read_many_files_individually, \
get_netcdf_file_variables... | duncanwp/cis_plugins | ncar_raf_cube.py | Python | lgpl-3.0 | 13,650 |
"""
This module defines the database models for all in-game objects, that
is, all objects that has an actual existence in-game.
Each database object is 'decorated' with a 'typeclass', a normal
python class that implements all the various logics needed by the game
in question. Objects created of this class transparentl... | shollen/evennia | evennia/objects/models.py | Python | bsd-3-clause | 12,067 |
import etl
from nltk.tag.stanford import StanfordNERTagger
#
# Stanford Named Entitiy Recognizer (NER)
#
# Appends classified (Persons, Locations, Organizations) entities (names/words) to mapped facets/fields
class enhance_ner_stanford(object):
# compound words of same class to multi word entities (result is a... | opensemanticsearch/open-semantic-etl | src/opensemanticetl/enhance_ner_stanford.py | Python | gpl-3.0 | 5,149 |
import test_flask_opentracing | kcamenzind/flask_opentracing | tests/__init__.py | Python | bsd-3-clause | 29 |
# 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
#
# Unless required by applicable ... | chemelnucfin/tensorflow | tensorflow/python/distribute/cluster_resolver/kubernetes_cluster_resolver.py | Python | apache-2.0 | 6,529 |
import os
from parser import RadistConf
from ix import IXConfig
def try3(func, url):
import urllib2
for i in range(3):
try:
return func(url)
except urllib2.URLError, err:
pass
raise err
def get_r():
"""Returns default /R/ tree.
It try to do it 3 times."""
... | shigin/radist | radist/default.py | Python | bsd-2-clause | 1,440 |
# pylint: skip-file
# flake8: noqa
# pylint: disable=wrong-import-position,too-many-branches,invalid-name,no-name-in-module, import-error
import json
from distutils.version import StrictVersion
from ansible.module_utils.basic import AnsibleModule
def _install(module, container, image, values_list):
''' install... | mmahut/openshift-ansible | roles/lib_openshift/src/ansible/oc_atomic_container.py | Python | apache-2.0 | 5,405 |
# MIT License
# Copyright (c) 2016 Diogo Dutra <dutradda@gmail.com>
# 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, co... | dutradda/myreco | tests/integration/external_variables/test_external_variables_integration.py | Python | mit | 8,741 |
"""Test that boolean conditions simplify to a constant value"""
# pylint: disable=pointless-statement
from unknown import Unknown # pylint: disable=import-error
def func(_):
"""Pointless function"""
CONSTANT = 100
OTHER = 200
# Simplifies any boolean expression that is coerced into a True/False value
bool(CON... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/c/condition_evals_to_constant.py | Python | mit | 1,666 |
#!/usr/bin/env python
'''enable run-time addition and removal of master link, just like --master on the cnd line'''
''' TO USE:
link add 10.11.12.13:14550
link list
link remove 3 # to remove 3rd output
'''
from pymavlink import mavutil
import time, struct, math, sys, fnmatch, traceback
from MAVProxy.... | squilter/MAVProxy | MAVProxy/modules/mavproxy_link.py | Python | gpl-3.0 | 20,314 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# 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) an... | dermute/ansible | lib/ansible/executor/task_queue_manager.py | Python | gpl-3.0 | 11,908 |
import _plotly_utils.basevalidators
class ColorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self,
plotly_name="colorsrc",
parent_name="densitymapbox.hoverlabel.font",
**kwargs
):
super(ColorsrcValidator, self).__init__(
plotly_name=... | plotly/plotly.py | packages/python/plotly/plotly/validators/densitymapbox/hoverlabel/font/_colorsrc.py | Python | mit | 456 |
import os
import numpy as np
import glob
import argparse
import re
def natural_sort(l):
convert = lambda text: int(text) if text.isdigit() else text.lower()
alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ]
return sorted(l, key = alphanum_key)
parser = argparse.ArgumentParser(... | adwardlee/tf_utils | encode_img_video.py | Python | mit | 3,858 |
'''
@author: Moritz Augustin
'''
import numba
import numpy
import mwmc
@numba.jit
def alpha_count_center(data_win):
""" counts positive data values over alle species of (only) the
center cell
"""
ws_h = (data_win.shape[0]-1)/2 # ws_h: winsize half: (winsize-1)/2
offset_i = ws_h
offset_j = ... | moritzaugustin/mwmc | measures.py | Python | gpl-2.0 | 4,413 |
if __name__ == "__main__":
import sys,os
selfname = sys.argv[0]
full_path = os.path.abspath(selfname)[:]
last_slash = full_path.rfind('/')
dirpath = full_path[:last_slash] + '/..'
print "Append to PYTHONPATH: %s" % (dirpath)
sys.path.append(dirpath)
import time,re,logging
import math
from T... | mtthwflst/terse | Parsers/NBOinteractions.py | Python | mit | 5,634 |
"""
This program demonstrates how the ability to unpack a list
can be very useful in keeping your code clean and eliminating
the use of some list indices.
"""
my_lst = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
for a, b, c in my_lst:
print a, b, c
| sharkySharks/PythonForDevs | DemoProgs/list_unpk.py | Python | mit | 255 |
#!/usr/bin/env python
#Copyright (C) 2009-2011 by Benedict Paten (benedictpaten@gmail.com)
#
#Released under the MIT license, see LICENSE.txt
#!/usr/bin/python
"""Script for generating scatter plots from a cactus tree stats file.
"""
import xml.etree.ElementTree as ET
import os
from sonLib.bioio import getBasicOpti... | benedictpaten/cactusTools | stats/cactus_treeStatsScatterPlots.py | Python | mit | 4,115 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verify that building an object file correctly depends on running actions in
dependent targets, but not the targets themselves.
"""
impo... | guorendong/iridium-browser-ubuntu | tools/gyp/test/ninja/action_dependencies/gyptest-action-dependencies.py | Python | bsd-3-clause | 1,972 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 3 10:37:58 2017
@author: leo
"""
import argparse
import json
import os
from api_helpers import APIConnection
# =============================================================================
# Paths to configuration files
# ========================... | eig-2017/the-magical-csv-merge-machine | merge_machine/scripts/manage_data.py | Python | mit | 4,801 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'dev/ui/options.ui'
#
# Created: Thu Mar 24 23:22:32 2011
# by: PyQt4 UI code generator 4.7.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_DialogOptions(object):
def setupUi(self... | BlackDragonHunt/Mangle | ui/options_ui.py | Python | gpl-3.0 | 13,045 |
# Lint as: python3
# Copyright 2021 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 ... | tensorflow/lingvo | lingvo/jax/learners.py | Python | apache-2.0 | 15,193 |
#-----------------------------------------------------------------------------
# eveapi - EVE Online API access
#
# Copyright (c)2007 Jamie "Entity" van den Berge <entity@vapor.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files ... | fsufitch/eve-shipspinning | modules/eveapi.py | Python | mit | 26,931 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# Copyright 2017 Marcel Paffrath (Ruhr-Universitaet Bochum, Germany)
#
# This file is part of ActiveSeismoPick3D
#----------------------------------------------------------------------------
... | seismology-RUB/ASP3D | asp3d/gui/utils.py | Python | gpl-3.0 | 3,609 |
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
''' Post installation script for linux '''
import sys, os, cPickle, textwrap, stat, errno
from subprocess import check_call, check_output
from functools import partial
from calibre import __appname__, prints, guess_type
from calib... | jelly/calibre | src/calibre/linux.py | Python | gpl-3.0 | 45,645 |
#-*- coding: utf-8 -*-
from google.appengine.api import memcache
from google.appengine.api import users
from shorturls.models import *
from shorturls.template import get_template
import webapp2
class Index(webapp2.RequestHandler):
def get_template_values(self):
template_values = {}
user = users.get... | ghilbut/shorturls | shorturls/user/views.py | Python | mit | 2,661 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from calibre.gui2.preferences import ConfigWidgetBase, test_widget, \
AbortCommit
from calibre.gui2.preferences.s... | yeyanchao/calibre | src/calibre/gui2/preferences/saving.py | Python | gpl-3.0 | 1,820 |
#!/usr/bin/python
#
# Copyright: 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.0',
'status': ['preview'],... | tszym/ansible | lib/ansible/modules/cloud/google/gc_storage.py | Python | gpl-3.0 | 16,311 |
# Copyright 2015 Cisco Systems
# 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... | yanheven/neutron | neutron/agent/linux/pd.py | Python | apache-2.0 | 14,066 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.