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 |
|---|---|---|---|---|---|---|---|---|
370f5a87ac8d26245b5919fc98b24019861f4dde | Add missing test | GeoscienceAustralia/GeodesyMLConverter,GeoscienceAustralia/GeodesyMLConverter | tests/test_fetch_site_logs_from_ftp_sites.py | tests/test_fetch_site_logs_from_ftp_sites.py | import pytest
import os
from fetch_site_logs_from_ftp_sites import gws_list_site_logs
def test_get_gws_site_logs():
os.environ['gws_url'] = 'https://testgeodesy-webservices.geodesy.ga.gov.au'
assert len(gws_list_site_logs()) > 1000
| apache-2.0 | Python | |
0774413ae3623c28a8aaf77727d0c355f6a5bd7c | Add deezer_complete core plugin #146 | Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide | timeside/plugins/provider/deezer_complete.py | timeside/plugins/provider/deezer_complete.py | from timeside.core import implements, interfacedoc
from timeside.core.provider import Provider
from timeside.core.api import IProvider
from timeside.core.tools.utils import slugify
import os
from requests import get
class DeezerComplete(Provider):
"""
Represents Deezer Provider while loading results
comp... | agpl-3.0 | Python | |
02c06a544b1b6e4230a9b658540b360cc60c0bb5 | add cmstat.py | liuyang1/dotfiles,liuyang1/dotfiles,liuyang1/dotfiles,liuyang1/dotfiles | gist/cmstat.py | gist/cmstat.py | from __future__ import print_function
import sh
from collections import namedtuple
import os
import itertools
git = sh.git.bake()
NumStat = namedtuple('NumStat', ['insert', 'delete', 'filename'])
def getCommit(commit):
"""get commit message
--no-pager: stop pager which block stdout
-n 1: only show one c... | mit | Python | |
e29a2107cd08e6b40b99e3682d783887107a5e77 | Add a loader to load several yaml files | novafloss/populous | populous/loader.py | populous/loader.py | import collections
import yaml
def load_yaml(*filenames):
"""
Parse the given files as if they were a single YAML file.
"""
with ChainedFileObject(*filenames) as f:
return yaml.load(f)
class ChainedFileObject(object):
"""
A file-like object behaving like if all the given filenames w... | mit | Python | |
555cedf76d5f569b8a99691ed7dba672e578bb42 | Add admin integration for positions | Hackfmi/Diaphanum,Hackfmi/Diaphanum | positions/admin.py | positions/admin.py | from django.contrib import admin
from .models import Position
class PositionAdminIndex(admin.ModelAdmin):
list_display = ['title', 'date']
list_filter = ['date']
search_fields = ['title', 'content']
admin.site.register(Position, PositionAdminIndex) | mit | Python | |
9dc39f6492d9ece3964d5cb733cc146acee7cf66 | Create w3_1.py | s40523236/2016fallcp_hw,s40523236/2016fallcp_hw,s40523236/2016fallcp_hw | w3_1.py | w3_1.py | print("hello")
| agpl-3.0 | Python | |
31fcd83585905ca28245e42163c77af38f0c83cf | Create w3_1.py | s40523242/2016fallcp_hw,s40523242/2016fallcp_hw,s40523242/2016fallcp_hw | w3_1.py | w3_1.py | print("test")
| agpl-3.0 | Python | |
d35f2d7310c277625ea6e2e15b887ac9620696a7 | Add unit test for glacier vault | felix-d/boto,lochiiconnectivity/boto,weebygames/boto,abridgett/boto,appneta/boto,alex/boto,j-carl/boto,appneta/boto,rayluo/boto,lochiiconnectivity/boto,weka-io/boto,jameslegg/boto,drbild/boto,alfredodeza/boto,ocadotechnology/boto,janslow/boto,disruptek/boto,campenberger/boto,trademob/boto,elainexmas/boto,israelbenatar/... | tests/unit/glacier/test_vault.py | tests/unit/glacier/test_vault.py | #!/usr/bin/env python
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without ... | mit | Python | |
d44f12ca4395c0001bbaf0cf0d5436a84484569c | Create fasta2nexus.py | biokit/biokit,biokit/biokit | biokit/converters/fasta2nexus.py | biokit/converters/fasta2nexus.py | from Bio import AlignIO
class Fasta2Nexus(object):
"""
"""
def __init__(self, infile, outfile, *args, **kwargs):
"""
"""
self.infile = infile
self.outfile = outfile
def __call__(self):
input_handle = open(self.infile, "rU")
output_handle = open(self.ou... | bsd-2-clause | Python | |
e8cd41a2151e5907aeaac685f5c78300a010ce7e | add sensu plugin to check eventanomaly | yieldbot/sensu-yieldbot-plugins,yieldbot/sensu-yieldbot-plugins,yieldbot/sensu-yieldbot-plugins | plugins/bongo/check-eventanomaly.py | plugins/bongo/check-eventanomaly.py | #!/usr/bin/env python
from optparse import OptionParser
import socket
import sys
import httplib
import json
PASS = 0
FAIL = 1
def get_bongo_host(server, app):
try:
con = httplib.HTTPConnection(server, timeout=45)
con.request("GET","/v2/apps/" + app)
data = con.getresponse()
if dat... | mit | Python | |
6a95f7aa987994cdd173dc52d5de2754e449ebbb | Add a Python script that controls the user list in my own Twitter lists. | showa-yojyo/bin,showa-yojyo/bin | listmanager.py | listmanager.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This script manages your own Twitter lists.
Examples:
You can add users to a list by the "add" command::
$ python listmanager.py add your_screen_name your_list_name user1 [user2 ...]
Likewise, you can also remove users by the "remove" command.
"""
from secret... | mit | Python | |
489c77d3bbd3a9e0e14578f4371870042e2d04d1 | Add another debug script | tomislacker/cornbread | debug1.py | debug1.py | import logging
import threading
from cornbread.xorg import *
if __name__ == '__main__':
logging.warning('Creating FW')
w = FocusedWindow()
logging.warning('Creating FW thread')
t = threading.Thread(target=FocusedWindowWatcher, args=(w,))
logging.warning('Starting thread')
t.start()
try:
... | apache-2.0 | Python | |
28d409eea4fbcd3846d0146f878529ed3b1c2145 | Create update.py | ASpelling/mw-trading,ASpelling/mw-trading,ASpelling/mw-trading | app/update.py | app/update.py | '''
Update functions for Classes in Models
- Update SCTR - updatingSCTR()
in: array (Adj Close)
out: float (Average SCTR over SCTR_AVERAGE days, EMA50)
- Update Money wave - updatingMoneyWave()
in: array (High, Low, Adj Close, nextMWPrice = False, MW)
out: float (Money Wave)
- Sub func
Update next stock price for a... | apache-2.0 | Python | |
b6b65f0ca7253af5325eafc6b19e7cfecda231b3 | Add solution for exercise 2b of hw3 | escorciav/amcs211,escorciav/amcs211 | hw3/hw3_2b.py | hw3/hw3_2b.py | import sympy
x1, x2 = sympy.symbols('x1 x2')
f = 8*x1 + 12*x2 + x1**2 -2*x2**2
df_dx1 = sympy.diff(f,x1)
df_dx2 = sympy.diff(f,x2)
H = sympy.hessian(f, (x1, x2))
xs = sympy.solve([df_dx1, df_dx2], [x1, x2])
H_xs = H.subs([(x1,xs[x1]), (x2,xs[x2])])
lambda_xs = H_xs.eigenvals()
count = 0
for i in lambda_xs.keys():
... | bsd-2-clause | Python | |
8649fef1ddea18525fd0f6c5f8aa42e18b0726f8 | rename plot to visualizer | clemsos/mitras,clemsos/mitras,clemsos/mitras | lib/visualizer.py | lib/visualizer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
import datetime
import time
from utils import slugify
from scipy.cluster.hierarchy import dendrogram
def create_bar_graph(_x,_y,_title,_disp):
print "Creating ... | mit | Python | |
71b0af732e6d151a22cc0d0b28b55020780af8b6 | Add memoize function for python 2.x | ironman5366/W.I.L.L,ironman5366/W.I.L.L | ftools.py | ftools.py | from functools import wraps
def memoize(obj):
# This is taken from the Python Decorator Library on the official Python
# wiki. https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize
# Unfortunately we're using Python 2.x here and lru_cache isn't available
cache = obj.cache = {}
@wraps(obj)... | mit | Python | |
1967db2a9b6e3b4420a1ebc5fe5fe157d61c6314 | Initialise entry and do a proper 404 if it could not be found. | ushahidi/mobilefeed,ushahidi/mobilefeed | kindlefeed.py | kindlefeed.py | # KindleFeed Controller
# =====================
#
# This file is part of KindleFeed.
#
# KindleFeed is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option)... | # KindleFeed Controller
# =====================
#
# This file is part of KindleFeed.
#
# KindleFeed is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option)... | agpl-3.0 | Python |
4bc2c46e605b7bffb6e7e8206fdb6bb168864c45 | test random user fulfilling the specifications | nukru/projectQ,nukru/Swarm-Surveys,nukru/Swarm-Surveys,nukru/projectQ,nukru/Swarm-Surveys,nukru/projectQ,nukru/projectQ | listRandomUser.py | listRandomUser.py | import random
class list_random:
def __init__(self, n):
self.n=n
self.count=n/2
self.l_tuple=[]
for i in range(n):
for j in range(i+1,n):
self.l_tuple.append([i,j,0])
# 0 no usado
# 1 invalido
# 2 usado
... | apache-2.0 | Python | |
c2f1717c53042f8ff3a7ba169a2db365aa8bc8ba | ADd gff2togff3.py | konrad/kuf_bio_scripts | gff2togff3.py | gff2togff3.py | """Change attribute string from GFF2 format GGF3 format."""
import csv
import sys
for row in csv.reader(open(sys.argv[1]), delimiter="\t"):
if not row[0].startswith("#"):
row[8] = ";".join(
["%s=%s" % (attribute.split()[0], " ".join(attribute.split()[1:]))
for attribute in row[8].... | isc | Python | |
ac89ec64ab619bfa778d0961aeaefc8967d971a3 | Add errors.py to move away from Python errors | vakila/kimi | errors.py | errors.py | # Kimi language interpreter in Python 3
# Anjana Vakil
# http://www.github.com/vakila/kimi
def complain_and_die(message):
print(message)
quit()
def assert_or_complain(assertion, message):
try:
assert assertion
except AssertionError:
complain_and_die(message)
| mit | Python | |
5cb726d5139537cbe7c03bc5ed540b9cdb7c7e21 | Add bzero simprocedure I have had lying around forever | schieb/angr,angr/angr,schieb/angr,angr/angr,schieb/angr,angr/angr | angr/procedures/posix/bzero.py | angr/procedures/posix/bzero.py | from ..libc import memset
class bzero(memset.memset):
def run(self, addr, size):
return super().run(addr, self.state.solver.BVV(0, self.arch.byte_width), size)
| bsd-2-clause | Python | |
551f78f32665b1397120ada10036c1d9c09daddc | Create flip-bits.py | joshua-jin/algorithm-campus,joshua-jin/algorithm-campus,joshua-jin/algorithm-campus | lulu/flip-bits.py | lulu/flip-bits.py | class Solution:
"""
@param a, b: Two integer
return: An integer
"""
def bitSwapRequired(self, a, b):
# write your code here
return self.countOnes(a^b)
def countOnes(self, num):
# write your code here
counter = 0
a = 1
for i in range(0, 32)... | mit | Python | |
75437fc5607b41763f8c81813ba12dbe1c414c5f | combine the sequence names from various headers and then concatonate the sam entries | jason-weirather/Au-public,jason-weirather/Au-public,jason-weirather/Au-public,jason-weirather/Au-public | iron/utilities/combine_sam.py | iron/utilities/combine_sam.py | #!/usr/bin/python
import sys, argparse, re
def main():
parser = argparse.ArgumentParser(description = 'Combine sam files')
parser.add_argument('sam_files',nargs='+',help='FILENAME for sam files')
args = parser.parse_args()
header = False
seqs = set()
tagorder = []
tagseen = {}
for file in args.sam_file... | apache-2.0 | Python | |
e3c493847ead7352ecad1e92a739a1b79549a70c | Add dodo tape command | mnieber/dodo_commands | dodo_commands/extra/webdev_commands/tape.py | dodo_commands/extra/webdev_commands/tape.py | # noqa
import argparse
from dodo_commands.extra.standard_commands import DodoCommand
class Command(DodoCommand): # noqa
help = ""
decorators = ["docker"]
docker_options = [
'--name=tape',
]
def add_arguments_imp(self, parser): # noqa
parser.add_argument(
'tape_args',... | mit | Python | |
0f13cc95eeeed58c770e60b74a37f99ca24a28f0 | add tests for views | gitgik/updown | api/tests/test_views.py | api/tests/test_views.py | from django.test import TestCase
from rest_framework.test import APIClient
from rest_framework import status
from django.core.urlresolvers import reverse
class ViewsTestCase(TestCase):
"""Test suite for views."""
def setUp(self):
"""setup variables"""
self.client = APIClient()
def create_... | mit | Python | |
aba613ddef5e25e057ca515bb017c4a21095936f | Add example to use CRF1d with automatically sorting sequences | keisuke-umezawa/chainer,chainer/chainer,wkentaro/chainer,niboshi/chainer,wkentaro/chainer,hvy/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,wkentaro/chainer,chainer/chainer,pfnet/chainer,chainer/chainer,okuta/chainer,niboshi/chainer,keisuke-umezawa/chainer,okuta/chainer,niboshi/chainer,hvy/chainer,hvy/chainer... | examples/pos/postagging_with_auto_transpose.py | examples/pos/postagging_with_auto_transpose.py | import argparse
import collections
import nltk
import numpy
import six
import chainer
from chainer import datasets
import chainer.links as L
from chainer import reporter
from chainer import training
from chainer.training import extensions
class CRF(chainer.Chain):
def __init__(self, n_vocab, n_pos):
su... | mit | Python | |
27788308891d9cd82da7782d62b5920ea7a54f80 | Add custom command to daily check scores | belatrix/BackendAllStars | employees/management/commands/dailycheck.py | employees/management/commands/dailycheck.py | from constance import config
from datetime import datetime
from django.core.management.base import BaseCommand
from django.core.mail import EmailMessage
from django.shortcuts import get_list_or_404
from employees.models import Employee
class Command(BaseCommand):
help = "Update scores daily."
def change_day(... | apache-2.0 | Python | |
8aac73fdc26fd838c3f91ffa9bc58e25777a5179 | Add tests for mach angle | iwarobots/TunnelDesign | properties/tests/test_mach_angle.py | properties/tests/test_mach_angle.py | #!/usr/bin/env python
"""Test Mach angle functions.
Test data is obtained from http://www.grc.nasa.gov/WWW/k-12/airplane/machang.html.
"""
import nose
import nose.tools as nt
from properties.prandtl_meyer_function import mu_in_deg
@nt.raises(ValueError)
def test_mach_lesser_than_one():
m = 0.1
mu_in_deg(... | mit | Python | |
49dfd690abe794e3b393b8bcac3e0ab1427c41b3 | Define riot_open. | soasme/riotpy | riot/app.py | riot/app.py | # -*- coding: utf-8 -*-
import urwid
def run_tag(tag, *args, **kwargs):
loop = urwid.MainLoop(tag, *args, **kwargs)
loop.run()
def quit_app():
raise urwid.ExitMainLoop()
| mit | Python | |
04021db907109a5291833eb5ae96c45fb8d1802c | Add flask app mocking the EC API | okfn/ckanext-glasgow,okfn/ckanext-glasgow | ckanext/glasgow/tests/mock_ec.py | ckanext/glasgow/tests/mock_ec.py | import uuid
import flask
from werkzeug.exceptions import default_exceptions
from werkzeug.exceptions import HTTPException
def make_json_app(import_name, **kwargs):
"""
Creates a JSON-oriented Flask app.
All error responses that you don't specifically
manage yourself will have application/json conten... | agpl-3.0 | Python | |
f1cc40c716f1e4f598e0a9230cd188fc897ac117 | add config | graycarl/moon | moon/config.py | moon/config.py | # -*- coding: utf-8 -*-
""" 这里是一些工具, 用来实现简单的项目配置系统 """
import logging
_confdata = {}
def setconf(prjname, confile, confdict={}):
_confdata[prjname] = (confile, confdict)
def exportconf(prjname, globals):
""" 从文件和字典中导出配置
>>> open("/tmp/testmoonconf.py", "w").write("OSOS = 10")
>>> setconf("hongbo", ... | mit | Python | |
106a339561f5b79e0cd9508246d2f8da227c4fdc | move file to folder | adwardlee/tf_utils,adwardlee/tf_utils | move_hmdb51.py | move_hmdb51.py | import argparse
import os
import sys
import math
import cv2
import numpy as np
import multiprocessing
import re
import shutil
parser = argparse.ArgumentParser()
parser.add_argument('--data_dir', type=str, help="video image list",
default='/media/llj/storage/tvcj/hmdbcnn3_test')
parser.add_argument('--origin_fil... | mit | Python | |
6349d8acfd76fc893dfdb6a7c12aebfe9ec1bac9 | add plexpy/Plex.tv | pannal/Subliminal.bundle,pannal/Subliminal.bundle,pannal/Subliminal.bundle | Contents/Libraries/Shared/subzero/lib/auth.py | Contents/Libraries/Shared/subzero/lib/auth.py | # coding=utf-8
# thanks, https://github.com/drzoidberg33/plexpy/blob/master/plexpy/plextv.py
class PlexTV(object):
"""
Plex.tv authentication
"""
def __init__(self, username=None, password=None):
self.protocol = 'HTTPS'
self.username = username
self.password = password
... | mit | Python | |
d0c2ee2e0d848a586cc03ba5ac5da697b333ef32 | Create list of random num | JLJTECH/TutorialTesting | Misc/listOfRandomNum.py | Misc/listOfRandomNum.py | #List of randoms
import random
import math
numList = []
for i in range(10):
numList.append(random.randrange(1, 20))
for i in numList:
print("Rand num = " + str(i))
| mit | Python | |
9f508a429949d59f9969cc1e17a9094fa7c2441d | Create routines.py | evuez/mutations | routines.py | routines.py | mit | Python | ||
85abbe29c7c764deac75b6e7b95e1ccec645d84b | Add icmp_ping ansible module | coolsvap/clapper,coolsvap/clapper,rthallisey/clapper,coolsvap/clapper,rthallisey/clapper | ansible-tests/validations/library/icmp_ping.py | ansible-tests/validations/library/icmp_ping.py | #!/usr/bin/env python
DOCUMENTATION = '''
---
module: icmp_ping
short_description: ICMP ping remote hosts
requirements: [ ping ]
description:
- Check host connectivity with ICMP ping.
options:
host:
required: true
description:
- IP address or hostname of host to ping
type: s... | apache-2.0 | Python | |
d3937b803baf036d5bd96dfcb1e10e51b29bab1e | Create migration | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | fellowms/migrations/0023_event_ad_status.py | fellowms/migrations/0023_event_ad_status.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-06 13:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellowms', '0022_fellow_user'),
]
operations = [
migrations.AddField(
... | bsd-3-clause | Python | |
0781070ee0c17a34a3cc9521e8a6b67c401aa692 | Add WGAN Tests | googleinterns/audio_synthesis | models/wgan_test.py | models/wgan_test.py | # Lint as: python3
"""Tests for WGAN model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
import os
import wgan
class SpectralTest(tf.test.TestCase):
def test_interpolation_2d(self):
x1 = np.ra... | apache-2.0 | Python | |
e90d12802ff62738cbe4094e8db079f6519f47a5 | Create BDayGift.py | tejasnikumbh/Algorithms,tejasnikumbh/Algorithms,tejasnikumbh/Algorithms | Probability/BDayGift.py | Probability/BDayGift.py | import sys;
n = int(sys.stdin.readline());
S = 0
for i in range(n):
S += int(sys.stdin.readline());
print(S/2.0);
| bsd-2-clause | Python | |
45f91a92fd3ae08dd7403707f3981f306122eb6c | test task creation | ScorpionResponse/freelancefinder,ScorpionResponse/freelancefinder,ScorpionResponse/freelancefinder | freelancefinder/remotes/tests/test_tasks.py | freelancefinder/remotes/tests/test_tasks.py | """Tests related to the remotes.tasks functions."""
from django_celery_beat.models import IntervalSchedule, PeriodicTask
from ..tasks import setup_periodic_tasks
def test_make_tasks():
"""Ensure that setup makes some tasks/schedules."""
setup_periodic_tasks(None)
intervals = IntervalSchedule.objects.all... | bsd-3-clause | Python | |
cd3f59026b9026d62537b38d4e9d70a740e88018 | Add tests for java mode | jpfxgood/ped | tests/test_java_mode.py | tests/test_java_mode.py | import editor_manager
import editor_common
import curses
import curses.ascii
import keytab
from ped_test_util import read_str,validate_screen,editor_test_suite,play_macro,screen_size,match_attr
def test_java_mode(testdir,capsys):
with capsys.disabled():
def main(stdscr):
lines_to_test = [
... | mit | Python | |
f03f976696077db4146ea78e0d0b1ef5767f00ca | Add high level signing capabilities | cachedout/libnacl,saltstack/libnacl,johnttan/libnacl,mindw/libnacl,coinkite/libnacl,RaetProtocol/libnacl | tests/unit/test_sign.py | tests/unit/test_sign.py | # Import libnacl libs
import libnacl.sign
# Import pythonlibs
import unittest
class TestSigning(unittest.TestCase):
'''
'''
def test_sign(self):
msg = ('Well, that\'s no ordinary rabbit. That\'s the most foul, '
'cruel, and bad-tempered rodent you ever set eyes on.')
signe... | apache-2.0 | Python | |
f6609763f832cd5672e40d1dfe8f7dc7c58ca7c5 | Create diarygui.py | bambooom/OMOOC2py,bambooom/OMOOC2py | _src/om2py2w/2wex0/diarygui.py | _src/om2py2w/2wex0/diarygui.py | # -*- coding: utf-8 -*-
# ------------2w task:simple diary GUI-----------
# --------------created by bambooom--------------
from Tkinter import * # import Tkinter module
from ScrolledText import * # ScrolledText module = Text Widget + scrollbar
global newlog
class Application(Frame): # 基本框架
def __init... | mit | Python | |
c43c7d523ddbb5b914748a20d55971fbf1c12496 | Create oauth2token.py | leydaniel/barcode-attendance | oauth2token.py | oauth2token.py | #!/usr/bin/python
'''
This script will attempt to open your webbrowser,
perform OAuth 2 authentication and print your access token.
It depends on two libraries: oauth2client and gflags.
To install dependencies from PyPI:
$ pip install python-gflags oauth2client
Then run this script:
$ ... | mit | Python | |
31cdb65a8d370c6f309ad610aa3b969d5bfb8706 | Add follow_bot.py | ismailsunni/TweetJaran,ismailsunni/TweetJaran | follow_bot.py | follow_bot.py | """Follow bot, to follow some followers from an account
"""
__date__ = '08/01/2014'
__author__ = '@ismailsunni'
import tweepy
import constants
# constants
consumer_key = constants.consumer_key
consumer_secret = constants.consumer_secret
access_key = constants.access_key
access_secret = constants.access_secret
def ne... | mit | Python | |
30f18a4be667b02f8d0f6c2f2bf97146992d3208 | Add first version of OpenCV core | sparsebase/stromx,sparsebase/stromx,uboot/stromx,uboot/stromx | opencv/core.py | opencv/core.py | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 1 18:19:38 2013
@author: matz
"""
import cvtype
import datatype
import document
import generator
import package
import test
# abbreviations
dt = test.Default()
# utilitiy functions
dcl = document.Document()
dcl.line("void checkEnumValue(const stromx::runtime::Enum & v... | apache-2.0 | Python | |
e26be1cdee6b40896e7ee5c2a894fba05fc58480 | Add traceview directory. | danriti/python-traceview | traceview/__init__.py | traceview/__init__.py | # -*- coding: utf-8 -*-
"""
TraceView API library
:copyright: (c) 2014 by Daniel Riti.
:license: MIT, see LICENSE for more details.
"""
__title__ = 'traceview'
__version__ = '0.1.0'
__author__ = 'Daniel Riti'
__license__ = 'MIT'
| mit | Python | |
b28d2933ac1b5c6375f9dd5142f467a06bd69463 | add a simple plot script to visualize the distribution | BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH | Utils/py/BallDetection/Evaluation/plot_csv.py | Utils/py/BallDetection/Evaluation/plot_csv.py | import matplotlib.pyplot as plt
import sys
import numpy as np
scores = np.genfromtxt(sys.argv[1], usecols=(1), skip_header=1, delimiter=",")
scores = np.sort(scores)
plt.style.use('seaborn')
plt.plot(scores)
plt.show() | apache-2.0 | Python | |
6d910181758008d05de3917fdac5b35b34188a8e | add RebootNodeWithPCU call. fails gracefully if dependencies are not met. | dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi | PLC/Methods/RebootNodeWithPCU.py | PLC/Methods/RebootNodeWithPCU.py | import socket
from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Nodes import Node, Nodes
from PLC.NodeNetworks import NodeNetwork, NodeNetworks
from PLC.Auth import Auth
from PLC.POD import udp_pod
try:
from pcucontrol import reboot
external_dependency = True... | bsd-3-clause | Python | |
f75e1397735adcbd39dbc90a0446b9efd9532be4 | add initial python script to handle button events that trigger the node process | FrankZZ/awesome-selfie-machine,FrankZZ/awesome-selfie-machine,FrankZZ/awesome-selfie-machine | bin/selfie.py | bin/selfie.py | #!/usr/bin/python
import RPi.GPIO as GPIO
import time
from subprocess import call
GPIO.setmode(GPIO.BCM)
BUTTON = 18;
GPIO.setup(BUTTON, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
input_state = GPIO.input(BUTTON)
if input_state == False:
print('Button Pressed')
call(["node", "./index.js... | isc | Python | |
fb83969c6467e288ff16661aec2eafc174bdf124 | correct fieldsight form issue fix | awemulya/fieldsight-kobocat,awemulya/fieldsight-kobocat,awemulya/fieldsight-kobocat,awemulya/fieldsight-kobocat | onadata/apps/fsforms/management/commands/set_correct_fxf_in_finstance.py | onadata/apps/fsforms/management/commands/set_correct_fxf_in_finstance.py | from django.db import transaction
from django.core.management.base import BaseCommand
from onadata.apps.fieldsight.models import Site
from onadata.apps.fsforms.models import FieldSightXF, FInstance
from onadata.apps.viewer.models.parsed_instance import update_mongo_instance
class Command(BaseCommand):
help = 'De... | bsd-2-clause | Python | |
0f76875400ea1a03a23a4b266eb0ca9bf574922d | implement 9 (9) 各行を2コラム目,1コラム目の優先順位で辞書の逆順ソートしたもの(注意: 各行の内容は変更せずに並び替えよ).確認にはsortコマンドを用いよ(この問題は結果が合わなくてもよい). | mihyaeru21/nlp100 | set01/09.py | set01/09.py | # -*- coding: utf-8 -*-
# (9) 各行を2コラム目,1コラム目の優先順位で辞書の逆順ソートしたもの(注意: 各行の内容は変更せずに並び替えよ).確認にはsortコマンドを用いよ(この問題は結果が合わなくてもよい).
import sys
lines = [line.decode('utf-8').rstrip(u'\r\n') for line in sys.stdin.readlines()]
lines = sorted(lines, key = lambda l: l.split(u'\t')[0])
lines = sorted(lines, key = lambda l: l.split(u'... | unlicense | Python | |
d654bf0fb0c5e3fc7a11029a216c109b5f04d37b | Add __init__ file | OpenSourcePolicyCenter/taxdata | taxdata/cps/__init__.py | taxdata/cps/__init__.py | # flake8: noqa
from taxdata.cps import benefits
from taxdata.cps import cps_meta
from taxdata.cps import cpsmar
from taxdata.cps.create import create
from taxdata.cps.finalprep import finalprep
from taxdata.cps import helpers
from taxdata.cps import impute
from taxdata.cps import pycps
from taxdata.cps import splitinco... | mit | Python | |
1fddb845ad99bb65aa7b86155d899043a64ebdcf | Update app/views/main/views.py | apipanda/openssl,apipanda/openssl,apipanda/openssl,apipanda/openssl | app/views/main/views.py | app/views/main/views.py | from flask import current_app as app
from flask import flash
from flask import redirect
from flask import render_template
from flask import url_for
from flask_login import current_user
from flask_login import login_required
from . import main
from .forms import SearchForm
from ..api.utils import _search
@main.route... | mit | Python | |
938a9548b6503136b82fd248258df5f4e0523f8a | add sorting_algorithms.py | Nethermaker/school-projects | adv/sorting_algorithms.py | adv/sorting_algorithms.py | # Sorting Algorithms
import random
import time
my_list = range(10000)
random.shuffle(my_list)
#print sorted(my_list) #We have a way to sort information.
# But how did it do that?
###################################################################
# What does "efficiency" mean in terms of a program... | mit | Python | |
bb7031385af7931f9e12a8987375f929bcfb6b5a | Create script that checks for dev and docs dependencies. | justacec/bokeh,schoolie/bokeh,aiguofer/bokeh,ChinaQuants/bokeh,lukebarnard1/bokeh,roxyboy/bokeh,jakirkham/bokeh,khkaminska/bokeh,srinathv/bokeh,msarahan/bokeh,Karel-van-de-Plassche/bokeh,CrazyGuo/bokeh,rothnic/bokeh,clairetang6/bokeh,quasiben/bokeh,birdsarah/bokeh,azjps/bokeh,mindriot101/bokeh,khkaminska/bokeh,timothyd... | scripts/devdeps.py | scripts/devdeps.py | from __future__ import print_function
import sys
try:
import colorama
def blue(text): return "%s%s%s" % (colorama.Fore.BLUE, text, colorama.Style.RESET_ALL)
def red(text): return "%s%s%s" % (colorama.Fore.RED, text, colorama.Style.RESET_ALL)
except ImportError:
def blue(text) : return text
def red... | bsd-3-clause | Python | |
a23e08275652f7356863edada51e7dee345a2dfc | Add functools from Python trunk r65615 | python-mechanize/mechanize,python-mechanize/mechanize | test-tools/functools.py | test-tools/functools.py | """functools.py - Tools for working with functions and callable objects
"""
# Python module wrapper for _functools C module
# to allow utilities written in Python to be added
# to the functools module.
# Written by Nick Coghlan <ncoghlan at gmail.com>
# Copyright (C) 2006 Python Software Foundation.
# See C source co... | bsd-3-clause | Python | |
d3a652111aa7df0a5ecc429db6aa639f9a667ff9 | Create imogen.py | mduckles/CodeClub | imogen.py | imogen.py | mit | Python | ||
ca098b540b171460f41ea66c01d2b0d039feb073 | Add arrange combination algorithm | tobegit3hub/tobe-algorithm-manual | arrange_combination/arrange.py | arrange_combination/arrange.py | #!/usr/bin/env python
def range(input_list, step):
if step == 3:
print(input_list)
return
for i in range(step, len(input_list)):
input_list[step], input_list[i] = input_list[i], input_list[step]
range(input_list, step+1)
input_list[step], input_list[i] = input_list[i], input_list[step]
def ... | apache-2.0 | Python | |
f0da1774514c839b4b97fa92d2202437932dc99a | Add a small driver for plotting skeletons. | lmjohns3/cube-experiment,lmjohns3/cube-experiment,lmjohns3/cube-experiment | analysis/plot-skeleton.py | analysis/plot-skeleton.py | #!/usr/bin/env python
import climate
import database
import plots
@climate.annotate(
root='plot data rooted at this path',
pattern=('plot data from files matching this pattern', 'option'),
)
def main(root, pattern='*/*block02/*trial00*.csv.gz'):
with plots.space() as ax:
for trial in database.Ex... | mit | Python | |
060c8a4379aef14459929a47bf62a80a3e7eef67 | Create af_setJoints.py | aaronfang/personal_scripts | af_scripts/tmp/af_setJoints.py | af_scripts/tmp/af_setJoints.py | import pymel.core as pm
curSel = pm.ls(sl=True,type='transform')[0]
bBox = pm.xform(curSel,ws=1,q=1,bb=1)
sizeX = abs(bBox[0]-bBox[3])
sizeY = abs(bBox[1]-bBox[4])
sizeZ = abs(bBox[2]-bBox[5])
curPvt = [(bBox[0]+sizeX/2),(bBox[1]+sizeY/2),(bBox[2]+sizeZ/2)]
ccUD = pm.circle(n='circle_rotUpDown',r=sizeY/2,nr=(1,0,0))... | mit | Python | |
bde8b61f419dd6e66a85cc92f3661de6aaadeb94 | ADD CHECK FOR YELLING | amperser/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint,jstewmon/proselint | proselint/checks/misc/yelling.py | proselint/checks/misc/yelling.py | # -*- coding: utf-8 -*-
"""EES: Too much yelling..
---
layout: post
error_code: SCH
source: ???
source_url: ???
title: yelling
date: 2014-06-10 12:31:19
categories: writing
---
Too much yelling.
"""
from proselint.tools import blacklist
err = "MAU103"
msg = u"Too much yelling."
check = blacklist... | bsd-3-clause | Python | |
26e7e7b270bfd5e08cf871f7d89b5a92b07df230 | add migration file | adandan01/contmon,adandan01/contmon,adandan01/contmon,adandan01/contmon | contmon/scraper/migrations/0001_initial.py | contmon/scraper/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
replaces = [('scraper', '0001_initial'), ('scraper', '0002_auto_20150706_2105'), ('scraper', '0003_auto_20150706_... | bsd-3-clause | Python | |
7fb2b02c7c08912f54ef3cc0f22c53daa34ec639 | Add accelerometer and crash analysis | bskari/sparkfun-avc,bskari/sparkfun-avc,bskari/sparkfun-avc,bskari/sparkfun-avc,bskari/sparkfun-avc,bskari/sparkfun-avc | analysis/plot_accelerometer.py | analysis/plot_accelerometer.py | """Plots the accelerometer readings for x, y, and z."""
from dateutil import parser as dateparser
from matplotlib import pyplot
import json
import sys
def main():
if sys.version_info.major <= 2:
print('Please use Python 3')
sys.exit(1)
if len(sys.argv) != 2:
print('Usage: plot_accele... | mit | Python | |
1b0c33c01b179831edc29b0b13a3f60e96b54321 | Create joyent.py | ahelal/ansible-joyent-inventory | joyent.py | joyent.py | #!/usr/bin/env python
import os
import sys
import cPickle as pickle
from datetime import datetime
from smartdc import DataCenter
try:
import json
except ImportError:
import simplejson as json
debug = False
CACHE_EXPIRATION_IN_SECONDS = 300
SERVER_FILENAME = "joyent_server_cache.txt"
##
PATH_TO_FILE = os.gete... | apache-2.0 | Python | |
872dd45173e889db06e9b16105492c241f7badae | Add an example for dynamic RPC lookup. | claws/aiozmq,aio-libs/aiozmq,asteven/aiozmq,MetaMemoryT/aiozmq | examples/rpc_dynamic.py | examples/rpc_dynamic.py | import asyncio
import aiozmq
import aiozmq.rpc
class DynamicHandler(aiozmq.rpc.AttrHandler):
def __init__(self, namespace=()):
self.namespace = namespace
def __getitem__(self, key):
try:
return getattr(self, key)
except AttributeError:
return DynamicHandler(se... | bsd-2-clause | Python | |
e0b1bea00c56657ef9fb4456203a522920375cc2 | add testLCMSpy.py script | openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro,openhumanoids/oh-distro | software/ddapp/src/python/tests/testLCMSpy.py | software/ddapp/src/python/tests/testLCMSpy.py | from ddapp.consoleapp import ConsoleApp
from ddapp import lcmspy
from ddapp import lcmUtils
from ddapp import simpletimer as st
app = ConsoleApp()
app.setupGlobals(globals())
if app.getTestingInteractiveEnabled():
app.showPythonConsole()
lcmspy.findLCMModulesInSysPath()
timer = st.SimpleTimer()
stats = {}
ch... | bsd-3-clause | Python | |
cb2cc713c29c20ba239a60b6151c5e5c001c8e0b | Add joinkb.py | Metaleer/hexchat-scripts | joinkb.py | joinkb.py | from __future__ import print_function
__module_name__ = 'Join Kickban'
__module_version__ = '0.1'
__module_description__ = 'Kickbans clients from specified channels on regex match against their nickname on join'
__author__ = 'Daniel A. J.'
import hexchat
import re
re = re.compile(r'\bfoo\b') # regex pattern to be ma... | mit | Python | |
f6864179a2dc1c531afc2c3ba6be300006e01fab | Create consecZero.py | NendoTaka/CodeForReference,NendoTaka/CodeForReference,NendoTaka/CodeForReference | Codingame/Python/Clash/consecZero.py | Codingame/Python/Clash/consecZero.py | import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
n = input()
# Write an action using print
# To debug: print("Debug messages...", file=sys.stderr)
c = 0
t = 0
for x in n:
if x == '0':
t += 1
else:
if t > c:
... | mit | Python | |
6a4fb74befd22c2bc814dbe51a1fa884a077be9d | Create django_audit_snippets.py | stephenbradshaw/pentesting_stuff,stephenbradshaw/pentesting_stuff,stephenbradshaw/pentesting_stuff,stephenbradshaw/pentesting_stuff | example_code/django_audit_snippets.py | example_code/django_audit_snippets.py | from django.conf import settings
from urls import urlpatterns
'''
Access shell via
./manage.py shell
(or shell_plus if you have django-extensions)
Dont forget you may need to set environment variables:
- DJANGO_SETTINGS_MODULE to the settings file (python module load syntax like settings.filename) and
- PYTHONPATH... | bsd-3-clause | Python | |
73819cea7150e15212a014f9c3a42a69d0351ab8 | Create cutrope.py | vikramraman/algorithms,vikramraman/algorithms | cutrope.py | cutrope.py | # Author: Vikram Raman
# Date: 08-15-2015
import time
# Given a rope with length n, how to cut the rope into m parts with length n[0], n[1], ..., n[m-1],
# in order to get the maximal product of n[0]*n[1]* ... *n[m-1]?
# We have to cut once at least. Additionally, the length of the whole length of the rope,
# as we... | mit | Python | |
6b95af9822b9d94793eef503609b48d83066f594 | add test that causes KeyError for disabled text | WojciechMula/canvas2svg | test/test-text-diabled.py | test/test-text-diabled.py | from framework import *
root.title("Disabled text")
canv.create_text(200, 200,
text = "Test disabled text",
font = ("Times", 20),
state = DISABLED
)
thread.start_new_thread(test, (canv, __file__, True))
root.mainloop()
| bsd-3-clause | Python | |
06efe8a8be913fb63f27016268d86f1ad0a5bcdf | Add test_engine_seed.py | probcomp/cgpm,probcomp/cgpm | tests/test_engine_seed.py | tests/test_engine_seed.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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
# Unles... | apache-2.0 | Python | |
3de2b08133f6f721a3a30120a93b81be0eacefb6 | add tests for the scuba.filecleanup sub-module | JonathonReinhart/scuba,JonathonReinhart/scuba,JonathonReinhart/scuba | tests/test_filecleanup.py | tests/test_filecleanup.py | from __future__ import print_function
from nose.tools import *
from unittest import TestCase
try:
from unittest import mock
except ImportError:
import mock
from scuba.filecleanup import FileCleanup
def assert_set_equal(a, b):
assert_equal(set(a), set(b))
class TestFilecleanup(TestCase):
@mock.patc... | mit | Python | |
d41005d14239a93237fb839084f029208b94539d | Use the custom.js as served from the CDN for try | dietmarw/jupyter-docker-images,iamjakob/docker-demo-images,Zsailer/docker-jupyter-teaching,odewahn/docker-demo-images,jupyter/docker-demo-images,tanyaschlusser/docker-demo-images,iamjakob/docker-demo-images,Zsailer/docker-demo-images,CognitiveScale/docker-demo-images,Zsailer/docker-jupyter-teaching,ericdill/docker-demo... | common/profile_default/ipython_notebook_config.py | common/profile_default/ipython_notebook_config.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Configuration file for ipython-notebook.
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
# Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded-
# For headerssent by the upstream reverse proxy... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Configuration file for ipython-notebook.
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
# Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded-
# For headerssent by the upstream reverse proxy... | bsd-3-clause | Python |
2b380d501b80afad8c7c5ec27537bcc682ed2775 | Fix some scope mistakes. This fix was part of the reverted commit. | TiberiumPY/puremine,Armored-Dragon/pymineserver | commands/handle.py | commands/handle.py | import commands.cmds as cmds
def handle(self, chat_raw):
self.logger.info("Handling command: " + chat_raw + " (for player" + self.fquid + ")")
_atmp1 = chat_raw.split(" ")
_atmp2 = list(_atmp1[0])
del _atmp2[0]
del _atmp1[0]
cmdobj = {
"base": _atmp2,
"args_raw": _atmp1,
... | import commands.cmds as cmds
def handle(self, chat_raw):
self.logger.info("Handling command: " + chat_raw + " (for player" + self.fquid + ")")
_atmp1 = chat_raw.split(" ")
_atmp2 = list(_atmp1[0])
del _atmp2[0]
del _atmp1[0]
cmdobj = {
"base": _atmp2,
"args_raw": _atmp1,
... | mit | Python |
b37f31b5adbdda3e5d40d2d8a9dde19b2e305c2c | Add tests for the controller module | conwetlab/ckanext-wirecloud_view,conwetlab/ckanext-wirecloud_view,conwetlab/ckanext-wirecloud_view,conwetlab/ckanext-wirecloud_view | ckanext/wirecloudview/tests/test_controller.py | ckanext/wirecloudview/tests/test_controller.py | # -*- coding: utf-8 -*-
# Copyright (c) 2018 Future Internet Consulting and Development Solutions S.L.
# This file is part of CKAN WireCloud View Extension.
# CKAN WireCloud View Extension is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as publish... | agpl-3.0 | Python | |
d1d1892551d805b5a73aaef07932c65fd375e342 | Add Rules unit test | desihub/desisurvey,desihub/desisurvey | py/desisurvey/test/test_rules.py | py/desisurvey/test/test_rules.py | import unittest
import numpy as np
import desisurvey.tiles
from desisurvey.rules import Rules
class TestRules(unittest.TestCase):
def setUp(self):
pass
def test_rules(self):
rules = Rules()
tiles = desisurvey.tiles.get_tiles()
completed = np.ones(tiles.ntiles, bool)
... | bsd-3-clause | Python | |
6350092030d267621d2430d4505c01455d1de2d3 | Create Misha_rungaKutta.py | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | math/runge-kutta_method/Misha_rungaKutta.py | math/runge-kutta_method/Misha_rungaKutta.py | import matplotlib.pyplot as plt
# Python program to implement Runge Kutta method
def dydx(x, y):
return (18 * x + 1.33 * y) / (1.33 * x + 18 * y)
# Finds value of y for a given x using step size h
# and initial value y0 at x0.
def rungeKutta(x0, y0, x, h, Q1=0.5, Q2=0.5, w1=0.5, w2=0.5, c1=1, c2=2, c3=2, c4=1):
... | cc0-1.0 | Python | |
3efa20e0d93c922bec6ae0f41774fd406532257a | Allow manually graded code cells | alope107/nbgrader,MatKallada/nbgrader,jupyter/nbgrader,dementrock/nbgrader,EdwardJKim/nbgrader,jhamrick/nbgrader,modulexcite/nbgrader,ellisonbg/nbgrader,dementrock/nbgrader,EdwardJKim/nbgrader,jupyter/nbgrader,EdwardJKim/nbgrader,ellisonbg/nbgrader,jhamrick/nbgrader,jupyter/nbgrader,alope107/nbgrader,ellisonbg/nbgrader... | nbgrader/preprocessors/checkcellmetadata.py | nbgrader/preprocessors/checkcellmetadata.py | from nbgrader import utils
from nbgrader.preprocessors import NbGraderPreprocessor
class CheckCellMetadata(NbGraderPreprocessor):
"""A preprocessor for checking that grade ids are unique."""
def preprocess(self, nb, resources):
resources['grade_ids'] = ids = []
nb, resources = super(CheckCellM... | from nbgrader import utils
from nbgrader.preprocessors import NbGraderPreprocessor
class CheckCellMetadata(NbGraderPreprocessor):
"""A preprocessor for checking that grade ids are unique."""
def preprocess(self, nb, resources):
resources['grade_ids'] = ids = []
nb, resources = super(CheckCellM... | bsd-3-clause | Python |
c6b9ef93b8d20589d454e2c63bba60fe383975b5 | Add files via upload | stevelatif/erasure_coding | erasure.py | erasure.py | #!/usr/bin/env python
import numpy as np
import random
import hashlib
'''
Reed Solomon Encoding
data - column vector array
sz - integer length of data
Encodes data and returns a code that can be decoded
'''
class ErasureCoding():
def __init__(self):
pass
def _encode(self, x_vector, xform... | bsd-3-clause | Python | |
22e8cc6200cafd5cec386c35142cd742d4a2a735 | add problem 34 | smrmkt/project_euler | problem_034.py | problem_034.py | #!/usr/bin/env python
#-*-coding:utf-8-*-
'''
145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
Find the sum of all numbers which are equal to
the sum of the factorial of their digits.
Note: as 1! = 1 and 2! = 2 are not sums they are not included.
'''
import math
import timeit
def calc():
eqs = []... | mit | Python | |
f64068b7b6e50f9280b51831715df8cb4c586daa | Update merge person tool | barberscore/barberscore-api,dbinetti/barberscore,barberscore/barberscore-api,dbinetti/barberscore,dbinetti/barberscore-django,dbinetti/barberscore-django,barberscore/barberscore-api,barberscore/barberscore-api | project/apps/api/management/commands/merge_persons.py | project/apps/api/management/commands/merge_persons.py | from optparse import make_option
from django.core.management.base import (
BaseCommand,
CommandError,
)
from apps.api.models import (
Person,
Singer,
Director,
Arranger,
)
class Command(BaseCommand):
help = "Merge selected singers by name"
option_list = BaseCommand.option_list + (
... | bsd-2-clause | Python | |
12bca37026ef4db41bd452dcb8cdc9022cdcf8c9 | Create pythonhelloworld.py | msjones217/alrington-class | pythonhelloworld.py | pythonhelloworld.py | print "hello word"
| unlicense | Python | |
8e4240cd9bc2c06264ef23fddfc93ccf76e5ff9b | Create progressbar.py | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | progressbar.py | progressbar.py | ################################################################################
# Example usage:
# $ python
# >>> import Progress
# >>> total = 100
# >>> message = 'Doing this task '
# >>> with Progress.Bar(total, message) as bar:
# ... for n in range(total):
# ... time.sleep(0.1)
# ... bar.update(... | mit | Python | |
465c2c92da5db91bcc1f9149fbfa5722d30e10f9 | add some tests for the Basic Auth filter | livingbio/libsaas,ducksboard/libsaas,80vs90/libsaas,CptLemming/libsaas | test/test_basic_auth.py | test/test_basic_auth.py | import unittest
from libsaas import http
from libsaas.filters import auth
class BasicAuthTestCase(unittest.TestCase):
def test_simple(self):
auth_filter = auth.BasicAuth('user', 'pass')
req = http.Request('GET', 'http://example.net/')
auth_filter(req)
self.assertEqual(req.header... | mit | Python | |
4cac86aeb2d24a916fc5ae9ca98e3898f4729e1c | add protocol.py module | JasonLai256/plumbca | plumbca/protocol.py | plumbca/protocol.py | # -*- coding: utf-8 -*-
"""
plumbca.protocol
~~~~~~~~~~~~~~~~
Implements the protocol support for Plumbca.
:copyright: (c) 2015 by Jason Lai.
:license: BSD, see LICENSE for more details.
"""
import logging
import asyncio
from .message import Request
from .worker import Worker
actlog = logging.... | bsd-3-clause | Python | |
545af0493cf08cb15d262f3a5333df6d1fce6848 | Add util convenience functions for accessing data without decorators | SilentCircle/django-brake,SilentCircle/django-brake,skorokithakis/django-brake,skorokithakis/django-brake | brake/utils.py | brake/utils.py | from decorators import _backend
"""Access limits and increment counts without using a decorator."""
def get_limits(request, label, field, periods):
limits = []
count = 10
for period in periods:
limits.extend(_backend.limit(
label,
request,
field=field,
... | bsd-3-clause | Python | |
e0c3a46d1c3c13b5c956bf3cc6f30ad495f87ccd | put the logger config in a separate file for cleanliness | darrenwee/voglbot | voglogger.py | voglogger.py | #!/usr/bin/python
"""
logger management for VOGLbot
writes out to both the console and a file 'voglbot.log'
"""
import sys
import logging
import time
logging.basicConfig(
filename = 'voglbot.log',
filemode = 'w',
level=logging.DEBUG,
format='%(asctime)s: %(message)s',
datefmt = '%d-%m %H:%M:%S',
stream = ... | mit | Python | |
a984120bdb6c67a3dc2ca89ce9ae5498230015ea | Add initial runner | origingod/hug,philiptzou/hug,yasoob/hug,philiptzou/hug,shaunstanislaus/hug,janusnic/hug,jean/hug,alisaifee/hug,alisaifee/hug,STANAPO/hug,timothycrosley/hug,MuhammadAlkarouri/hug,origingod/hug,giserh/hug,janusnic/hug,shaunstanislaus/hug,jean/hug,gbn972/hug,gbn972/hug,giserh/hug,yasoob/hug,timothycrosley/hug,MuhammadAlka... | hug/run.py | hug/run.py | """hug/run.py
Contains logic to enable execution of hug APIS from the command line
"""
from wsgiref.simple_server import make_server
import falcon
import sys
import importlib
def server(module):
api = falcon.API()
for url, method_handlers in module.HUG_API_CALLS:
api.add_route(url, namedtuple('Route... | mit | Python | |
1578e1a129d91605148cf48f8793ac098ad0de7e | add command group | ojengwa/ibu,ojengwa/migrate | ibu/cli.py | ibu/cli.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import click
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.group()
def ibu():
pass
@click.command(context_settings=CONTEXT_SETTINGS)
def test():
print("hello")
| mit | Python | |
33dc091a43d3868324631fdb420721ab35d1f6ce | Create dis_q.py | ionutvilie/ibm_mq_tools,ionutvilie/ibm_mq_tools,ionutvilie/ibm_mq_tools,ionutvilie/ibm_mq_tools | dis_q.py | dis_q.py | #!/usr/bin/python
import pymqi
queue_manager = "MQSD.TEST"
channel = "SYSTEM.DEF.SVRCONN"
host = "10.21.218.15"
port = "14123"
conn_info = "%s(%s)" % (host, port)
prefix = "*"
queue_type = pymqi.CMQC.MQQT_ALL
# queue_type = pymqi.CMQC.MQQT_LOCAL
excluded_prefix = ['SYSTEM', 'MSB', 'AMQ' , 'MQAI']
# excluded_prefix =... | mit | Python | |
b7541c063b6fc10fdd622cbd680ea4418c679f6b | Add NodeList iterator | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | d1_libclient_python/src/d1_client/iter/node.py | d1_libclient_python/src/d1_client/iter/node.py | # -*- coding: utf-8 -*-
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2016 DataONE
#
# Licensed under the Apache License, Version 2.0 ... | apache-2.0 | Python | |
2c900f8bddc9efb40d900bf28f8c6b3188add71e | Disable trix parser tests with Jython | RDFLib/rdflib,avorio/rdflib,yingerj/rdflib,ssssam/rdflib,ssssam/rdflib,marma/rdflib,armandobs14/rdflib,armandobs14/rdflib,dbs/rdflib,dbs/rdflib,RDFLib/rdflib,marma/rdflib,RDFLib/rdflib,yingerj/rdflib,avorio/rdflib,ssssam/rdflib,armandobs14/rdflib,RDFLib/rdflib,dbs/rdflib,marma/rdflib,marma/rdflib,ssssam/rdflib,armandob... | test/test_trix_parse.py | test/test_trix_parse.py | #!/usr/bin/env python
from rdflib.graph import ConjunctiveGraph
import unittest
class TestTrixParse(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testAperture(self):
g=ConjunctiveGraph()
g.parse("test/trix/aperture.trix",format="trix")
... | #!/usr/bin/env python
from rdflib.graph import ConjunctiveGraph
import unittest
class TestTrixParse(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testAperture(self):
g=ConjunctiveGraph()
g.parse("test/trix/aperture.trix",format="trix")
... | bsd-3-clause | Python |
0cb6474b8c02f2cb7af54f8321f82a53175e8345 | check for globals in the lib that are not prefixed with toku. addresses #74 | ollie314/server,natsys/mariadb_10.2,natsys/mariadb_10.2,ollie314/server,davidl-zend/zenddbi,natsys/mariadb_10.2,davidl-zend/zenddbi,davidl-zend/zenddbi,flynn1973/mariadb-aix,flynn1973/mariadb-aix,natsys/mariadb_10.2,natsys/mariadb_10.2,flynn1973/mariadb-aix,flynn1973/mariadb-aix,flynn1973/mariadb-aix,davidl-zend/zenddb... | src/tokuglobals.py | src/tokuglobals.py | #!/usr/bin/python
import sys
import os
import re
def checkglobals(libname, exceptsymbols, verbose):
badglobals = 0
nmcmd = "nm -g " + libname
f = os.popen(nmcmd)
b = f.readline()
while b != "":
match = re.match("^([0-9a-f]+)\s(.?)\s(.*)$", b)
if match == None:
match = r... | lgpl-2.1 | Python | |
24b8437003269ebd10c46d0fbdaa3e432d7535d6 | Add VCF -> non-reference likelihood table script. | roryk/junkdrawer,roryk/junkdrawer | genotype-likelihoods.py | genotype-likelihoods.py | from __future__ import print_function
import sys
import cyvcf
from argparse import ArgumentParser, FileType
import toolz as tz
description = ("Create a table of probability of a non reference call for each "
"genotype for each sample. This is PL[0]. -1 is output for samples "
"with a miss... | mit | Python | |
6a9ddbf5d775df14c994c9af9e89195ca05a58f9 | Add pyjokes CLI test | trojjer/pyjokes,ElectronicsGeek/pyjokes,pyjokes/pyjokes,martinohanlon/pyjokes,gmarkall/pyjokes,borjaayerdi/pyjokes,bennuttall/pyjokes | tests/test_cli_error.py | tests/test_cli_error.py |
import pytest
import subprocess
from subprocess import Popen, PIPE
def test_pyjokes_call_exception():
pytest.raises(subprocess.CalledProcessError, "subprocess.check_call('pyjokes')")
def test_pyjokes_call_output():
try:
p = subprocess.Popen('pyjokes', stdin=PIPE, stdout=PIPE, stderr=PIPE)
exc... | bsd-3-clause | Python | |
83a4c9bfa64543ecda65ed4c916fad8ad0a9233d | Create markov.py | tenkisi/markovtweet | markov.py | markov.py | # -*- coding: utf-8 -*-
import random
ngram = lambda text, n: [text[i:i+n] for i in xrange(len(text) - n + 1)]
flatten2D = lambda data: [flattened for inner in data for flattened in inner]
randelement = lambda x: x[random.randint(0, len(x) - 1)]
class Markov:
def __init__(self, data, n):
self.data = dat... | mit | Python | |
0970115f9bc1bab019c23ab46e64b26d5e754313 | Implement function for displaying tuning guidance on a DIY 8-segment LEDs display | Bastien-Brd/pi-tuner | led_display.py | led_display.py | import math
from gpiozero import LED
from time import sleep
g0 = LED(12)
f0 = LED(16)
a0 = LED(20)
b0 = LED(21)
e0 = LED(17)
d0 = LED(27)
c0 = LED(22)
g1 = LED(25)
f1 = LED(24)
a1 = LED(23)
b1 = LED(18)
e1 = LED(5)
d1 = LED(6)
c1 = LED(13)
PITCHES = {
'E2': ((a0, d0, e0, f0, g0), (b0, c0)),
'A2': ((a0, b0, ... | mit | Python | |
550d8bcd49e5ec591286f3f42de7dd54ef853bb8 | Add a utility script to print duplicates | mubaris/motivate,mubaris/motivate | find_dupes.py | find_dupes.py | #!/usr/bin/env python3
import json
import os
import random
scriptpath = os.path.dirname(__file__)
data_dir = os.path.join(scriptpath, 'data')
all_json = [f for f in os.listdir(data_dir) if os.path.isfile(os.path.join(data_dir, f))]
quotes = []
for f in all_json:
filename = os.path.join(data_dir, f)
with open(filena... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.