code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
import random
import discord
from discord.ext import commands
class Mod:
"""Moderation tools"""
def __init__(self, Aya):
self.Aya = Aya
@commands.command(pass_context=True)
async def kick(self, ctx, *, member):
"""Kicks someone out of the server"""
kickmsg = ['Poor %s is out!... | Drinka/Aya | cogs/moderator.py | Python | mit | 2,181 |
from model_mommy.mommy import make
from yak.projects.models import Project
def test_accessible_to(me):
my_project = make(Project, owner=me)
their_project = make(Project, team_members=[me])
foreign_project = make(Project)
qs = Project.objects.accessible_to(me)
assert set(qs) == {my_project, their... | megapctr/Yak | tests/projects/querysets.py | Python | mit | 382 |
#Serge Aleshin-Guendel
#Utilities!!!
#
#
import numpy
import matplotlib.pyplot as plt
import roc_ci
from sklearn.metrics import roc_curve, auc
from sklearn.cross_validation import LeaveOneOut
from sklearn import preprocessing
from matplotlib.backends.backend_pdf import PdfPages
#Generate an ROC Curve
def plotROC( fp... | sverchkov/ivancic-panel-selection | python/analysis_utilities.py | Python | mit | 12,954 |
"""
observersimple.py
An implementation of the Observer Design Patterns
http://www.codeskulptor.org/#user41_SDGV3w1Qcj_1.py
"""
class Publisher: # Observable
"""registers subscribers to notify"""
def __init__(self):
self._subscribers = dict()
def register(self, subscriber, callback = None... | ReblochonMasque/codeskulptor_projects | observer_pattern/observersimple.py | Python | mit | 668 |
import unittest
import re
import requests
from .timeschedules_parser import FSM
class TestTimeschedulesParser(unittest.TestCase):
def _construct_fsm(self, string):
fsm = FSM([])
def stub(*args, **kwargs):
return string
fsm.next_string = stub
return fsm
def test_... | kelly-shen/canigraduate.uchicago.edu | backend/uchicago/src/timeschedules_parser_test.py | Python | mit | 1,945 |
import json
def as_json(func):
def inner(*args, **kwargs):
result = func(*args, **kwargs)
return json.dumps(result)
return inner
@as_json
def func(x, y):
return {"result": x + y}
# func(3, 4) -> "{result: 7}"
print("calling func with decorator that serializes the resulting dictionary retu... | jlant/playground | python/hello-decorators/as_json_decorator.py | Python | mit | 375 |
'''
- login and get token
- process 2FA if 2FA is setup for this account
- Get cashflow earnings for a given user
'''
import requests
import json
get_token_url = "https://api.canopy.cloud:443/api/v1/sessions/"
validate_otp_url = "https://api.canopy.cloud:443/api/v1/sessions/otp/validate.json" #calling the productio... | Mesitis/community | sample-code/Python/25 Cashflows/get_cashflow_earnings.py | Python | mit | 2,695 |
"""Helper functions for Flask-Statics."""
from flask_statics import resource_base
from flask_statics import resource_definitions
def priority(var):
"""Prioritizes resource position in the final HTML. To be fed into sorted(key=).
Javascript consoles throw errors if Bootstrap's js file is mentioned before jQu... | Robpol86/Flask-Statics-Helper | flask_statics/helpers.py | Python | mit | 1,406 |
from utils import PrimeGen, Timed
class DiagGen(object):
def __init__(self):
self.seed = 3
self.increment = 2
self.seed_increment = 2
def __iter__(self):
return self
def __next__(self):
diag = (
self.seed,
self.seed + self.increment,
... | nymoral/euler | p58.py | Python | mit | 992 |
'''
Load options from the command line
Sam Geen, July 2013
'''
import sys
def Arg1(default=None):
'''
Read the first argument
default: Default value to return if no argument is found
Return: First argument in sys.argv (minus program name) or default if none
'''
if len(sys.argv) < 2:
re... | samgeen/Hamu | Utils/CommandLine.py | Python | mit | 464 |
import numpy as np
from scipy.optimize import least_squares
def compute_error(screen_coordinate, eye_vector, candidate_params, mapfun):
computed_coord = mapfun(eye_vector, candidate_params)
return screen_coordinate - computed_coord
def compute_params(screen_points, eye_vectors, mapfun, num_params):
x_sc... | michele-mada/cv-eyetracking-project-2017 | py_eyetracker_v1.0/utils/screen_mapping/mappers/optimizer.py | Python | mit | 1,359 |
import unittest
"""
Given an array of positive integers, find the maximum sum of a sub-sequence with the
constraint that no two numbers in the sequence should be adjacent in the array.
Input: 3 2 7 10
Output: 13 (3 + 10)
Input 3 2 5 10 7
Output: 15 (3 + 5 + 7)
"""
"""
Approach:
1. Similar to 0-1 Knapsack problem.
2. F... | prathamtandon/g4gproblems | Arrays/max_sum_not_adjacent.py | Python | mit | 2,744 |
from sys import version_info
py3 = version_info[0] > 2
if py3:
response = input("Please enter your name: ")
else:
response = raw_input("Please enter your name: ")
print("Hello " + response) | SonyStone/pylib | Practical Maya Programming/input.py | Python | mit | 199 |
from django.db import models
from django.conf import settings
from django.core.exceptions import ValidationError
from polymorphic import PolymorphicModel
from django.db.models import F
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from celery.exceptions import SoftTimeLimitExc... | lolotux/cabot-docker | cabot/cabotapp/models.py | Python | mit | 32,605 |
# MIT License
#
# Copyright (c) 2017, Stefan Webb. All Rights Reserved.
#
# 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 us... | stefanwebb/tensorflow-models | tensorflow_models/trainers/svb_concrete_np.py | Python | mit | 3,783 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-06-21 04:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Donors',... | Lucasfeelix/ong-joao-de-barro | users/migrations/0001_initial.py | Python | mit | 2,597 |
#!/usr/bin/env python3
# Copyright (c) 2013-2020 The Fujicoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Generate seeds.txt from Pieter's DNS seeder
#
import re
import sys
import dns.resolver
import collec... | fujicoin/fujicoin | contrib/seeds/makeseeds.py | Python | mit | 8,060 |
# Thanks to Zhao Yu for converting the .ipynb notebook to
# this simplified Python script that I edited a little.
# Note that the dataset must be already downloaded for this script to work, do:
# $ cd data/
# $ python download_dataset.py
import tensorflow as tf
import numpy as np
import matplotlib
import mat... | KennyCandy/HAR | HAR_v7.py | Python | mit | 15,245 |
# -*- coding: utf-8 -*-
import datetime
from django.contrib import admin
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from newsletter.models import Newsletter, NewsletterSubscription
from newsletter.views import send_mass_email
def send_emails(newsletter, emails):
if s... | rokj/django_newsletter | newsletter/admin.py | Python | mit | 1,249 |
import pandas as pd
import logging
import settings
import os
from scikits.audiolab import oggwrite, play, oggread
from scipy.fftpack import dct
from itertools import chain
import numpy as np
import math
log = logging.getLogger(__name__)
def read_sound(fpath, limit=settings.MUSIC_TIME_LIMIT):
try:
data, f... | VikParuchuri/evolve-music2 | extract_features.py | Python | mit | 6,422 |
# coding=utf-8
import datetime
from bottle import Bottle, run, static_file, request, template, response, redirect
from settings import devices_definitions, server_params, session_db_file, cookie_secret
from models import Device, DeviceWrongAction
from utils import DbSession, session_required
app = Bottle()
devices... | krzysztofr/homectr | homectr-web.py | Python | mit | 1,403 |
"""Configuration for imitation.scripts.train_adversarial."""
import sacred
from imitation.rewards import reward_nets
from imitation.scripts.common import common, demonstrations, reward, rl, train
train_adversarial_ex = sacred.Experiment(
"train_adversarial",
ingredients=[
common.common_ingredient,
... | HumanCompatibleAI/imitation | src/imitation/scripts/config/train_adversarial.py | Python | mit | 4,850 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... | EmanueleCannizzaro/scons | test/duplicate-sources.py | Python | mit | 2,021 |
from django.conf.urls import url,patterns,include
from moto.moe.api import views,views2
from moto.moe.api import search
from rest_framework.authentication import SessionAuthentication
# urls
urlpatterns = patterns('',
url(r'^post/$', views.Post.as_view() ,name='post'),
url(r'^posts/$', views.PostList.as_view() ... | bung87/moto-moe | moto/moe/api/urls.py | Python | mit | 1,296 |
# -*- coding: utf-8 -*-
"""
oCreated on Sat May 12 20:05:39 2012
@author: Peter Gonda, Vojtech Rinik
"""
# junk = "is are the in of into from when where why what i he she we has a was me that this then than they your once had themselves there them to were through you do with every have and by for but all over my very... | vojto/stefan-server | server.py | Python | mit | 5,284 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-09-02 20:49
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pdl', '0001_initial'),
]
operations = [
migrations.AddField(
mod... | proyectosdeley/proyectos_de_ley | proyectos_de_ley/pdl/migrations/0002_proyecto_legislatura.py | Python | mit | 492 |
from datetime import datetime
from flask import Blueprint, current_app as app, flash, redirect, render_template, url_for
from flask_mail import Mail, Message
from kqueen_ui.auth import confirm_token, generate_confirmation_token
from kqueen_ui.exceptions import KQueenAPIException
from kqueen_ui.generic_views import KQue... | atengler/kqueen-ui | kqueen_ui/blueprints/registration/views.py | Python | mit | 4,267 |
from util.arguments import Arguments
from discord.ext import commands
from shlex import split
import random
class Choices:
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=['choose'], description='Randomly picks a 1 of the given choices.')
async def choices(self, *, msg):
... | duke605/RunePy | commands/choices.py | Python | mit | 957 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Same:
def checkSam(self, stringA, stringB):
# write code here
setA = sorted(stringA)
setB = sorted(stringB)
if setA == setB:
return True
return False
if __name__ == '__main__':
s = Same()
print s.check... | ZenQ3/Data-Structures | algorithms/string/checkSam.py | Python | mit | 363 |
import _plotly_utils.basevalidators
class HistfuncValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="histfunc", parent_name="histogram2d", **kwargs):
super(HistfuncValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram2d/_histfunc.py | Python | mit | 487 |
# Commands submodule definition.
#
# Import all python files in the directory to simplify adding commands.
# Just drop a new command .py file in the directory and it will be picked up
# automatically.
#
# Author: Tony DiCola
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Adafruit Industries
#
# Permission is hereby ... | adafruit/Adafruit_Legolas | Adafruit_Legolas/commands/__init__.py | Python | mit | 1,864 |
# Copyright 2016 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | martbhell/wasthereannhlgamelastnight | src/lib/google/oauth2/service_account.py | Python | mit | 25,866 |
from IPython.core.display import HTML
styles = open("./styles/custom.css", "r").read()
HTML(styles)
from IPython.core.display import HTML
import urllib2
HTML(urllib2.urlopen("http://nbviewer.jupyter.org/github/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/styles/custom.css").... | FedericoMuciaccia/SistemiComplessi | html/altro/output html.py | Python | mit | 710 |
F1_SPLIT = {'': ('NA', 'NA'),
'aboriginal': ('Aboriginal', 'NA'),
'aboriginal/gov': ('Aboriginal', 'Gov'),
'aboriginal/industry': ('Aboriginal', 'Industry'),
'aboriginal/industry/gov': ('Aboriginal', 'Industry'),
'aboriginal/recruiting': ('Aboriginal', 'HR'),
... | asterix135/infonex_crm | marketing/constants.py | Python | mit | 4,640 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'MODEL1006230013.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/MODEL1006230013 | MODEL1006230013/model.py | Python | cc0-1.0 | 427 |
from tests.unit.dataactcore.factories.staging import DetachedAwardFinancialAssistanceFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs30_detached_award_financial_assistance'
def test_column_headers(database):
expected_subset = {'row_number', 'business_funds_indic... | fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_fabs30_detached_award_financial_assistance.py | Python | cc0-1.0 | 1,646 |
# -*- coding: utf-8 -*-
"""
Django 配置 for waterproj project.
"""
import os
import wewater
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'z(d^c!%f2yip&*qzj)bqcq*9lc=ch78(=5n3$79be6xs7om_$i'
# SECURITY WARNING: don't run with deb... | coocol/WeWater | waterproj/settings.py | Python | cc0-1.0 | 1,901 |
#!python3
#encoding:utf-8
from abc import ABCMeta, abstractmethod
from web.service.github.api.v3.authentication.OAuthAuthentication import OAuthAuthentication
class OAuthTokenFromDatabaseAuthentication(OAuthAuthentication):
def __init__(self, db, username):
self.__db = db
self.__username = username
... | trysrv/GitHub.Uploader.CuiCmd.201706231541 | web/service/github/api/v3/authentication/OAuthTokenFromDatabaseAuthentication.py | Python | cc0-1.0 | 2,011 |
import string
import pickle
import time
import threading
import re
from urllib.request import urlopen
from Socket import openSocket,sendMessage,joinRoom,getUser,getMessage
from Settings import CHANNEL,MBALL,COOLDOWNCMD,VERSION,UNMOD
#from pastebin import getChangelog
s=openSocket("#"+CHANNEL)
joinRoom(s)
#... | Vambok/Tanook-Lebot | Run.py | Python | cc0-1.0 | 24,528 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
from frappe.utils import get_datetime_str, nowdate
def get_root_of(doctype):
"""Get ro... | Aptitudetech/ERPNext | erpnext/setup/utils.py | Python | cc0-1.0 | 4,104 |
# -*- coding: utf-8 -*-
#
# M4Baker
# Copyright (C) 2010 Kilian Lackhove
#
# 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 versio... | crabmanX/m4baker | src/aboutDialog.py | Python | gpl-2.0 | 1,275 |
import json
def jsonSave(data, fileName, indent=True, sort=False, oneLine=False):
f = open(fileName, 'w')
if indent:
f.write(json.dumps(data, indent=4, sort_keys=sort))
else:
f.write(json.dumps(data, sort_keys=sort))
f.close()
def jsonLoad(fileName):
try:
file = open(fileName)
t=file.read()
file.clo... | tannerbohn/ScholarVR | Code/fileIO.py | Python | gpl-2.0 | 368 |
# A part of pdfrw (https://github.com/pmaupin/pdfrw)
# Copyright (C) 2006-2015 Patrick Maupin, Austin, Texas
# MIT license -- See LICENSE.txt for details
# Deal with Python2/3 differences
try:
import zlib
except ImportError:
zlib = None
try:
unicode = unicode
except NameError:
def convert_load(s):
... | Wintermute0110/plugin.program.advanced.MAME.launcher | pdfrw/pdfrw/py23_diffs.py | Python | gpl-2.0 | 943 |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 4 00:18:49 2014
@author: Polcz Péter <ppolcz@gmail.com>
"""
import sys
import numpy as np
from PyQt4.QtGui import QVBoxLayout, QMessageBox, QApplication
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
from intellistock.ui.plo... | morta-code/IntelliStock | intellistock/ui/navigatorplotwidget.py | Python | gpl-2.0 | 3,270 |
# -*- coding: utf-8 -*-
from functools import partial
from navmazing import NavigateToSibling, NavigateToAttribute
from cfme.common import SummaryMixin, Taggable
from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import toolbar as tb
from cfme.web_ui import Quadicon, match_location, mixins
from utils.ap... | jdemon519/cfme_tests | cfme/storage/object_store.py | Python | gpl-2.0 | 1,961 |
# -*- coding: utf-8 -*-
# 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 distributed in the hope tha... | tyll/bodhi | bodhi/tests/server/services/test_updates.py | Python | gpl-2.0 | 193,782 |
# -*- coding: utf-8 -*-
###############################################################################
# Name: launchxml.py #
# Purpose: Launch Xml Interface #
# Author: Cody Precord <cprecord@editra.org> ... | garrettcap/Bulletproof-Backup | wx/tools/Editra/plugins/Launch/launch/launchxml.py | Python | gpl-2.0 | 4,699 |
#!/usr/bin/env python
from translate.misc import wStringIO
from translate.storage import test_monolingual, txt
class TestTxtUnit(test_monolingual.TestMonolingualUnit):
UnitClass = txt.TxtUnit
class TestTxtFile(test_monolingual.TestMonolingualStore):
StoreClass = txt.TxtFile
def txtparse(self, txtsourc... | claudep/translate | translate/storage/test_txt.py | Python | gpl-2.0 | 1,434 |
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.security import Security, SQLAlchemyUserDatastore
from flask.ext.mail import Mail
from flask.ext.babel import Babel
from flask.ext.migrate import Migrate
app = Flask(__name__)
app.config.from_object('config')
mail = Mail(app)
babel = Ba... | dlakata/VocabFinder | vocabfinder/__init__.py | Python | gpl-2.0 | 535 |
from NVDAObjects.IAccessible import IAccessible
import nvwave
import speech
import os
class AutocompleteList(IAccessible):
def event_selection(self):
speech.cancelSpeech()
speech.speakText(self.name)
| ThomasStivers/nvda-notepadPlusPlus | addon/appModules/notepad++/autocomplete.py | Python | gpl-2.0 | 210 |
# Copyright (C) 2016-2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: GPL-2.0-only
#
import logging
import json
from collections import OrderedDict, defaultdict
from urllib.parse import unquote, urlparse
import layerindexlib
import layerindexlib.plugin
logger = logging.getLogger('BitBake.layerindexlib.c... | schleichdi2/OPENNFR-6.3-CORE | bitbake/lib/layerindexlib/cooker.py | Python | gpl-2.0 | 14,139 |
# -*- coding: utf-8 -*-
"""
RED Plugin
Copyright (C) 2014-2015, 2017 Matthias Bolte <matthias@tinkerforge.com>
program_wizard.py: Program Wizard
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; eithe... | Tinkerforge/brickv | src/brickv/plugin_system/plugins/red/program_wizard.py | Python | gpl-2.0 | 1,802 |
# encoding: utf-8
# module samba.dcerpc.drsuapi
# from /usr/lib/python2.7/dist-packages/samba/dcerpc/drsuapi.so
# by generator 1.135
""" drsuapi DCE/RPC """
# imports
import dcerpc as __dcerpc
import talloc as __talloc
class DsReplicaNeighbourCtr(__talloc.Object):
# no doc
def __init__(self, *args, **kwargs)... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/samba/dcerpc/drsuapi/DsReplicaNeighbourCtr.py | Python | gpl-2.0 | 866 |
#!/usr/bin/env python2
#
# metadataPDF.py - dump pdf metadata
#
# Copy of Yusuke's dumppdf to add dumpmeta
import sys, re, os
from pdfminer.psparser import PSKeyword, PSLiteral
from pdfminer.pdfparser import PDFDocument, PDFParser
from pdfminer.pdftypes import PDFStream, PDFObjRef, resolve1, stream_value
from pdfminer... | Oweoqi/metagoofil | extractors/metadataPDF.py | Python | gpl-2.0 | 3,062 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
__init__.py
---------------------
Date : March 2016
Copyright : (C) 2016 by Adrian Weber
Email : webrian at gmx dot net
*********************************... | webrian/ProcessingDiagramPlugin | DiagramAlgorithmProvider.py | Python | gpl-2.0 | 4,094 |
# Author: Hubert Kario, (c) 2019
# Released under Gnu GPL v2.0, see LICENSE file for details
from __future__ import print_function
import traceback
import sys
import getopt
from itertools import chain
from random import sample
from tlsfuzzer.runner import Runner
from tlsfuzzer.messages import Connect, ClientHelloGene... | tomato42/tlsfuzzer | scripts/test-no-heartbeat.py | Python | gpl-2.0 | 18,247 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2009-2012 Zuza Software Foundation
#
# This file is part of Pootle.
#
# 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... | ttreeagency/PootleTypo3Org | pootle/apps/pootle_notifications/views.py | Python | gpl-2.0 | 8,843 |
#! /usr/bin/env python
#coding=utf-8
from osgeo import gdal, osr
import math, os, sys
import sqlite3
from numpy import *
from config import *
import util
def RunoffCoefficent(filepath, sqliteFile):
#read landuselookup table from sqlite
prcFields = ["PRC_ST%d" % (i,) for i in range(1,13)]
scFields = ["SC_S... | SmileEric/SEIMS | preprocess/runoff_coef.py | Python | gpl-2.0 | 3,410 |
from collections import OrderedDict
from yatcobot.plugins.filters import FilterABC
from yatcobot.plugins.ratings import RatingABC
class PostQueue(OrderedDict):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.rating_methods = RatingABC.get_enabled()
self.filte... | buluba89/Yatcobot | yatcobot/post_queue.py | Python | gpl-2.0 | 1,933 |
import unittest
import armv6instrdecode
import globals
import utils
import logging
import ARMCPU
import pdb
# if ConditionPassed(cond) then
# Rd = Rn + shifter_operand
# if S == 1 and Rd == R15 then
# if CurrentModeHasSPSR() then
# CPSR = SPSR
# else UNPREDICTABLE
# else if S == 1 then
# N Flag... | jsymolon/ARMSim | TestBKPT.py | Python | gpl-2.0 | 1,495 |
# -*- coding: utf-8 -*-
ddd = int(raw_input())
if (ddd == 61):
print("Brasilia")
elif (ddd == 71):
print("Salvador")
elif (ddd == 11):
print("Sao Paulo")
elif (ddd == 21):
print("Rio de Janeiro")
elif (ddd == 32):
print("Juiz de Fora")
elif (ddd == 19):
print("Campinas")
elif (ddd == 27):
p... | bergolho1337/URI-Online-Judge | Basicos/Python/1050/main.py | Python | gpl-2.0 | 420 |
"""
Scriptable Packages Installer - Parcks
Copyright (C) 2017 JValck - Setarit
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.... | Parcks/core | src/domain/model/post_install/post_install_runnable.py | Python | gpl-2.0 | 1,228 |
# Copyright (C) 2009-2012 Lars Wirzenius
#
# 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 distribu... | obnam-mirror/cliapp | cliapp/pluginmgr_tests.py | Python | gpl-2.0 | 3,602 |
from scipy import signal
import numpy as np
import matplotlib.pyplot as plt
xs = np.arange(0, np.pi, 0.05)
plt.plot(xs)
data = np.sin(xs)
plt.plot(data)
peakind = signal.find_peaks_cwt(data, np.arange(1,10))
print(peakind, xs[peakind], data[peakind]) | LevinJ/CodeSamples | python/images/findpeak.py | Python | gpl-2.0 | 253 |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2016 EventGhost Project <http://www.eventghost.net/>
#
# EventGhost 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 versio... | WoLpH/EventGhost | eg/WinApi/HID.py | Python | gpl-2.0 | 23,231 |
"""
Django settings for openshift project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
... | coursemdetw/2014django | wsgi/openshift/settings.py | Python | gpl-2.0 | 2,745 |
#-*- coding: utf-8 -*-
# processes.py
# Module providing informations about processes
#
# Copyright (C) 2016 Jakub Kadlcik
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your... | FrostyX/tracer | tracer/resources/processes.py | Python | gpl-2.0 | 9,071 |
#!/usr/bin/env
import subprocess, os, random, copy
output_filename = "twelvetone_ex.ly"
output_file = open(output_filename, "w")
notes = ['c','cis','d','dis','e','f','fis','g','gis','a','ais','b']
temp_tt_array = []
def twelvetone_gen():
notes_svd = copy.copy(notes)
a = 11
while len(temp_tt_array) < 12... | giannotr/misc-python | twelvetone.py | Python | gpl-2.0 | 1,207 |
#
#
# Copyright (C) 2006, 2007, 2011, 2012 Google 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 2 of the License, or
# (at your option) any later version.
#
# This progr... | kawamuray/ganeti | lib/mcpu.py | Python | gpl-2.0 | 21,010 |
# Big Data Smart Socket
# Copyright (C) 2016 Clemson 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 of the License, or
# (at your option) any later version.
#
# Th... | feltus/BDSS | client/client/actions/mechanisms_action.py | Python | gpl-2.0 | 1,025 |
import logging, os
from autotest_lib.client.common_lib import error
from autotest_lib.client.bin import utils
def run_clock_getres(test, params, env):
"""
Verify if guests using kvm-clock as the time source have a sane clock
resolution.
@param test: kvm test object.
@param params: Dictionary with... | libvirt/autotest | client/virt/tests/clock_getres.py | Python | gpl-2.0 | 1,155 |
#!/usr/bin/env python
#
# Copyright (c) 2013 Martin Abente Lahaye. - tch@sugarlabs.org
#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 righ... | tchx84/social-sugar | extensions/web/twitter/twitter/twr_status.py | Python | gpl-2.0 | 7,122 |
__author__ = 'bromix'
__all__ = ['kodion', 'youtube']
| repotvsupertuga/tvsupertuga.repository | plugin.video.youtube/resources/lib/youtube_plugin/__init__.py | Python | gpl-2.0 | 54 |
#!/usr/bin/env python
# encoding: utf-8
import os
import os.path as osp
import platform
import time
import commands
import xml.etree.ElementTree as ET
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
OS_SYSTEM = platform.system()
IS_WINDOWS = OS_SYSTEM == "Windo... | Zuckonit/weekr | weekr/core/logparser.py | Python | gpl-2.0 | 5,443 |
#! /usr/bin/python
"""
PCcrawler.py is the producer/consumer version of PF crawler. This will
be last the version before transforming into the pure-thread version.
PCcrawler.py is set up to start a crawl form a given list of frontiers,
pages already visted, and hash_codes already encountered:
webcrawl( file_to... | JoeDurrant/pysearch | PCcrawler.py | Python | gpl-2.0 | 22,205 |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Nils Weiss <nils@we155.de>
# This program is published under a GPLv2 license
# scapy.contrib.description = ISO-TP (ISO 15765-2) Native Socket Library
# scapy.contrib.status = library
import ctypes
from ctypes.... | gpotter2/scapy | scapy/contrib/isotp/isotp_native_socket.py | Python | gpl-2.0 | 14,939 |
from django.contrib.gis.db import models
class TestTable(models.Model):
field0 = models.CharField(max_length = 50)
def __unicode__(self):
return self.field0
class TestPoint(models.Model):
field0 = models.CharField(max_length = 50)
field1 = models.IntegerField()
field2 = models.DateTimeField()
field3 = models... | gista/django-geoshortcuts | geoshortcuts/tests/test_app/models.py | Python | gpl-2.0 | 1,245 |
"""
Lookup some search terms in the index.
"""
import sys
import haddoc
from collections import defaultdict
def main():
import optparse
parser = optparse.OptionParser(__doc__.strip())
haddoc.add_options(parser)
opts, args = parser.parse_args()
haddoc.validate_options(opts)
if not args:
... | emacsattic/haddoc | lib/python/haddoc/lookup.py | Python | gpl-2.0 | 885 |
from __future__ import division
from math import sqrt
def solve(s1, s2, q, L):
side = L * sqrt(2) - sqrt(2.0 * q)
return side / abs(s2 - s1)
if __name__ == '__main__':
L, s1, s2 = map(int, raw_input().strip().split())
Q = int(raw_input())
for _ in range(Q):
q = int(raw_input())
... | m00nlight/hackerrank | algorithm/contests/Ad-Infinitum-10/A.py | Python | gpl-2.0 | 357 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import os
import sys
log_level_index = sys.argv.index('--log_level') + 1 if '--log_level' in sys.argv else 0
os.environ['TF_CPP_MIN_LOG_LEVEL'] = sys.argv[log_level_index] if log_level_index > 0 and log_leve... | pandeydivesh15/AVSR-Deep-Speech | DeepSpeech_RHL.py | Python | gpl-2.0 | 72,056 |
#!/usr/bin/python3
"""
f24.data_suppliers.cache
~~~~~~~~~~~~~~~~~~~~~~~~
This module contains the class implementing a simple cache.
"""
import hashlib
import os
import time
import json
from pathlib import Path
class Cache:
CACHE_DIR = 'cache_db'
CACHE_FILENAME_LEN = 40
def __init__(self):
p =... | MatthieuMichon/f24 | src/v1/data_suppliers/cache.py | Python | gpl-2.0 | 2,208 |
#
# XendBootloader.py - Framework to run a boot loader for picking the kernel
#
# Copyright 2005-2006 Red Hat, Inc.
# Jeremy Katz <katzj@redhat.com>
#
# This software may be freely redistributed under the terms of the GNU
# general public license.
#
# You should have received a copy of the GNU General Public License
# ... | mikesun/xen-cow-checkpointing | tools/python/xen/xend/XendBootloader.py | Python | gpl-2.0 | 5,656 |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2016 EventGhost Project <http://www.eventghost.net/>
#
# EventGhost 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 versio... | WoLpH/EventGhost | eg/Classes/ActionBase.py | Python | gpl-2.0 | 6,104 |
#--------------------------------------------------------------
# Purpose: Creates custom quarter quarter section grid labels.
#
# Author: Ian Broad
# Website: www.ianbroad.com
#
# Created: 04/21/2014
#--------------------------------------------------------------
import arcpy
arcpy.env.overwriteOutp... | inkenbrandt/ArcPy | PLSS/CreateQQLabels.py | Python | gpl-2.0 | 8,932 |
# #
# Copyright 2009-2017 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (... | ULHPC/easybuild-easyblocks | easybuild/easyblocks/i/impi.py | Python | gpl-2.0 | 9,563 |
#!/usr/bin/env python3.5
# -*- coding: utf-8 -*-
# Author: ChenLiang
# Python 叫模块,其他叫 类库
"""
模块,用一砣代码实现了某个功能的代码集合。
类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合。而对于一个复杂的功能来,可能需要多个函数才能完成(函数又可以在不同的.py文件中),n个 .py 文件组成的代码集合就称为模块。
如:os 是系统相关的模块;file是文件操作相关的模块
模块分为三种:
自定义模块
第三方模块
内置模块
"""
"""
# 自定义模块
文件
1. 新... | smartczm/python-learn | Old-day01-10/s13-day5/s3.py | Python | gpl-2.0 | 8,551 |
#!/usr/bin/env python
import sys
import argparse
try:
import pyfabm
except ImportError:
print 'Unable to load pyfabm. See https://github.com/fabm-model/code/wiki/python.'
sys.exit(1)
parser = argparse.ArgumentParser(description='This script lists all state variables, diagnostic variables, conserved quantiti... | hofmeist/fabm-ihf | testcases/python/fabm_describe_model.py | Python | gpl-2.0 | 1,716 |
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from .forms import ColabSetUsernameForm, UserChangeForm
User = get_user_model()
class CustomUserAdmin(UserAdmin):
form = UserCh... | colab/colab | colab/accounts/admin.py | Python | gpl-2.0 | 1,320 |
# Copyright (C)
#
# Author :
from GIC.Channels.GenericChannel import *
class ChannelTest (GenericChannel):
# mandatory fields to work on LibreGeoSocial search engine
MANDATORY_FIELDS = ["latitude", "longitude", "radius", "category"]
CATEGORIES = [{"id" : "0", "name" : "all", "desc" : "All supported ... | kgblll/libresoft-gymkhana | libs/ChannelTemplate.py | Python | gpl-2.0 | 822 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
DsgTools
A QGIS plugin
Brazilian Army Cartographic Production Tools
-------------------
begin : 2017-08-24
git sha ... | lcoandrade/DsgTools | gui/CustomWidgets/BasicInterfaceWidgets/buttonPropWidget.py | Python | gpl-2.0 | 27,350 |
# Copyright 2017 Red Hat, 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the ... | EdDev/vdsm | lib/vdsm/network/ip/rule/__init__.py | Python | gpl-2.0 | 2,327 |
#!/usr/bin/env python2
"""
rdio-history-csv.py
~~~~~~~~~~~~~~~~~~~
Simple script for parsing the output of
https://www.rdio.com/api/1/getHistoryForUser
The way I made this happen was:
#. login to rdio.com in chrome,
#. visit https://www.rdio.com/people/tylercipriani/history/ with devtools
open
#.... | thcipriani/rdio-shit | bin/rdio-history-csv.py | Python | gpl-2.0 | 1,498 |
class IoConfig:
def __init__(self, i_path, mode, o_pin=None, set_temp=None, buffer_temp=None, direction=None):
self.i_path = i_path
self.mode = mode
self.o_pin = o_pin
self.set_temp = set_temp
self.buffer_temp = buffer_temp
self.on_fn = self.get_on_fn(direction)
self.off_fn = self.get_off_fn(direction)
... | rj3d/PiTempController | config_reader.py | Python | gpl-2.0 | 1,798 |
# xorn.geda - Python library for manipulating gEDA files
#**********************************************************************
# _ _ __ _ _
# __ _ _ __ ___| |_ | |__ __ _ ___ ___ / /_ | or |
# / _` | '_ \ / _ \ __| | '_ \ / _` / __|/ _ \ '_ \| or |_
# | (_| | | | ... | bert/geda-gaf | xorn/src/python/base64.py | Python | gpl-2.0 | 7,731 |
from django.http.response import HttpResponse
from django.shortcuts import render_to_response, render
from Browser.models import UserInfo
from Browser.views import cellar, administrator
def simple_response(request, *args, **kwargs):
template_name = kwargs["path"]
if kwargs["type"] :
template_name = kw... | SonienTaegi/CELLAR | Browser/views/__init__.py | Python | gpl-2.0 | 672 |
#!/usr/bin/env python
# Install.py tool to build the GPU library
# used to automate the steps described in the README file in this dir
from __future__ import print_function
import sys,os,subprocess
# help message
help = """
Syntax from src dir: make lib-gpu args="-m machine -h hdir -a arch -p precision -e esuffix -... | jag1g13/lammps | lib/gpu/Install.py | Python | gpl-2.0 | 5,201 |
#!/usr/bin/python
import sys, os
import tornado.ioloop
import tornado.web
import logging
import logging.handlers
import re
from urllib import unquote
import config
from vehiclenet import *
reload(sys)
sys.setdefaultencoding('utf8')
def deamon(chdir = False):
try:
if os.fork() > 0:
os._exit(0)
except OSError,... | codemeow5/vehiclenet-python | web.py | Python | gpl-2.0 | 2,732 |
__author__ = 'haoyu'
from GameBlock import GameBlock
class ScriptSpliter:
def __init__(self, scriptReader):
self.reader = scriptReader
def parse(self):
blocks = {}
blockName = 'game null pointer'
blocks[blockName] = GameBlock(blockName)
for line in self.reader:
... | jinyu121/LifeLine | ScriptSpliter.py | Python | gpl-2.0 | 817 |
import pygame
import numpy
def add_noise(surface):
mask = surface.copy()
mask.set_colorkey((255,255,255))
screen_array = pygame.surfarray.pixels3d(surface)
noise = numpy.random.random((surface.get_width(), surface.get_height())) * 255
screen_array *= noise[:, :, numpy.newaxis]
del screen_array... | erlehmann/noise-invaders | pyspaceinvaders_noise.py | Python | gpl-2.0 | 371 |
from Face import *
from Vertex import *
from Tkinter import *
import sys
import copy
#add proper support for the R and W
#add proper support for sorting
#make comparison a static member
class Graph(object):
__slots__ = ['faceGraph', 'vertexGraph', 'doubleBonds', 'vertexRoots', 'lastAddPair', 'FriesNumber', 'ClarsNumb... | MCLA-Cheminformatics/Kekulean | Graph.py | Python | gpl-2.0 | 17,898 |