commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
83a7b19d33c9dac43e103933c9b4a734304ed2a1 | Add some unit tests. | fyabc/MiniGames | HearthStone2/test/utils/test_misc.py | HearthStone2/test/utils/test_misc.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import unittest
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..'))
import MyHearthStone.utils.misc as misc
__author__ = 'fyabc'
class TestMisc(unittest.TestCase):
@classmethod
def setUpClass(cls):
... | mit | Python | |
3f1e21e1d2a3d1418c19e454f77071686d21f7b9 | add external project | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | meinberlin/apps/extprojects/admin.py | meinberlin/apps/extprojects/admin.py | from django.contrib import admin
from . import models
@admin.register(models.ExternalProject)
class ExternalProjectAdmin(admin.ModelAdmin):
fields = (
'name', 'url', 'description', 'tile_image', 'tile_image_copyright',
'is_archived'
)
list_display = ('__str__', 'organisation', 'is_draft',... | agpl-3.0 | Python | |
be30299c1e9013a99bf7e828700741c1ce3fe386 | Create a contrib rule for creating docker_push defaults. (#92) | bazelbuild/rules_docker,bazelbuild/rules_docker,bazelbuild/rules_docker,bazelbuild/rules_docker | docker/contrib/with-defaults.bzl | docker/contrib/with-defaults.bzl | # Copyright 2017 The Bazel 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 la... | apache-2.0 | Python | |
07b1602fbab9708929ac331617f4d6635b6e503d | Add test for `/v3/job/list` | treasure-data/td-client-python | tdclient/test/job_api_test.py | tdclient/test/job_api_test.py | #!/usr/bin/env python
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import with_statement
import functools
import os
from tdclient import api
from tdclient import version
def setup_function(function):
try:
del os.environ["TD_API_SERVER"]
except KeyErro... | apache-2.0 | Python | |
e7ec8c2023be2a480d7f459854133b1f5e4a3642 | Add module metrics, with plugins to calculate Cyclomatic Complexity and Halstead metrics of Scratch projects | jemole/hairball,jemole/hairball | hairball/plugins/metrics.py | hairball/plugins/metrics.py | """This module provides plugins with clasic Sw Engineering metrics"""
import math
from collections import Counter
from hairball.plugins import HairballPlugin
class CyclomaticComplexity(HairballPlugin):
"""Plugin that calculates the Cyclomatic Complexity of a project."""
def __init__(self):
super(Cyc... | bsd-2-clause | Python | |
42b4ca440ea785ae764f2c50fa0ca96539c2db8d | Create ShuffleLabel.py | DigitalSlideArchive/HistomicsTK,DigitalSlideArchive/HistomicsTK | histomicstk/ShuffleLabel.py | histomicstk/ShuffleLabel.py | import numpy as np
from skimage import measure as ms
def ShuffleLabel(Label):
"""
Shuffles labels in a label image to improve visualization and enhance
object boundaries.
Parameters
----------
Label : array_like
A label image generated by segmentation methods.
Returns
-------... | apache-2.0 | Python | |
dcd83ea781ad8de1111984c8972b314f6f88e4d0 | add orm-1 | chenqing24/learnPy27 | www/transwarp/orm.py | www/transwarp/orm.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jeff Chen'
'''
封装orm操作
'''
import db
class Field(object):
'''
db的字段名和类型
'''
def __init__(self, name, column_type):
self.name = name
self.column_type = column_type
def __str__(self): # 定制类,反馈类实例的内部信息
return '<%s:... | mit | Python | |
5e1ba2f9a14634fb1e8a7eaadbad370b97beb383 | Add Middle English | kylepjohnson/cltk,LBenzahia/cltk,D-K-E/cltk,TylerKirby/cltk,TylerKirby/cltk,cltk/cltk,diyclassics/cltk,LBenzahia/cltk | cltk/corpus/middle_english/alphabet.py | cltk/corpus/middle_english/alphabet.py | """
Sources:
From Old English to Standard English: A Course Book in Language Variation Across Time, Dennis Freeborn
https://web.cn.edu/kwheeler/documents/ME_Pronunciation.pdf
https://en.wikipedia.org/wiki/Middle_English_phonology
"""
ALPHABET = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'l',... | mit | Python | |
77b06bf2737095b889b8c31e5d296d03b3030bb4 | add promise model pesudo codes | faner-father/pypromise | promise.py | promise.py | # coding: utf-8
__author__ = 'cloud'
'''
promise model:
'''
# example 1:
'''
create vol and attach
'''
def vol_create(vol_arg):
pass
def vol_wait_available(scope):
pass
def vol_attach_get_lock(scope):
pass
def vol_attach(scope):
pass
def vol_attach_release_lock(scope):
pass
def vol_cr... | mit | Python | |
51dc6dc1ebe6babb468f0ef607ff750327a366ba | Enable the change tracking tables in admin. | KayEss/django-pubsubpull,KayEss/django-pubsubpull,KayEss/django-pubsubpull | pubsubpull/admin.py | pubsubpull/admin.py | """
Enable admin
"""
from django.contrib import admin
from pubsubpull.models import Request, UpdateLog
admin.site.register(Request)
admin.site.register(UpdateLog)
| mit | Python | |
bce4656156b4f04655f38099a4b577651dc794d5 | make python -m crossbar work, using the same console script | NinjaMSP/crossbar,NinjaMSP/crossbar,NinjaMSP/crossbar | crossbar/__main__.py | crossbar/__main__.py | #####################################################################################
#
# Copyright (C) Tavendo GmbH
#
# Unless a separate license agreement exists between you and Tavendo GmbH (e.g. you
# have purchased a commercial license), the license terms below apply.
#
# Should you enter into a separate licen... | agpl-3.0 | Python | |
6798e3460e573b06bbf941f96102ef4ce196ca49 | add channel for rpc | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | python/proto/pyRpc2/channler.py | python/proto/pyRpc2/channler.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2016 ASMlover. 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 copyrig... | bsd-2-clause | Python | |
23da66a6a36ab82b7cb356d110c26ef9a0412932 | Create EVE-FAG-DETECTOR.py | RavenNull/EVE-FAG-DETECTOR | EVE-FAG-DETECTOR.py | EVE-FAG-DETECTOR.py | print("EVE FAG DETECTOR v2.2.3")
eveName = input("What is the character's name?")
if(eveName == "Raven Null"):
print("Raven Null is not a fag.")
elif(eveName =="raven null"):
print("Learn how to use the shift key dumbass. Also, no faggotry was detected for Raven Null.")
else:
print("Player is confirmed to be a fag."... | mit | Python | |
6214758e0a4b7140454a4ef244521e87541307e5 | Add python3 template | jpschewe/code-templates,jpschewe/code-templates,jpschewe/code-templates | python3.py | python3.py | #!/usr/bin/env python3
import warnings
with warnings.catch_warnings():
import re
import sys
import argparse
import os
import os.path
import logging
script_dir=os.path.abspath(os.path.dirname(__file__))
def create_preferences_directory():
if os.name != "posix":
from win32com.sh... | unlicense | Python | |
aea51be0e9428ddb4f72b3382fea1ae1cd99f1a9 | add crude performance test script | nschloe/meshio | test/performance.py | test/performance.py | # -*- coding: utf-8 -*-
#
import time
import numpy
import pytest
import meshio
def generate_mesh():
'''Generates a fairly large mesh.
'''
import pygmsh
geom = pygmsh.built_in.Geometry()
geom.add_circle(
[0.0, 0.0, 0.0],
1.0,
# 5.0e-3,
1.0e-2,
num_sections... | mit | Python | |
478a78494199b8282b635323128c07f2661df58b | add pong | Fun2LearnCode/Python | pong/pong.py | pong/pong.py | #TKinterPongGame.py
from tkinter import *
import random
import time
class Ball:
def __init__(self, canvas, paddle, color):
self.canvas = canvas
self.paddle = paddle
self.id = canvas.create_oval(10, 10, 25, 25, fill=color)
self.canvas.move(self.id, 245, 150)
starts = [-3, -2, ... | mit | Python | |
97b9ee00277fa35c92886b1ed39864eba3707dce | Add organizer permissions to staff group | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/activities/migrations/0020_auto_20200224_1005.py | bluebottle/activities/migrations/0020_auto_20200224_1005.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-11-11 12:19
from __future__ import unicode_literals
from django.db import migrations
from bluebottle.utils.utils import update_group_permissions
def add_group_permissions(apps, schema_editor):
group_perms = {
'Staff': {
'perms': (
... | bsd-3-clause | Python | |
f2ec232ce654a645e5d243cc2a794b7a69fd438d | use your RPI for powerpoint presentations! | timwaizenegger/raspberrypi-examples,rafaelkperes/raspberrypi-examples,rafaelkperes/raspberrypi-examples,timwaizenegger/raspberrypi-examples | presenter.py | presenter.py | """
this script uses XAutomation, i.e. the xte command. install it with:
>sudo apt-get install xautomation
"""
import RPi.GPIO as GPIO
import subprocess
import time
btnPin1 = 27
btnPin2 = 22
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(btnPin1, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(btnPin2, ... | mit | Python | |
9ce799511701f1d8f06ce2555253325ad8c76cc2 | add abstract action class | euclio/rocket-propelled-rpg | rprpg/battle/action.py | rprpg/battle/action.py | import abc
class Action(object):
__metaclass__ = abc.ABCMeta
def __init__(self, requires_target):
self.target = None
self.requires_target = requires_target
@abc.abstractmethod
def execute(self):
pass
| mit | Python | |
b77187592e3a6ba4fd06c13fb2a576ab9066d893 | add test for #313 | gmarkall/numba,numba/numba,stonebig/numba,cpcloud/numba,ssarangi/numba,ssarangi/numba,stefanseefeld/numba,ssarangi/numba,numba/numba,sklam/numba,cpcloud/numba,IntelLabs/numba,pitrou/numba,jriehl/numba,gdementen/numba,sklam/numba,IntelLabs/numba,gmarkall/numba,gmarkall/numba,IntelLabs/numba,seibert/numba,stonebig/numba,... | numba/tests/issues/test_issue_313.py | numba/tests/issues/test_issue_313.py | # -*- coding: utf-8 -*-
from numba import void, double, jit
import numpy as np
# thanks to @ufechner7
def multiassign(res0, res1, val0, val1):
res0[:], res1[:] = val0[:], val1[:]
if __name__ == "__main__":
multiassign1 = jit(void(double[:], double[:], double[:], double[:]))(multiassign)
res0 = np.zer... | bsd-2-clause | Python | |
efbf98235b82c954364f35cb09f63006e23346e2 | Create tests for JavaScript parser. | eddieantonio/ad-hoc-miner,naturalness/sensibility,naturalness/sensibility,eddieantonio/ad-hoc-miner,naturalness/sensibility,eddieantonio/ad-hoc-miner,eddieantonio/ad-hoc-miner,naturalness/sensibility | tests/test_lang_javascript.py | tests/test_lang_javascript.py | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import pytest # type: ignore
from sensibility.language import Language
from sensibility.language.javascript import javascript
from sensibility.token_utils import Position
from location_factory import LocationFactory
test_file = r"""#!/usr/bin/env node
/*!
* This is a... | apache-2.0 | Python | |
b29a37c92efca42cbd85b24306455b063dce33e2 | debug module can be imported to cause break-on-exception | hobson/pug,hobson/pug,hobson/pug,hobson/pug | pug/debug.py | pug/debug.py | """Import this module to invoke the interractive python debugger, ipydb, on any exception
Resources:
Based on http://stackoverflow.com/a/242531/623735
Examples:
>>> import debug
>>> x=[][0]
"""
# from http://stackoverflow.com/a/242514/623735
# if __name__ == '__main__':
# try:
# main()
#... | mit | Python | |
fd3a4e39b17995f75d9b6027b4abcb29013f479d | add network/sshd.py. | ptrsxu/snippetpy | network/sshd.py | network/sshd.py | from __future__ import print_function
import os
import sys
import re
import time
import datetime
def get_ptyreq_reply(line):
# for Microsoft Windows, the `pty-req reply` in sshd log would be 0.
# for Linux, the `pty-req reply` would be 1.
REGEX = r'(?<=pty-req reply )\d'
try:
return re.search(... | mit | Python | |
45c746c6c6aee03092b2b08bf1aff73ead85683e | add form | wasit7/clubped,wasit7/clubped | 150409/server/form.py | 150409/server/form.py | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 23 18:48:43 2015
@author: Wasit
"""
from flask import Flask
from flask import request
app = Flask(__name__)
form_str="""<form action="login" method="POST">
First name:<br>
<input type="text" name="firstname" value="Mickey">
<br>
Last name:<br>
<input type="text" name="l... | bsd-2-clause | Python | |
a9077802269270a1d8cfb685400b9f23f45d6940 | add propagator test | vangj/py-bbn,vangj/py-bbn | tests/pptc/test_propagator.py | tests/pptc/test_propagator.py | from pybbn.graph.dag import BbnUtil
from pybbn.pptc.potentialinitializer import PotentialInitializer
from pybbn.pptc.moralizer import Moralizer
from pybbn.pptc.triangulator import Triangulator
from pybbn.pptc.transformer import Transformer
from pybbn.pptc.initializer import Initializer
from pybbn.pptc.propagator import... | apache-2.0 | Python | |
9100015cf25d0ab09aa3b8d6410343f933b599fc | Add quicklook.py, a quick way of checking properties across all the data | osmlab/nycbuildings,osmlab/nycbuildings,osmlab/nycbuildings | quicklook.py | quicklook.py | from fiona import collection
from sys import argv
from glob import glob
if (len(argv) == 2):
addrs = glob("chunks/addresses-%s.shp")
for addr in addrs:
print addr
else:
addrs = glob("chunks/addresses*.shp")
for addr in addrs:
try:
with collection(addr, "r") as input:
... | bsd-3-clause | Python | |
34939554fc3697867979a6ca711583b24d38def0 | Create quicksort.py | mschruf/python | quicksort.py | quicksort.py | """Implements Quicksort algorithm.
"""
import random # for random selection of pivot element
def swap_elements(mut_seq, index1, index2):
"""Swaps two elements of mutable sequence.
Args:
mut_seq: mutable sequence
index1: index of element to be swapped with element with index 'index2'
... | cc0-1.0 | Python | |
09ee7c5972f3a508355f6dfd49ff05d8de482cd9 | Add example of slide-hold-slide test | jrleeman/rsfmodel | shs_example.py | shs_example.py | import numpy as np
import matplotlib.pyplot as plt
import rsf
model = rsf.RateState()
# Set model initial conditions
model.mu0 = 0.6 # Friction initial (at the reference velocity)
model.a = 0.005 # Empirical coefficient for the direct effect
model.b = 0.01 # Empirical coefficient for the evolution effect
model.dc = 1... | mit | Python | |
4f7b103d6c5fa3b07abb23e346caa995a7f803ef | Make new test fail correctlyish | mkusz/invoke,kejbaly2/invoke,mkusz/invoke,pyinvoke/invoke,mattrobenolt/invoke,kejbaly2/invoke,tyewang/invoke,frol/invoke,singingwolfboy/invoke,pyinvoke/invoke,frol/invoke,pfmoore/invoke,pfmoore/invoke,mattrobenolt/invoke | tests/completion.py | tests/completion.py | import sys
from nose.tools import ok_
from _utils import _output_eq, IntegrationSpec, _dispatch, trap, expect_exit
class ShellCompletion(IntegrationSpec):
"""
Shell tab-completion behavior
"""
def no_input_means_just_task_names(self):
_output_eq('-c simple_ns_list --complete', "z_toplevel\n... | from _utils import _output_eq, IntegrationSpec
class ShellCompletion(IntegrationSpec):
"""
Shell tab-completion behavior
"""
def no_input_means_just_task_names(self):
_output_eq('-c simple_ns_list --complete', "z_toplevel\na.b.subtask\n")
def no_input_with_no_tasks_yields_empty_response(... | bsd-2-clause | Python |
b5dcc8d77ebbe3f1e62599164139cf60927c94c8 | Create Precio.py | mdmirabal/Parcial2-Prog3 | Precio.py | Precio.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from att import *
#from att import Sector_Destino
from zona import zona
from Conexion import *
# lugar = "Costa del Este"
# # lugar = "Altos del Hipódromo"
# # destino="El Tecal"
# # # lugar = "El Tecal"
# destino="Costa del Este"
lugar = "Albrook"
destino ="24 de Diciembre"
... | mit | Python | |
661943403b9a4b7c28bf9e0a59ba937dc2298fef | Add SSH auto detect feature | isidroamv/netmiko,ktbyers/netmiko,fooelisa/netmiko,ktbyers/netmiko,isidroamv/netmiko,fooelisa/netmiko | netmiko/ssh_autodetect.py | netmiko/ssh_autodetect.py | """
This module is used to auto-detect the type of a device in order to automatically create a
Netmiko connection.
The will avoid to hard coding the 'device_type' when using the ConnectHandler factory function
from Netmiko.
"""
from netmiko.ssh_dispatcher import CLASS_MAPPER_BASE, ConnectHandler
SSH_MAPPER_BASE = {}... | mit | Python | |
98dcea81abcfb795c61b24b260c5a5592d24b2d4 | use this file to built unit tests | rfleschenberg/django-shop,jrief/django-shop,nimbis/django-shop,nimbis/django-shop,jrief/django-shop,jrief/django-shop,rfleschenberg/django-shop,awesto/django-shop,divio/django-shop,jrief/django-shop,divio/django-shop,awesto/django-shop,divio/django-shop,nimbis/django-shop,khchine5/django-shop,khchine5/django-shop,rfles... | tests/test_money.py | tests/test_money.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from decimal import Decimal
import cPickle as pickle
from django.utils.formats import number_format
from . import Money
from .money_maker import MoneyMaker, AbstractMoney
# Tests:
m1 = Money('1.46')
m2 = Money('3.54')
m3 = Money(Decimal('8.99'))
m4 = Mone... | bsd-3-clause | Python | |
0d32800fec1419eac39711fd8c94ce07896cddaf | Test for the gaussian output layer, going through all same fit() and predict() tests as the linear output. | gticket/scikit-neuralnetwork,IndraVikas/scikit-neuralnetwork,capitancambio/scikit-neuralnetwork,agomariz/scikit-neuralnetwork,freakynit/scikit-neuralnetwork,KhanSuleyman/scikit-neuralnetwork,aigamedev/scikit-neuralnetwork | sknn/tests/test_gaussian.py | sknn/tests/test_gaussian.py | import unittest
from nose.tools import (assert_is_not_none, assert_raises, assert_equal)
from sknn.mlp import MultiLayerPerceptronRegressor as MLPR
from . import test_linear
class TestGaussianOutput(test_linear.TestLinearNetwork):
def setUp(self):
self.nn = MLPR(layers=[("LinearGaussian",)])
| bsd-3-clause | Python | |
dfa8f4b867a17a6f63a0e2e2e5f7f615ad514fc0 | improve proj | parrt/msan501,parrt/msan501,parrt/msan501 | notes/code/linked_list.py | notes/code/linked_list.py | # Hmm.... python classes are not so clear.
class LinkedList:
pass
class Node:
def __str__(self):
return str(self.value)
names = LinkedList()
names.head = None
def add(llist,x):
newnode = Node()
newnode.value = x
newnode.next = llist.head
llist.head = newnode
def printlist(llist):
... | mit | Python | |
5fb337e143ae55d98b3772dc6f5059d0c01115c1 | Create package __init__.py file. | tuttleofx/sconsProject | __init__.py | __init__.py | """
SConsProject
The sconsproject package proposes a way to easily create the compilation system
of your project with the minimum of information. It's an helper around SCons.
########################################
# Example 1
from sconsProject import SConsProject
project = SConsProject()
Export('project')
Export({... | mit | Python | |
436029e6f4626d0e13393206cc38e5f2cae9c770 | Create __init__.py | ShuaiGitHub/moca | __init__.py | __init__.py | apache-2.0 | Python | ||
3402602d0aaf39e491a6422ba35f175bc249539b | Add __init__.py. | eagleflo/mpyq,fengthedroid/mpyq | __init__.py | __init__.py | from mpyq import MPQArchive
__all__ = ['MPQArchive']
| bsd-2-clause | Python | |
6d33848780d71c9bf725288f1f92d022f143a7e6 | add sift_matcher #132 | pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc | jsk_2015_05_baxter_apc/node_scripts/sift_matcher.py | jsk_2015_05_baxter_apc/node_scripts/sift_matcher.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import os
import gzip
import cPickle as pickle
import numpy as np
import yaml
import rospy
from posedetection_msgs.msg import ImageFeature0D
from jsk_2014_picking_challenge.srv import ObjectMatch, ObjectMatchResponse
from sift_matcher_oneimg import SiftMatcherOneImg
... | bsd-3-clause | Python | |
c0aa12111befbc6a5779be6a0111f7b80027082d | add new package (#6659) | mfherbst/spack,LLNL/spack,EmreAtes/spack,EmreAtes/spack,krafczyk/spack,LLNL/spack,iulian787/spack,LLNL/spack,matthiasdiener/spack,krafczyk/spack,krafczyk/spack,LLNL/spack,EmreAtes/spack,LLNL/spack,mfherbst/spack,krafczyk/spack,tmerrick1/spack,EmreAtes/spack,EmreAtes/spack,tmerrick1/spack,matthiasdiener/spack,iulian787/... | var/spack/repos/builtin/packages/tasmanian/package.py | var/spack/repos/builtin/packages/tasmanian/package.py | ##############################################################################
# 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... | lgpl-2.1 | Python | |
d8fd5835b6ba0a6de757fe4aa63fa97bdbd15f83 | add new package (#2486) | iulian787/spack,matthiasdiener/spack,LLNL/spack,matthiasdiener/spack,iulian787/spack,TheTimmy/spack,skosukhin/spack,LLNL/spack,lgarren/spack,krafczyk/spack,tmerrick1/spack,lgarren/spack,EmreAtes/spack,tmerrick1/spack,krafczyk/spack,mfherbst/spack,TheTimmy/spack,krafczyk/spack,LLNL/spack,mfherbst/spack,lgarren/spack,tme... | var/spack/repos/builtin/packages/rename/package.py | var/spack/repos/builtin/packages/rename/package.py | ##############################################################################
# Copyright (c) 2013-2016, 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... | lgpl-2.1 | Python | |
a3261609967444c01039908d4eb7ccd7feaf3616 | add blinker example. | devlights/try-python | trypython/extlib/blinker01.py | trypython/extlib/blinker01.py | """
イベントディスパッチライブラリ blinker のサンプルです。
基本的な signal の使い方について。
REFERENCES::
https://github.com/jek/blinker
https://pythonhosted.org/blinker/
"""
import blinker as bl
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import hr
class Sample(SampleBase):
"""Blinker の基本的な使い方について"""
... | mit | Python | |
558e5ff1a4d33f339d34a4fe2fac649cd22f45c3 | add reprlib.repr() sample. | devlights/try-python | trypython/stdlib/reprlib01.py | trypython/stdlib/reprlib01.py | """
reprlib についてのサンプルです。
link::
https://docs.python.jp/3/library/reprlib.html
"""
import functools
import random
import reprlib
import string
from typing import Sequence, Callable
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
class ManyFields:
def __init__(self, ... | mit | Python | |
a4945972bb4f04c2d18fec87ec4c6d6e955cba1c | add release script | centsent/hydeo | release.py | release.py | #! /usr/bin/env python
import subprocess
import sys
GIT_SHOW_REF_HEARD = 'git show-ref --verify --quiet refs/heads/%s'
GIT_SHOW_REF_TAGS = 'git show-ref --verify --quiet refs/tags/%s'
def checkExistingTag(version):
if (subprocess.call((GIT_SHOW_REF_HEARD % version).split()) == 0 or
subprocess.call((GIT_SHO... | mit | Python | |
e8e00263acb7f04e19c0839bd881151b6ed4abd1 | Create webhook.py | fantazic/fb_pixel,fantazic/fb_pixel | webhook.py | webhook.py | print 'Hello'
| mit | Python | |
d2c674bf5583ea20e63a64486efb5d0e9e908e5a | Add module for mapping data onto KEGG pathways. | theandygross/Figures | src/Figures/KEGG.py | src/Figures/KEGG.py | __author__ = 'agross'
import re
import itertools
import urllib
import pandas as pd
from matplotlib.colors import rgb2hex
from matplotlib.cm import RdBu
KEGG_PATH = 'http://www.kegg.jp/kegg-bin/'
from Figures.KEGG import *
def pull_pathway_info_from_kegg(kegg_id):
o = urllib.urlopen('http://rest.kegg.jp/get/' +... | mit | Python | |
6bba6221343ec2b2c2626504ea46aba621a39df0 | convert gatk result to gistic segment file | shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl | lib/Format/gatk2gistic_segment_file.py | lib/Format/gatk2gistic_segment_file.py | import argparse
import gzip
import math
import logging
parser = argparse.ArgumentParser(description="Convert GATK segment CNV to gistic2 segmentation file",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-i', '--input', action='store', nargs='?', help='In... | apache-2.0 | Python | |
27177a3e27edfa8524c9bffee5aa4e4430d1e311 | Create base mesh | josuemontano/blender_wrapper | api/mesh.py | api/mesh.py | import bpy
from .base import BlenderObject
class Mesh(BlenderObject):
"""Base mesh"""
def add_modifier(self, type):
"""Add a modifier to the active object
:param type: Type of the modifier, must be one of the following:
- DATA_TRANSFER Data Transfer.
... | mit | Python | |
0b8ca8c7015ddd567abdd08e508a27c6ee3ed778 | fix history pickup payload | yunity/foodsaving-backend,yunity/yunity-core,yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend | karrot/history/migrations/0009_extend_historic_data_more.py | karrot/history/migrations/0009_extend_historic_data_more.py | from django.db import migrations
BATCH_SIZE = 1000
def migrate(apps, schema_editor):
History = apps.get_model('history', 'History')
# rewrite pickup date payload date field from string to list
save_payload = []
for h in History.objects.filter(payload__date__0__isnull=True, payload__date__isnull=Fal... | agpl-3.0 | Python | |
adbdacfceca33e0dc22f1d28b8e1963932c7e31a | save work for augmentation | kennethjiang/donkey,kennethjiang/donkey,kennethjiang/donkey | donkeycar/parts/stores/augmentation.py | donkeycar/parts/stores/augmentation.py | import numpy as np
def white_unbalance(x, y):
# Adjust white balance.
min_channel_high_end = 0.25
max_channel_low_end = 0.25
rmin = random.random()*min_channel_high_end
gmin = random.random()*min_channel_high_end
bmin = random.random()*min_channel_high_end
rmax = random.random()*max_channe... | mit | Python | |
23526005714a7cdeecc9288ddcdda562004e0c91 | Add rply based parser | funkybob/rattle,funkybob/rattle | rattle/parser.py | rattle/parser.py |
import ast
import rply
lg = rply.LexerGenerator()
lg.add('NUMBER', '\d+')
lg.add('STRING', "'.*?'|\".*?\"")
lg.add('NAME', '\w+')
lg.add('LSQB', '\[')
lg.add('RSQB', '\]')
lg.add('LPAREN', '\(')
lg.add('RPAREN', '\)')
#lg.add('EQUALS', '=')
#lg.add('COMMA', ',')
lg.add('DOT', '\.')
pg = rply.ParserGenerator(
[... | mit | Python | |
b5e9821642c07f30909f7cbaff193af6666777a7 | Revert "disable 'svn init' for blink temporarily" | withtone/depot_tools,michalliu/chromium-depot_tools,Phonebooth/depot_tools,duongbaoduy/gtools,Neozaru/depot_tools,gcodetogit/depot_tools,gcodetogit/depot_tools,liaorubei/depot_tools,HackFisher/depot_tools,kromain/chromium-tools,liaorubei/depot_tools,ajohnson23/depot_tools,Chilledheart/depot_tools,smikes/depot_tools,air... | recipes/blink.py | recipes/blink.py | # Copyright (c) 2013 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.
import json
# pylint: disable=F0401
import recipe_util
import sys
# pylint: disable=W0232
class Blink(recipe_util.Recipe):
"""Basic Recipe alias for B... | # Copyright (c) 2013 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.
# TOOD(dpranke): reenable import json
# pylint: disable=F0401
import recipe_util
import sys
# pylint: disable=W0232
class Blink(recipe_util.Recipe):
"... | bsd-3-clause | Python |
345b26fff755dbdea4021ba9bc613647a374644c | Add match group migration | leventebakos/football-ech,leventebakos/football-ech | matches/migrations/0007_match_group.py | matches/migrations/0007_match_group.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-24 13:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('matches', '0006_match_is_finished'),
]
operations = [
migrations.AddField(
... | mit | Python | |
907ff7fca6228248010dbb86fc81c2266cdeb264 | Add release script | LukeStebbing/Ergometer,LukeStebbing/Ergometer,LukeStebbing/Ergometer | release.py | release.py | #!/usr/bin/env python
from collections import OrderedDict
from itertools import zip_longest
import json
import os
import re
from subprocess import check_output, CalledProcessError
import sys
from zipfile import ZipFile
def sh(command, v=False):
if v:
print(command)
return check_output(command, text=T... | apache-2.0 | Python | |
1efab4cc16ded69d8da798aea61806890710bd2a | Add script drawing samples from P(z) binary file | marcoviero/Utils | draw_pofz_samples.py | draw_pofz_samples.py | from sys import exit
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import InterpolatedUnivariateSpline
from scipy.optimize import brentq, fsolve
from struct import *
#fileName = '/Users/guochaosun/Desktop/Caltech_OBSCOS/pofz/UVISTA_DR2_master_v2.1.tempfilt'
fileName = '/data/gjsun/catalo... | mit | Python | |
3ac53be481ec0b6465420d4a223378263f87475c | add test client | surendrakopera/ssp_server | test/client.py | test/client.py | import json
import socket
import ssl
import struct
import logging
import time
import sys
from kutils.ksonsocket import KSONClientConnection
from threading import Thread
def _client_default_handler(json_connection, msg):
print msg
def main(argv):
client_connection = KSONClientConnection(port=8080, secure=Fal... | bsd-3-clause | Python | |
53f54b114d23e5aa5e19aebc145944156d7ae87c | add example file starting to summarize an LRAUV log like the old review scripts | bluesquall/okeanidanalysis | examples/review-scripts/log-summary.py | examples/review-scripts/log-summary.py | #!/usr/bin/env python
import matplotlib.pyplot as plt
import okeanidanalysis as oa
def main(logfile, verbose=0):
"""summarize an LRAUV log file with plots
"""
if type(logfile) is not str: s = oa.logs.OkeanidLog(logfile.name)
else: s = oa.logs.OkeanidLog(logfile)
map_fig = plt.figure()
mbm... | mit | Python | |
237df47a31240ebf35a5de304bcc6c73e8f921b9 | Create merge_sort_fastest.py | TheAlgorithms/Python | sorts/merge_sort_fastest.py | sorts/merge_sort_fastest.py | '''
Python implementation of merge sort algorithm.
Takes an average of 0.6 microseconds to sort a list of length 1000 items.
Best Case Scenario : O(n)
Worst Case Scenario : O(n)
'''
def merge_sort(LIST):
start = []
end = []
a = LIST[0]
b = LIST[-1]
while (LIST.index(a) == LIST.index(b) and len(LIST)... | mit | Python | |
ec5337dc7d8fe4f642447e9b438818b61cdc74c2 | call docker logs on context.failed=true | bren3582/fabric,adecaro/fabric,binhn/obc-peer,gongsu832/fabric,bren3582/fabric,jjjjibm/fabric,isghe/obc-peer,jjjjibm/fabric,hyperledger-archives/fabric,andresgaragiola/fabric,ariccy/fabric,gennadylaventman/fabric,popldo/fabric,gennadylaventman/fabric,itp4IBM/fabric,tuand27613/fabric,ariccy/fabric,andresgaragiola/fabric... | openchain/peer/bddtests/environment.py | openchain/peer/bddtests/environment.py |
import subprocess
from steps.bdd_test_util import cli_call
def after_scenario(context, scenario):
if context.failed:
file_suffix = "_" + scenario.name.replace(" ", "_") + ".log"
for containerData in context.compose_containers:
with open(containerData.containerName + file_suffix, "w+") ... |
from steps.bdd_test_util import cli_call
def after_scenario(context, scenario):
if context.failed:
filename = scenario.name.replace(" ", "_")
for containerData in context.compose_containers:
logfile = containerData.containerName + filename
print("********** Test failed. Doc... | apache-2.0 | Python |
03c0b3e679e08f857a78479d73b5335ed2af46f0 | Create InputDataIO.py | cmsc471-swagbag/ScoreAttackBot | InputDataIO.py | InputDataIO.py | import win32api, win32con
import actionFunctions
#Write Function for AI
#Text format:
# [goodness number] [distance from ground] [distance from pipe]
#returns a list of the last iteration's input values
def writeToFile(goodness, distFromGround, distFromPipe)
outputFile = open("BotInputData.txt", 'w')
if (out... | mit | Python | |
e63b4b62cd5cd957da11e6c23bac1844d2a414a3 | Create main.py | clccmh/pomodoro | pomodor/main.py | pomodor/main.py | #!/usr/bin/env python
__version__ = '0.0.1'
__name__ = 'pomodoro'
import click
import progressbar
import time
@click.command()
@click.option('--minutes', default=25, help='Number of minutes, default 25.')
def pomodoro(minutes):
bar = progressbar.ProgressBar(widgets=[
progressbar.Bar(),
])
for i in ... | mit | Python | |
5d7c18219dfe3595a07901e7e56f69068ef7d586 | add vectorization example | kohr-h/odl,odlgroup/odl,kohr-h/odl,aringh/odl,odlgroup/odl,aringh/odl | examples/vectorization.py | examples/vectorization.py | # Copyright 2014, 2015 The ODL development group
#
# This file is part of ODL.
#
# ODL 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.
... | mpl-2.0 | Python | |
6aaf8b3843b0da2083b41519b273dfe2a5f43172 | Add experimental structarray code | oneklc/dimod,oneklc/dimod | scratch.py | scratch.py | import unittest
import numpy as np
def data_struct_array(sample, **vectors): # data_struct_array(sample, *, energy, **vectors):
"""Combine samples and per-sample data into a numpy structured array.
Args:
sample (array_like):
Samples, in any form that can be converted into a numpy array.... | apache-2.0 | Python | |
e40ddb72243faaf5a754537ea11d0393b02b27f2 | Create rest-mqtt.py | deneba/rest-mqtt | rest-mqtt.py | rest-mqtt.py | # Title: Script to catch rest calls for home automation and forward to MQTT (rest-mqtt)
# Author: Dr. Asif Rana (aiqbalrana@gmail.com)
# Date: 20160525
from flask import Flask
from flask import request
from flask_restful import Resource, Api
import paho.mqtt.publish as publish
import paho.mqtt.client as mqtt
import ti... | apache-2.0 | Python | |
da5949e020709e38f88d923dce5ab656696a0bd7 | Copy code from cluster mixin | dotsdl/msmbuilder,brookehus/msmbuilder,msultan/msmbuilder,stephenliu1989/msmbuilder,rmcgibbo/msmbuilder,peastman/msmbuilder,Eigenstate/msmbuilder,brookehus/msmbuilder,cxhernandez/msmbuilder,mpharrigan/mixtape,rafwiewiora/msmbuilder,msmbuilder/msmbuilder,msultan/msmbuilder,msmbuilder/msmbuilder,dotsdl/msmbuilder,stephen... | Mixtape/pca.py | Mixtape/pca.py | # Author: Matthew Harrigan <matthew.p.harrigan@gmail.com>
# Contributors:
# Copyright (c) 2014, Stanford University and the Authors
# All rights reserved.
#
# Mixtape is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software... | lgpl-2.1 | Python | |
785e37a65ee8bc311326e3c2db90a273858a345c | Prepare for rally-openstack package | openstack/rally,yeming233/rally,openstack/rally,openstack/rally,openstack/rally,yeming233/rally | rally/plugins/__init__.py | rally/plugins/__init__.py | # Copyright 2015: Mirantis 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 b... | # Copyright 2015: Mirantis 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 b... | apache-2.0 | Python |
d31528540950cd8b5e8a398b50bc59ea98271d26 | Create overlay.py | sonus89/FIPER,sonus89/FIPER,sonus89/FIPER | client/opencv/pic_on_pic/overlay.py | client/opencv/pic_on_pic/overlay.py | import cv2
import numpy as np
# Load two images
img1 = cv2.imread('1.jpg')
img2 = cv2.imread('2.png')
# I want to put logo on top-left corner, So I create a ROI
rows,cols,channels = img2.shape
roi = img1[0:rows, 0:cols ]
# Now create a mask of logo and create its inverse mask also
img2gray = cv2.cvtColor(img2,cv2.CO... | mit | Python | |
74ffdab0c54f332b8787aea04582ee7312a34b4c | Remove control_id column from assessments table | selahssea/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,selahssea/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,andrei-karalionak/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,VinnieJohns/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,se... | src/ggrc/migrations/versions/20161123124848_1f5c3e0025da_remove_control_id_column_from_.py | src/ggrc/migrations/versions/20161123124848_1f5c3e0025da_remove_control_id_column_from_.py | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Remove control_id column from assessments table
Create Date: 2016-11-23 12:48:48.942528
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name... | apache-2.0 | Python | |
7a6fd0ca5951bc1134fd0ac5b0cdbbb9b94fb3d4 | add palindrome exercise | daveagp/websheets,dz0/websheets,daveagp/websheets,dz0/websheets,daveagp/websheets,daveagp/websheets,dz0/websheets,daveagp/websheets,dz0/websheets,dz0/websheets,daveagp/websheets,dz0/websheets | exercises/IsPalindrome.py | exercises/IsPalindrome.py | description = r"""
(Exercise 3.1.13)
A <i>palindrome</i> is a string that reads the same forwards or backwards,
like <tt>"RADAR"</tt> or <tt>"STOOTS"</tt>.
Define a method <tt>isPalindrome</tt>
that takes as input a string and returns true if the
string is a palindrome, and false otherwise. You will need to use
the i... | agpl-3.0 | Python | |
79d6958670090f052ee0a1b1150364618838ff5e | add dev example settings file | KuwaitNET/cookiecutter-django-cms,KuwaitNET/cookiecutter-django-cms | {{cookiecutter.repo_name}}/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/settings/dev_example.py | {{cookiecutter.repo_name}}/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/settings/dev_example.py | import os
from .base import *
DEBUG = True
ALLOWED_HOSTS = ['*']
DEV = DEBUG
INSTALLED_APPS += ('debug_toolbar',)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'arwoad.db',
}
}
SECRET_KEY = 'devel'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBacken... | bsd-2-clause | Python | |
ea0e181659f328198955b07252d09ad2e3da0e42 | change name of setupTS | slac207/cs207project,slac207/cs207project,slac207/cs207project,slac207/cs207project | setupTS.py | setupTS.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup file for timeseries.
This file was generated with PyScaffold 2.5.6, a tool that easily
puts up a scaffold for your new Python project. Learn more under:
http://pyscaffold.readthedocs.org/
"""
import sys
from setuptools import setup
def setup_pa... | mit | Python | |
92d520127e01369be10f777d85e6021a023dec7d | Create scraper.py | azide0x37/modocDB,azide0x37/modocDB,azide0x37/modocDB,azide0x37/modocDB | scraper.py | scraper.py | #modocDB/scraper.py
#Scrapes the offender web search library for offender data
class Scraper:
def __init__(self):
pass
dataSet = Scraper()
| mit | Python | |
02831edd80949a474f3923f67addb642f8da0492 | Create randomQuizGenerator.py | PetrosKatri/mypythonscripts | Generating-Random-Quiz-Files/randomQuizGenerator.py | Generating-Random-Quiz-Files/randomQuizGenerator.py | #! python 3
# randomQuizGenerator.py - Creates quizzes with questions and answers in
# random order, along with the answer key.
import random
# The quiz data. Keys are states and values are their capitals.
capitals = {
'Alabama': 'Montgomery',
'Alaska': 'Juneau',
'Arizona': 'Phoenix',
'Arkansas': 'Little Rock',
... | mit | Python | |
809acb9fd29b0834745571c21f128d02932bc118 | Add bgr2hsv. | wwwins/OpenCV-Samples | bgr2hsv.py | bgr2hsv.py | import cv2
import numpy
import sys
bgrColor = None
# Get user supplied values
if len(sys.argv) != 3:
print("""
Usage:
python bgr2hsv.py -rgb 0,255,0
Output:
OpenCV HSV: [60, 255, 255]
""")
sys.exit()
if sys.argv[1]=="-rgb":
bgrColor = sys.argv[2].split(',')
bgrCo... | mit | Python | |
04c665b7bb71320b920812001f364a5b49544d41 | add tests for FasterRCNN | pfnet/chainercv,chainer/chainercv,chainer/chainercv,yuyu2172/chainercv,yuyu2172/chainercv | tests/links_tests/model_tests/fpn_tests/test_faster_rcnn.py | tests/links_tests/model_tests/fpn_tests/test_faster_rcnn.py | import numpy as np
import unittest
import chainer
from chainer import testing
from chainer.testing import attr
from chainercv.links.model.fpn import FasterRCNN
from chainercv.links.model.fpn import Head
from chainercv.links.model.fpn import RPN
from chainercv.utils import assert_is_detection_link
def _random_array(... | mit | Python | |
21f248d3fc90a604cd85283c48e339784e6ea523 | add command line interface | ContinuumIO/topik,kcompher/topik,kcompher/topik,kcompher/topik,lewismc/topik,ContinuumIO/topik,lewismc/topik,lewismc/topik | topik/cli.py | topik/cli.py | from __future__ import absolute_import
import os
from topik.readers import iter_document_json_stream, iter_documents_folder
from topik.tokenizers import (SimpleTokenizer, CollocationsTokenizer,
EntitiesTokenizer, MixedTokenizer)
from topik.vectorizers import CorpusBOW
from topik.model... | bsd-3-clause | Python | |
316ec13f041bc8b928ba7bb1253c0242ed2b5579 | Add example test script | Drewsif/PySecretSOCKS | example.py | example.py | #!/usr/bin/env python
from __future__ import division, absolute_import, print_function, unicode_literals
import secretsocks
import socket
import Queue
import threading
class Client(secretsocks.Client):
def __init__(self, ip, port):
secretsocks.Client.__init__(self)
s = socket.socket(socke... | mit | Python | |
d7f24713ad5b8372f5c5aacac252521d2dbbe192 | Add ui version | CivicVision/datahub,CivicVision/datahub,USStateDept/FPA_Core,johnjohndoe/spendb,spendb/spendb,openspending/spendb,nathanhilbert/FPA_Core,USStateDept/FPA_Core,johnjohndoe/spendb,johnjohndoe/spendb,pudo/spendb,CivicVision/datahub,pudo/spendb,USStateDept/FPA_Core,nathanhilbert/FPA_Core,spendb/spendb,spendb/spendb,pudo/spe... | openspending/ui/__init__.py | openspending/ui/__init__.py | __version__ = '0.8' | agpl-3.0 | Python | |
c41212807781af2c4f6078bbb1bb047591c0923a | Create tweet_basic.py | umangahuja1/Python | Automation/tweet_basic.py | Automation/tweet_basic.py | from selenium import webdriver
from getpass import getpass
from time import sleep
usr = input('Enter your username or email : ')
pwd = getpass('Enter your password : ')
msg = input('Enter your tweet : ')
driver = webdriver.Chrome()
driver.get('https://twitter.com/login')
usr_box = driver.find_element_by_class_name('... | apache-2.0 | Python | |
83515e8e4c354a68e317f6ba9f97c9ca73e0850c | Add Henon plot | martinmcbride/python-projects-for-gcse,martinmcbride/python-projects-for-gcse | fractals/iterate-henon.py | fractals/iterate-henon.py | import matplotlib.pyplot as plt
xvalues = []
yvalues = []
x = 1.12
y = 0.09
for i in range(10):
xvalues.append(x)
yvalues.append(y)
print(x, y)
x, y = y+1-1.4*x*x, 0.3*x
plt.plot(xvalues, yvalues)
plt.plot(xvalues, yvalues, 'bo')
plt.show() | mit | Python | |
fe4e5b0eba9d1064ce17cc5b8e7c64271969f2a9 | add initial migration for core app | edx/credentials,edx/credentials,edx/credentials,edx/credentials | credentials/apps/core/migrations/0001_initial.py | credentials/apps/core/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
import django.core.validators
import django.contrib.auth.models
class Migration(migrations.Migration):
dependencies = [
('auth', '0006_require_contenttypes_0002'),
]
... | agpl-3.0 | Python | |
5444920a3447be65592e14d26aba0ef6d257f6cb | Create rename_images.py | ElizabethSutton/Rename_images | rename_images.py | rename_images.py | #!/usr/bin/env python
import os
rootdir = os.getcwd()
for root, dirs, files in os.walk(rootdir):
for directory in dirs:
workingdir = os.path.join(root, directory)
contents = os.listdir(workingdir)
if '*.jpg' or '*.JPG' in contents:
count = 1
os.chdir(workingdir)
for file in contents:
if os.path.isf... | mit | Python | |
206eeb3c9ef3df1e2f7c4f7b2e3c2a002e642375 | Fix tab/spaces issue | kieselai/bashForEach.py | simpleLogger.py | simpleLogger.py | from colorama import init, Fore, Back
# Local imports
import formatter
init(autoreset=True)
class SimpleLogger:
""" Class Used to log messages to the terminal """
@staticmethod
def init(verboseLoggingEnabled):
""" Initialize the logger with this function
Parameters:
verboseLo... | apache-2.0 | Python | |
2178c706dc583c9a2325de7a9ca87a7ea9cb088b | Add start td_agent step | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/workflow/steps/util/region_migration/td_agent.py | dbaas/workflow/steps/util/region_migration/td_agent.py | # -*- coding: utf-8 -*-
import logging
from util import full_stack
from util import exec_remote_command
from util import build_context_script
from dbaas_cloudstack.models import HostAttr as CS_HostAttr
from workflow.steps.util.base import BaseStep
from workflow.steps.util import test_bash_script_error
from workflow.ste... | bsd-3-clause | Python | |
25802ed351018958fecf0808f70265d678709ce6 | Create 3longestWord.py | GabrielGhe/CoderbyteChallenges,GabrielGhe/CoderbyteChallenges | 3longestWord.py | 3longestWord.py | #Finds the longest word in a string
#1. Split the string by space using .split()
#2. using max function to find the biggest using the length as the criteria
def LongestWord(sen):
return max(sen.split(), key=len)
print LongestWord(raw_input())
| mit | Python | |
164f01c8a44c48486b3a2d161ac219e11c1a69e0 | Add check-version command | mnieber/dodo_commands | dodo_commands/extra/standard_commands/check-version.py | dodo_commands/extra/standard_commands/check-version.py | """Compare configuration version to version in original project config file."""
from . import DodoCommand
import os
import sys
import yaml
class Command(DodoCommand): # noqa
def _get_version(self, config_filename):
with open(config_filename) as f:
config = yaml.load(f.read())
version ... | mit | Python | |
35d3f38a9450c06212a4eceb93bfb890806d7f3e | Create Longest_Valid_Parentheses.py | jakeshi/algo | Longest_Valid_Parentheses.py | Longest_Valid_Parentheses.py | class Solution(object):
def longestValidParentheses(self, s):
"""
:type s: str
:rtype: int
"""
stack = []
ret = 0
last = -1
for i in range(len(s)):
if s[i] == '(':
stack.append(i)
else:
... | mit | Python | |
372bd768acae6fbf425271b193d1734e5001c71a | Add initial working solution 4 | xliiauo/leetcode,xliiauo/leetcode,xiao0720/leetcode,xliiauo/leetcode,xiao0720/leetcode | 4/Solution.py | 4/Solution.py | class Solution(object):
def findMedianSortedArrays(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: float
"""
nums1.extend(nums2)
merged = sorted(nums1)
length = len(merged)
if length % 2 != 0:
return ... | mit | Python | |
84769e0cf76f750e7b8c5315a937d881b097d969 | Add binding.gyp file for building the module with node-gyp. Should be used for nodejs v0.7 and v0.8 or so. | w1nk/node-odbc,w1nk/node-odbc,Akpotohwo/node-ibm_db,abiliooliveira/node-ibm_db,dfbaskin/node-odbc,ibmdb/node-ibm_db,qpresley/node-ibm_db,deckar01/node-odbc,wankdanker/node-odbc,bustta/node-odbc,Akpotohwo/node-ibm_db,qpresley/node-ibm_db,elkorep/node-ibm_db,w1nk/node-odbc,qpresley/node-ibm_db,bustta/node-odbc,abiliooliv... | binding.gyp | binding.gyp | {
'targets' : [
{
'target_name' : 'odbc_bindings',
'sources' : [
'src/Database.cpp'
],
'libraries' : [
'-lodbc'
],
'include_dirs' : [
'/usr/local/lib',
'/opt/local/lib',
'/usr/include'
],
'conditions' : [
[ 'OS == "linux"', {
}],
[ 'OS=="win"', {
... | mit | Python | |
2f0d186ef1a0b63e4c66ecd9e63cd1d02c73ecf8 | Create LeetCode-SummaryRanges.py | lingcheng99/Algorithm | LeetCode-SummaryRanges.py | LeetCode-SummaryRanges.py | """
Given a sorted integer array without duplicates, return the summary of its ranges.
For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].
"""
class Solution(object):
def summaryRanges(self, nums):
"""
:type nums: List[int]
:rtype: List[str]
"""
alist=[]
i... | mit | Python | |
e96e7cbcc1f7bc28832958e31baff11e8bfbf94c | Create gapstat.py | jaganadhg/data_science_notebooks | gapstat.py | gapstat.py | #!/usr/bin/env python
"""
Author : Jaganadh Gopinadhan
Licence : Apahce 2
e-mail jaganadhg at gmail dot com
"""
import scipy
from sklearn.cluster import KMeans
from sklearn.datasets import load_iris
import pandas as pd
class TWHGapStat(object):
"""
Implementation of Gap Statistic from Tibshirani, Walther,... | bsd-3-clause | Python | |
5013a7dfc3297a5f8d6f6d7107f0839f5b12d150 | Update network-delay-time.py | kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode | Python/network-delay-time.py | Python/network-delay-time.py | # Time: O((|E| + |V|) * log|V|)
# Space: O(|E| + |V|)
# Dijkstra's algorithm
class Solution(object):
def networkDelayTime(self, times, N, K):
"""
:type times: List[List[int]]
:type N: int
:type K: int
:rtype: int
"""
adj = [[] for _ in xrange(N)]
for... | # Time: O((|E| + |V|) * log|V|)
# Space: O(|E| + |V|)
# Dijkstra's algorithm
class Solution(object):
def networkDelayTime(self, times, N, K):
"""
:type times: List[List[int]]
:type N: int
:type K: int
:rtype: int
"""
min_heap = []
adj = [[] for _ in ... | mit | Python |
9532664cabae175aed73355d79f62f2326e2a9ef | add flask as server in react | yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn | react/s.py | react/s.py | from flask import Flask
import os
app = Flask(__name__, static_url_path='', static_folder='')
def serve_dir(path):
h = "<html>\n"
h = h + "<ul>\n"
for entry in os.scandir(path):
a = "<li><a href='{0}/{1}'>{1}</a></li>\n".format(path, entry.name)
h = h + a
h = h + "</ul>\n"
h = h ... | bsd-3-clause | Python | |
b66ad576230fb7c96a8f5c6c7b6af8a8e4c8d0b5 | Add module for Source Engine game logic entities | BHSPitMonkey/vmflib | vmf/games/source.py | vmf/games/source.py | """
Helper classes for creating maps in any Source Engine game.
"""
from vmf.vmf import Entity
from vmf.types import Origin
class LogicAuto(Entity):
"""Sets up certain game logic. Fires some useful map events.
https://developer.valvesoftware.com/wiki/Logic_auto
"""
def __init__(self):
... | bsd-2-clause | Python | |
688a9ab3bcc8312d88014ed93177c0b9d75f88cc | Create minimum_partition.py | TheAlgorithms/Python | dynamic_programming/minimum_partition.py | dynamic_programming/minimum_partition.py | """
Partition a set into two subsets such that the difference of subset sums is minimum
"""
def findMin(arr):
n = len(arr)
s = sum(arr)
dp = [[False for x in range(s+1)]for y in range(n+1)]
for i in range(1, n+1):
dp[i][0] = True
for i in range(1, s+1):
dp[0][i] = False
for i... | mit | Python | |
a198ab95fe34f368f8a579ec5e4c8fb7ef27c9c5 | Solve non abundant sums | daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various | project_euler/023.non_abundant_sums.py | project_euler/023.non_abundant_sums.py | '''
Problem 023
A perfect number is a number for which the sum of its proper divisors is exactly
equal to the number. For example, the sum of the proper divisors of 28 would
be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
A number n is called deficient if the sum of its proper divisors is ... | mit | Python | |
b18cf437f499ee8ebe536779883d05518a69c00f | Fix conflicting migrations | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0100_update_program_model.py | accelerator/migrations/0100_update_program_model.py | # Generated by Django 2.2.28 on 2022-04-20 13:05
import sorl.thumbnail.fields
from django.db import (
migrations,
models,
)
class Migration(migrations.Migration):
dependencies = [
<<<<<<< HEAD:accelerator/migrations/0101_update_program_model.py
('accelerator', '0100_add_innovation_stage_model'),... | mit | Python | |
64d4e6d302702e912d3db1125a00d22ad8eee2ab | Create get_collocations3.py | ahegel/scripts | get_collocations3.py | get_collocations3.py | import string
from nltk.tokenize import word_tokenize
from nltk.collocations import BigramCollocationFinder
from nltk.collocations import BigramAssocMeasures
from nltk.corpus import stopwords
# find collocations for each word
def get_collocations(corpus, windowsize=10, numresults=10):
'''This function uses the Na... | mit | Python | |
7d60876f2b1152fbe92ba90ec0fa9e2acfb05af2 | fix InMoov launching button | MyRobotLab/myrobotlab,MyRobotLab/myrobotlab,MyRobotLab/myrobotlab,MyRobotLab/myrobotlab,MyRobotLab/myrobotlab,MyRobotLab/myrobotlab,MyRobotLab/myrobotlab | src/main/resources/resource/Intro/InMoov01_start.py | src/main/resources/resource/Intro/InMoov01_start.py | #########################################
# InMoov01_start.py
# categories: inmoov
# more info @: http://myrobotlab.org/service/InMoov
#########################################
# uncomment for virtual hardware
# Platform.setVirtual(True)
i01 = Runtime.start('i01', 'InMoov2') | apache-2.0 | Python | |
8f2ec9462b038704d00f85b706cfb34a19eac974 | add weekly backup job | relembra/relembra | etc/weekly_backup.py | etc/weekly_backup.py | #!/usr/bin/env python
from datetime import datetime
import os.path
import sys
def day_abbrev():
return datetime.now().strftime('%Y%m%d').lower()
def warn(txt):
print >> sys.stderr, "WARNING: %s!" % txt
os.system("""echo "At %s: %s" | mail -s "WARNING: %s" euccastro@gmail.com""" % (datetime.now(), txt, t... | apache-2.0 | Python | |
2084569577c24fa0ba028bb6d0e8c8b62a604c61 | Create arduinoMicroShiftRegisterTests_PythonCompanion_debugSerialCmds_staticListOfPatterns.py | stephaneAG/Python_tests,stephaneAG/Python_tests,stephaneAG/Python_tests,stephaneAG/Python_tests | pyxhook/arduinoMicroShiftRegisterTests_PythonCompanion_debugSerialCmds_staticListOfPatterns.py | pyxhook/arduinoMicroShiftRegisterTests_PythonCompanion_debugSerialCmds_staticListOfPatterns.py | # -*- coding: utf-8 -*-
#!/usr/bin/env python
## -*- coding: iso-8859-1 -*-
# the above is to prevent that damn " SyntaxError: Non-ASCII character '\xc2' " error
# "Arduino companion"
# test implm of a LEDs animations using an Arduino Micro & 74HC595 shift registers
import serial # needed for serial communicatio... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.