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 |
|---|---|---|---|---|---|---|---|---|
a5b43e23008eaca8da9d7d740c3ce976b698b615 | Add Daniel Berlin's draft of a 'blame' script. | jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion | tools/examples/blame.py | tools/examples/blame.py | #!/usr/bin/env python2
#
# USAGE: annotate.py [-r REV] [-h DBHOME] repos-path
#
import sys
import os
import getopt
import difflib
from svn import fs, util
CHUNK_SIZE = 100000
def getfile(pool, path, rev=None, home='.'):
db_path = os.path.join(home, 'db')
if not os.path.exists(db_path):
db_path = home
anno... | apache-2.0 | Python | |
8a2d86cb5d78d0865d5b0ed2e99fe79e4c739759 | Add calc_size tool | iychoi/biospectra,iychoi/biospectra,iychoi/biospectra | tools/calc_size.py | tools/calc_size.py | #! /usr/bin/env python
import os
import os.path
import sys
def _sumSize(path):
size = os.path.getsize(path)
print path, "=", size, "bytes"
return size
def sumSize(path):
sizeTotal = 0;
if os.path.isdir(path):
for p in os.listdir(path):
sizeTotal += sumSize(os.path.join(path, p... | apache-2.0 | Python | |
b0b6afff93391bda296ed5ef87d122054f91eef5 | add testdb | vincentdavis/Colorado-Property-Data,vincentdavis/Colorado-Property-Data,vincentdavis/Colorado-Property-Data,vincentdavis/Colorado-Property-Data | dbtest.py | dbtest.py |
DB = MySQLDatabase('codatadb',
user='heteroskedastic1',
host='heteroskedastic1.mysql.pythonanywhere-services.com') | mit | Python | |
80b286daad1136dde91010a41970c89c22247b50 | add loan_estimate.py | fassake/bdd-security,cfarm/owning-a-home,imuchnik/owning-a-home,cfarm/owning-a-home,fna/owning-a-home,fassake/bdd-security,imuchnik/owning-a-home,CapeSepias/owning-a-home,amymok/owning-a-home,CapeSepias/owning-a-home,fassake/bdd-security,Scotchester/owning-a-home,cfarm/owning-a-home,cfarm/owning-a-home,CapeSepias/ownin... | test/browser_testing/features/pages/loan_estimate.py | test/browser_testing/features/pages/loan_estimate.py | from selenium.webdriver.common.action_chains import ActionChains
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium import webdriver
from pages.base import Base
import re
i... | cc0-1.0 | Python | |
27eb90e40f1f3fe4a17e0228e4de9d427382ac44 | Create calendar_api.py | julianaklulo/clockwise | calendar_api.py | calendar_api.py | import httplib2
import os
import apiclient
import oauth2client
from oauth2client import client, tools
from datetime import datetime, timedelta
alarm_time = datetime.utcnow() + timedelta(minutes = 1)
try:
import argparse
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
except ImportErr... | mit | Python | |
fc97a838d54417cb063a7757040ff279f298d0bb | Add snip code for http.cookies | JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology | cookie_skel.py | cookie_skel.py | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 14 20:49:34 2016
@author: troon
"""
import BaseHTTPServer, SimpleHTTPServer
from http.cookies import SimpleCookie as cookie
class ApplicationRequestHandler(SimpleHTTPServer.BaseHTTPRequestHandler):
sessioncookies = {}
def __init__(self,*args,**kwargs):
self.sessi... | cc0-1.0 | Python | |
9dadbe8197ba479d23111eace2f3eda8e471df89 | Add very WIP multiplayer server | darkf/darkfo,darkf/darkfo,darkf/darkfo,darkf/darkfo,darkf/darkfo | mpserv.py | mpserv.py | from eventlet import wsgi, websocket
import eventlet
import json, time, string, os
def is_valid_name_char(c):
return c in string.ascii_letters + string.digits + "-_"
"""
sessions = {}
def broadcast_to_user_sessions(username, t, msg):
global sessions
for session in user_sessions(username):
... | apache-2.0 | Python | |
63586b03111d2c2aac3b4ffe5266468d3bd666fd | solve 1 problem | Shuailong/Leetcode | solutions/add-two-numbers.py | solutions/add-two-numbers.py | #!/usr/bin/env python
# encoding: utf-8
"""
add-two-numbers.py
Created by Shuailong on 2016-04-23.
https://leetcode.com/problems/add-two-numbers/.
"""
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
... | mit | Python | |
61750d22d44e4d2caa99703c1fd8d61e1e829e07 | Create test.py | shivarajnesargi/BotOrNot | ProjectMidway/Data/test.py | ProjectMidway/Data/test.py | mit | Python | ||
0cde44fb3fade24bc0e1aed5ee4820aa2172806a | Add 2nd example. | cournape/talkbox,cournape/talkbox | doc/src/examples/periodogram_2.py | doc/src/examples/periodogram_2.py | import numpy as np
import matplotlib.pyplot as plt
from scikits.talkbox.spectral.basic import periodogram
from scipy.signal import hamming, hanning
fs = 1000
x = np.sin(2 * np.pi * 0.15 * fs * np.linspace(0., 0.3, 0.3 * fs))
x += 0.1 * np.random.randn(x.size)
px1, fx1 = periodogram(x, nfft=16384, fs=fs)
px2, fx2 = peri... | mit | Python | |
08636c9740b3103fd05c81791f43faeb29920305 | Add tests for some util functions. | aleGpereira/libcloud,sahildua2305/libcloud,pquentin/libcloud,Verizon/libcloud,wuyuewen/libcloud,aleGpereira/libcloud,iPlantCollaborativeOpenSource/libcloud,Verizon/libcloud,Jc2k/libcloud,Cloud-Elasticity-Services/as-libcloud,aviweit/libcloud,vongazman/libcloud,techhat/libcloud,ZuluPro/libcloud,pquentin/libcloud,illfeld... | test/test_utils.py | test/test_utils.py | # -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one or more§
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Li... | apache-2.0 | Python | |
0574900ba42deda7ee61a809ffc64abc643b58b1 | add hibernation test | OpenAcademy-OpenStack/vm-hibernation | testHibernation.py | testHibernation.py | from novaclient.v1_1 import Client as NovaClient
import unittest
def hibernate(username, password, tenant_name, auth_url, serverID):
nova = NovaClient(username = username,
api_key = password,
project_id = tenant_name,
auth_url = auth_url)
server = nova.servers.get(serverID)
... | apache-2.0 | Python | |
7771baf7b4806c15cb85df6c34e344345538df4a | Add background thread example | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | background-thread.py | background-thread.py | import time
import requests
from tomorrow import threads
@threads(5)
def download(url):
return requests.get(url)
if __name__ == "__main__":
start = time.time()
responses = [download(url) for url in urls]
html = [response.text for response in responses]
end = time.time()
print "Time: %f second... | mit | Python | |
3bb75969a9fc068a05bf81f096d0e58e3440a09f | Create nltk10.py | PythonProgramming/Natural-Language-Processing-NLTK-Python-2.7 | nltk10.py | nltk10.py | import time
import urllib2
from urllib2 import urlopen
import re
import cookielib
from cookielib import CookieJar
import datetime
import sqlite3
import nltk
cj = CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
conn = sqlite3.connect('kno... | mit | Python | |
ea4acac26fbedef3a9a5395860334c9bb95bcacb | add a new class GenericKeyComposerAddressAccess | alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl | AlphaTwirl/Counter/GenericKeyComposerAddressAccess.py | AlphaTwirl/Counter/GenericKeyComposerAddressAccess.py | # Tai Sakuma <tai.sakuma@cern.ch>
##____________________________________________________________________________||
class GenericKeyComposerAddressAccess(object):
def __init__(self, varNames, binnings, indices = None):
self._varNames = varNames
self._binnings = binnings
self._indices = indic... | bsd-3-clause | Python | |
57d731d6fb958c165cdeb5a9194669b07f8d54c1 | Create central_tendency.py | jamaps/open_geo_scripts,jamaps/fun_with_gdal,jamaps/fun_with_gdal,jamaps/gdal_and_ogr_scripts,jamaps/open_geo_scripts,jamaps/shell_scripts,jamaps/gdal_and_ogr_scripts,jamaps/shell_scripts,jamaps/open_geo_scripts | central_tendency.py | central_tendency.py |
# computes measures of geo central tendancy from a csv table
# table must be set up as 3 columns: x, y, weight
import csv
csv_path = 'x_y_w.csv'
# calculating the mean centre
with open(csv_path, 'rb') as f:
reader = csv.reader(f)
x_sum = 0
y_sum = 0
n = 0
for row in reader:
n = n + 1
... | mit | Python | |
624eff1e010c7b36f43e2580346b5ae74cc20128 | Create does_my_number_look_big_in_this.py | Kunalpod/codewars,Kunalpod/codewars | does_my_number_look_big_in_this.py | does_my_number_look_big_in_this.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Does my number look big in this?
#Problem level: 6 kyu
def narcissistic( value ):
return value==int(sum([int(x)**len(str(value)) for x in str(value)]))
| mit | Python | |
ebde18f5958463d622805b1a09244d07c81ec8ae | Bump development version | benzkji/django-cms,divio/django-cms,datakortet/django-cms,netzkolchose/django-cms,keimlink/django-cms,czpython/django-cms,netzkolchose/django-cms,czpython/django-cms,yakky/django-cms,FinalAngel/django-cms,keimlink/django-cms,jsma/django-cms,benzkji/django-cms,jproffitt/django-cms,mkoistinen/django-cms,mkoistinen/django... | cms/__init__.py | cms/__init__.py | # -*- coding: utf-8 -*-
__version__ = '3.0.17.dev1'
default_app_config = 'cms.apps.CMSConfig'
| # -*- coding: utf-8 -*-
__version__ = '3.0.16'
default_app_config = 'cms.apps.CMSConfig'
| bsd-3-clause | Python |
9831d82463b556c70d64dc17ceeadb2d54c6141d | add unittest for Kutil. | PeerAssets/pypeerassets,backpacker69/pypeerassets | tests/kutiltest.py | tests/kutiltest.py | import unittest
from pypeerassets.kutil import Kutil
class KutilTestCase(unittest.TestCase):
def test_network_parameter_load(self):
'''tests if loading of network parameteres is accurate'''
mykey = Kutil(network="ppc")
self.assertEqual(mykey.denomination, 1000000)
self.assertEqua... | bsd-3-clause | Python | |
6958b09e08662e2a13b1f161cdd22f4f929d56c6 | add sample program | takahasi/utility,takahasi/utility,takahasi/utility,takahasi/utility | codeiq/yatta.py | codeiq/yatta.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" script for generate process template directories
This is xxx
"""
from __future__ import print_function
def yatta(n):
if n % 2 == 0:
print("invalid")
return
m = int(n / 2) + 1
for i in reversed(range(n)):
if i < m:
for... | mit | Python | |
04740a33ab8b4d43cda71668ff7027ac7e5982d5 | Add test. This continues to need pytz and tzlocal. | python-caldav/caldav | tests/test_cdav.py | tests/test_cdav.py | import datetime
import pytz
import tzlocal
from caldav.elements.cdav import _to_utc_date_string
SOMEWHERE_REMOTE = pytz.timezone('Brazil/DeNoronha') # UTC-2 and no DST
def test_to_utc_date_string_date():
input = datetime.date(2019, 5, 14)
res = _to_utc_date_string(input)
assert res == '20190514T000000... | apache-2.0 | Python | |
7a70d230d3ceb3c37d718f138e80b132b9a05fae | Add migration for multiple repos per team. | mythmon/edwin,mythmon/edwin,mythmon/edwin,mythmon/edwin | edwin/teams/migrations/0005_auto_20150811_2236.py | edwin/teams/migrations/0005_auto_20150811_2236.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('teams', '0004_auto_20150516_0009'),
]
operations = [
migrations.AlterField(
model_name='team',
name=... | mpl-2.0 | Python | |
432ba7d3f923f6a22aef7bb45c7f658422968aa0 | add python script to plot p/r curve | patverga/torch-relation-extraction,patverga/torch-relation-extraction,patverga/torch-relation-extraction | bin/plot-pr-curve.py | bin/plot-pr-curve.py | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import matplotlib.colors
import sys
# change font family to match math
#plt.rc('font', family='serif')
fontsize = 18
font = {'family' : 'sans-serif',
# 'serif' : 'Times Regular',
'size' : fontsize}
matplotlib.rc('fo... | mit | Python | |
2d7782508e6bfe1be88da3409ae67371dab7379d | Add files via upload | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine | openquake/hazardlib/tests/gsim/skarlatoudis_2013_test.py | openquake/hazardlib/tests/gsim/skarlatoudis_2013_test.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2015-2019 GEM Foundation
#
# OpenQuake 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 Licen... | agpl-3.0 | Python | |
f5237b61a50b66d6ac3123318af94db8ec95173b | Test tasks.get_email_addresses handles subentites. | wesleykendall/django-entity-emailer,wesleykendall/django-entity-emailer,ambitioninc/django-entity-emailer,ambitioninc/django-entity-emailer | entity_emailer/tests/test_tasks.py | entity_emailer/tests/test_tasks.py | from entity.models import Entity, EntityRelationship
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from django_dynamic_fixture import G, N
from entity_emailer import tasks
from entity_emailer.models import Email
class Test_get_email_addresses(TestCase):
def setUp(sel... | mit | Python | |
4ec9406a19b5f42b0b05f37c12b99dd91853514f | Add all the data necessary for generations | samedhi/gaend,talkiq/gaend,talkiq/gaend,samedhi/gaend | tests/generator_test.py | tests/generator_test.py | from datetime import date, time, datetime
from google.appengine.ext import testbed, ndb
from gaend.main import app
import unittest
import webtest
# References
# cloud.google.com/appengine/docs/python/ndb/db_to_ndb
# cloud.google.com/appengine/docs/python/ndb/entity-property-reference
# cloud.google.com/appengine/docs/... | from datetime import date, time, datetime
from google.appengine.ext import testbed, ndb
from gaend.main import app
import unittest
import webtest
# References
# cloud.google.com/appengine/docs/python/ndb/db_to_ndb
# cloud.google.com/appengine/docs/python/ndb/entity-property-reference
# cloud.google.com/appengine/docs/... | mit | Python |
4c4891f24c0e5b093d3a9fcb0de86609b01a69c3 | Add migration for replace location with country and city | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | fellowms/migrations/0053_auto_20160804_1447.py | fellowms/migrations/0053_auto_20160804_1447.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-08-04 14:47
from __future__ import unicode_literals
from django.db import migrations
import django_countries.fields
class Migration(migrations.Migration):
dependencies = [
('fellowms', '0052_merge'),
]
operations = [
migrations... | bsd-3-clause | Python | |
d6c5e3c40e2106b7ef4ddc800a1c00493d4f469f | Add customized Pool class. | airekans/Monsit,airekans/Monsit | tests/test_pool.py | tests/test_pool.py | import gevent.pool
import gevent.queue
import gevent.event
import time
import traceback
def timeit(func):
def wrap(*args, **kwargs):
begin_time = time.time()
try:
return func(*args, **kwargs)
except:
traceback.print_exc()
finally:
end_time = time... | mit | Python | |
077e581326e0791e1bf5816baba6c6a6cba17d9d | Test for setting CHOICES_SEPARATOR | Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey,Pierre-Sassoulas/django-survey | survey/tests/test_default_settings.py | survey/tests/test_default_settings.py | from survey.tests import BaseTest
from django.test import override_settings
from django.conf import settings
from django.test import tag
from survey import set_default_settings
@tag("set")
@override_settings()
class TestDefaultSettings(BaseTest):
def test_set_choices_separator(self):
url = "/admin/survey/... | agpl-3.0 | Python | |
813f42aee6b38031c4993d322e12053c91d10c8a | add failing test to recreate logrotate bug [#461] | Shopify/dd-agent,jshum/dd-agent,tebriel/dd-agent,remh/dd-agent,jvassev/dd-agent,jraede/dd-agent,yuecong/dd-agent,PagerDuty/dd-agent,pfmooney/dd-agent,PagerDuty/dd-agent,pfmooney/dd-agent,AntoCard/powerdns-recursor_check,gphat/dd-agent,ess/dd-agent,zendesk/dd-agent,guruxu/dd-agent,gphat/dd-agent,c960657/dd-agent,manolam... | tests/test_tail.py | tests/test_tail.py | import logging
import subprocess
import tempfile
import unittest
class TestTail(unittest.TestCase):
def setUp(self):
self.log_file = tempfile.NamedTemporaryFile()
self.logrotate_config = tempfile.NamedTemporaryFile()
self.logrotate_config.write("""%s {
copytruncate
... | bsd-3-clause | Python | |
60774ca1a336fac5c0d9fb92ab6de509cd92dd43 | Add tests for topsort. | fhirschmann/penchy,fhirschmann/penchy | tests/test_util.py | tests/test_util.py | import unittest2
import util
class TopSortTest(unittest2.TestCase):
def test_error(self):
a,b = range(2)
deps = [(a,b), (b,a)]
with self.assertRaises(ValueError):
util.topological_sort([], deps)
def test_multi_deps(self):
a,b,c,d = range(4)
start = [a,b]
... | mit | Python | |
13917ab0aba2951bd10b64b53cdd358b169a432f | Create Bender_un_robot_dépressif.py | Alumet/Codingame | Medium/Bender_un_robot_dépressif.py | Medium/Bender_un_robot_dépressif.py | import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
l, c = [int(i) for i in input().split()]
Map=[]
T=[]
for i in range(l):
Map.append(input())
if "@" in Map[i]:
X=Map[i].index('@')
Y=i
if 'T' in Map[i]:
... | mit | Python | |
3b6e905bee79286c3998bef56d3c1ad811287078 | add cleanup script for cleaning veth netns and bridges | John-Lin/tinynet,John-Lin/tinynet | clean.py | clean.py | """
Mininet 2.3.0d1 License
Modifications copyright (c) 2017 Che Wei, Lin
Copyright (c) 2013-2016 Open Networking Laboratory
Copyright (c) 2009-2012 Bob Lantz and The Board of Trustees of
The Leland Stanford Junior University
Original authors: Bob Lantz and Brandon Heller
We are making Mininet available for public u... | apache-2.0 | Python | |
7ecf3eb5ac261ae3846d23e1ca8c90e2ba65353a | Create main.py | JOSUEXLION/prog3-uip,JOSUEXLION/prog3-uip | parciales/parcial2/main.py | parciales/parcial2/main.py | import json
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
from kivy.uix.dropdown import DropDown
from kivy.uix.button import Button
from kivy.uix.popup import Popup
from kivy.uix.label import Label
from kivy.properties import NumericProperty, StringProperty, Reference... | mit | Python | |
b4eebd858e07d33a3e7de8f9fda3ae009a0036c2 | Add a node | HiroyukiAbe/pimouse_ros,HiroyukiAbe/pimouse_ros | scripts/buzzer1.py | scripts/buzzer1.py | #!/usr/bin/env python
import rospy
rospy.init_node('buzzer')
rospy.spin()
| bsd-3-clause | Python | |
fe226ce33f116480bfea8f258fdffa1fd96e379c | read temp from gotemp | randomstring/raspberrypi | gotemp.py | gotemp.py | #!/usr/bin/python
import time
import struct
ldusb = file("/dev/hidraw1")
time.sleep(0.5)
pkt = ldusb.read(8)
parsed_pkt = list(struct.unpack("<BBHHH", pkt))
num_samples = parsed_pkt.pop(0)
seqno = parsed_pkt.pop(0)
for sample in range(num_samples):
cel = parsed_pkt[sample]/128.0
fahr = (9.0/5.0 * cel) + 32.0... | mit | Python | |
9abecda7f3c981b1cde193be038171c63bf69020 | Add root init | ibanner56/OtherDave | otherdave/__init__.py | otherdave/__init__.py | # OtherDave/otherdave/__init__.py | mit | Python | |
79d550cd96862bc4a4c0db60a2db60d3efa5cd6d | add vcrpy test helper module | rackerlabs/fastfood,samstav/fastfood,samstav/fastfood,martinb3/fastfood,samstav/fastfood,martinb3/fastfood,rackerlabs/fastfood,samstav/fastfood,brint/fastfood,brint/fastfood,brint/fastfood,martinb3/fastfood,rackerlabs/fastfood,martinb3/fastfood,brint/fastfood | tests/vcrhelper.py | tests/vcrhelper.py | """vcrpy integration helpers."""
import os
import unittest
import vcr
CASSETTE_LIB = os.path.join(
os.path.dirname(os.path.realpath(__file__)), 'cassettes')
assert os.path.isdir(CASSETTE_LIB), "Cassette library not found."
RECORD_MODE = 'none'
class VCRHelper(unittest.TestCase):
filter_headers = [
... | apache-2.0 | Python | |
30d9dff89a56229ff1f7cf73181cf8fe10f31b6d | Test scanner | nikhilm/muzicast,nikhilm/muzicast | tests/test_full_scan.py | tests/test_full_scan.py | import sys
print sys.path
from muzicast.collection import CollectionScanner
scanner = CollectionScanner(['/shared/music-test'])
assert type(scanner.directories) is list
scanner.full_scan()
| mit | Python | |
d1b7ed5f705c8e0935778636ade00a7452e2ea7f | Add management command for importing Holvi Invoices and Orders | rambo/asylum,rambo/asylum,hacklab-fi/asylum,jautero/asylum,HelsinkiHacklab/asylum,jautero/asylum,rambo/asylum,rambo/asylum,jautero/asylum,HelsinkiHacklab/asylum,hacklab-fi/asylum,hacklab-fi/asylum,HelsinkiHacklab/asylum,HelsinkiHacklab/asylum,jautero/asylum,hacklab-fi/asylum | project/holviapp/management/commands/import_holvidata.py | project/holviapp/management/commands/import_holvidata.py | # -*- coding: utf-8 -*-
import datetime
import itertools
import dateutil.parser
from django.core.management.base import BaseCommand, CommandError
from holviapp.importer import HolviImporter
from holviapp.utils import list_invoices, list_orders
def yesterday_proxy():
now_yesterday = datetime.datetime.now() - date... | mit | Python | |
cc25e521a99049bb1333c4a36df776c3303dda7b | add test for new functionality | secnot/rectpack | tests/test_generator.py | tests/test_generator.py | from unittest import TestCase
import rectpack.packer
import random
class TestGenerator(TestCase):
def setUp(self):
self.rectangles = [(w, h) for w in range(8,50, 8) for h in range(8,50, 8)]
def test_factory(self):
p = rectpack.packer.newPacker()
for r in self.rectangles:
... | apache-2.0 | Python | |
8ca6dd9d1089b5976d54e06f452a45306dbfb55e | Add generator test | eiri/echolalia-prototype | tests/test_generator.py | tests/test_generator.py | import unittest
from echolalia.generator import Generator
class GeneratorTestCase(unittest.TestCase):
def setUp(self):
self.items = ['pystr', 'pyint']
def test_generate(self):
generator = Generator(items=self.items)
docs = generator.generate(3)
self.assertEqual(len(docs), 3)
for doc in docs:
... | mit | Python | |
ad0ed0b60db6b527b0c210d2e1a23d529d36889d | Create test_gutenberg.py | fnielsen/dasem,fnielsen/dasem | tests/test_gutenberg.py | tests/test_gutenberg.py |
import pytest
from dasem.gutenberg import Word2Vec
@pytest.fixture
def w2v():
return Word2Vec()
def test_w2v(w2v):
word_and_similarities = w2v.most_similar('dreng')
assert len(word_and_similarities) == 10
| apache-2.0 | Python | |
6cad13197f7d2e399ef3e91a63a34637814c2ad1 | fix import command | fangohr/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python,ryanpepper/oommf-python | utils/test_mesh.py | utils/test_mesh.py | import unittest
import numpy as np
import mesh
class TestIterCoordsInt(unittest.TestCase):
def test_zyx_ordering(self):
m = mesh.Mesh((3, 1, 1), cellsize=(1, 1, 1))
indices = [r for r in m.iter_coords_int()]
expected = [[0, 0, 0], [1, 0, 0], [2, 0, 0]]
assert np.array_equal(m.mesh... | import unittest
import numpy as np
from finmag.util.oommf import mesh
class TestIterCoordsInt(unittest.TestCase):
def test_zyx_ordering(self):
m = mesh.Mesh((3, 1, 1), cellsize=(1, 1, 1))
indices = [r for r in m.iter_coords_int()]
expected = [[0, 0, 0], [1, 0, 0], [2, 0, 0]]
asser... | bsd-2-clause | Python |
2427afc967169f1e9d942bb7d955454b7ad0a44e | add open/close/cancel position example | ccxt/ccxt,ccxt/ccxt,ccxt/ccxt,ccxt/ccxt,ccxt/ccxt | examples/py/phemex-open-cancel-close-positions.py | examples/py/phemex-open-cancel-close-positions.py | # -*- coding: utf-8 -*-
import os
import sys
from pprint import pprint
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt # noqa: E402
print('CCXT Version:', ccxt.__version__)
exchange = ccxt.phemex({
'enableRateLimit': True, # h... | mit | Python | |
999dda7b26585cdfb165752fcca95894e275968d | Add folder to save the scripts from the book learning sklearn, and add the first chapter script | qingkaikong/useful_script,qingkaikong/useful_script,qingkaikong/useful_script,qingkaikong/useful_script,qingkaikong/useful_script | python/sklearn/learning_sklearn/simple_classification.py | python/sklearn/learning_sklearn/simple_classification.py | from sklearn import datasets
from sklearn.cross_validation import train_test_split
from sklearn import metrics
from sklearn import preprocessing
import numpy as np
#get the dataset
iris = datasets.load_iris()
X_iris, y_iris = iris.data, iris.target
# Get dataset with only the first two attributes
X, y = X_iris[:, :2],... | bsd-3-clause | Python | |
ad97be23fe9e267ed9d64b08fdf64631e234d43a | Add wierd migration | UrLab/incubator,UrLab/incubator,UrLab/incubator,UrLab/incubator | projects/migrations/0002_auto_20151208_1553.py | projects/migrations/0002_auto_20151208_1553.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0001_squashed_0010_task'),
]
operations = [
migrations.AlterField(
model_name='project',
... | agpl-3.0 | Python | |
b5da9dcf973a9a780c729f2855fb3784bfe9328a | Create heatdb.py | HeatIsland/HeatDB,HeatIsland/HeatDB | heatdb.py | heatdb.py | import webapp2
import logging
import re
import cgi
import jinja2
import os
import random
import string
import hashlib
import hmac
import Cookie
import urllib2
import time
from datetime import datetime, timedelta
from google.appengine.api import memcache
from google.appengine.ext import db
from xml.dom import minidom
... | mit | Python | |
3ca7eaca8026088dba1719a5dd2e3da1a6ffe404 | add householder qr algorithm - not working yet. | ddrake/mth653 | qr/hqr.py | qr/hqr.py | from numpy import *
def inner(v,w):
return sum(v.conj() * w)
def qr(a):
(m,n) = shape(a)
v = zeros((m,n))
for k in range(n):
print("k=%d" % k)
x = a[k:m,k]
x[0] += sign(x[0])*linalg.norm(x)
vk = x / linalg.norm(x)
v[k:m,k] = vk
print(vk)
a[k:m,k:... | mit | Python | |
c111bc4dd1c040b2ddf1a83c4d93692a77eb269f | Create __init__.py | rockwolf/python,rockwolf/python,rockwolf/python,rockwolf/python,rockwolf/python,rockwolf/python | fade/database/versions/__init__.py | fade/database/versions/__init__.py | bsd-3-clause | Python | ||
3067c29b47974d75e8f9a6f01596e9be10411b81 | Add admin.py file | scottferg/django-c2dm | admin.py | admin.py | # Copyright (c) 2010, Scott Ferguson
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions... | bsd-3-clause | Python | |
d942340fb5cfe8aa9aade11b3117b9848097c8a1 | Write an abstraction for storing locality state in ES | jeffbryner/MozDef,mozilla/MozDef,mpurzynski/MozDef,jeffbryner/MozDef,mozilla/MozDef,mpurzynski/MozDef,mpurzynski/MozDef,mpurzynski/MozDef,mozilla/MozDef,mozilla/MozDef,jeffbryner/MozDef,jeffbryner/MozDef | alerts/geomodel/journal.py | alerts/geomodel/journal.py | '''To make GeoModel code more testable, we abstract interaction with
ElasticSearch away via a "journal interface". This is just a function that,
called with an ES index and a list of `Entry`, stores the contained locality
state data in ElasticSearch.
'''
from typing import Callable, List, NamedTuple
from mozdef_util... | mpl-2.0 | Python | |
b1f964e9725a18014de17d454bb733b7ad43cd38 | Write Pytac script to write all readback pvs to file | razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects | pytac/write_to_file_readback_pvs.py | pytac/write_to_file_readback_pvs.py | import pytac.load_csv
import pytac.epics
def write_data_to_file(file_name, data):
fin = open(file_name, 'w')
for row in data:
fin.write('{0}\n'.format(row))
fin.close()
def get_readback_pvs(mode):
lattice = pytac.load_csv.load(mode, pytac.epics.EpicsControlSystem())
elements = lattice.ge... | apache-2.0 | Python | |
c12a589b92a7336b68626aa742b0611584a8b943 | add wunderground driver | jf87/smap,immesys/smap,jf87/smap,immesys/smap,SoftwareDefinedBuildings/smap,immesys/smap,jf87/smap,jf87/smap,SoftwareDefinedBuildings/smap,SoftwareDefinedBuildings/smap,jf87/smap,SoftwareDefinedBuildings/smap,immesys/smap,SoftwareDefinedBuildings/smap,SoftwareDefinedBuildings/smap,jf87/smap,immesys/smap | python/smap/drivers/wunderground.py | python/smap/drivers/wunderground.py |
import urllib2
import rfc822
from xml.dom.minidom import parse, parseString
from xml.parsers.expat import ExpatError
from twisted.internet import reactor
from twisted.python import log
from smap import driver
def get_val(dom, key):
v = dom.getElementsByTagName(key)[0].firstChild.nodeValue
return v
class Wun... | bsd-2-clause | Python | |
a88aed479937b09b560c8820d3d5c1003a94b9f1 | add google hangout parser | mjperrone/personal-lexicon,mjperrone/personal-lexicon | parse_hangouts.py | parse_hangouts.py | #!/usr/bin/env python
# usage: `python parse_hangouts.py path/to/takeout/`
import json
import sys
# holy wow this format is a mess without any docs
def parse_hangouts(path):
data = json.loads(open(path, 'r').read())
ids = {}
for conversation in data['conversation_state']:
for x in conversation['c... | mit | Python | |
514a04b5ffa7c9e3ede068c860933e9a404e6063 | add missing file. | biokit/biokit,biokit/biokit | biokit/stats/criteria.py | biokit/stats/criteria.py | import math
def AIC(L, k):
return 2*k - 2 * math.log(L)
def AICc(L, k, n):
return AIC(L, k) + 2*k*(k+1.)/(n-k-1.)
def BIC(L, k, n):
return -2 * math.log(L) + k * (math.log(n) - math.log(2*math.pi))
| bsd-2-clause | Python | |
ee8b3fd94bac16390b367dc5030489738ff67958 | add example to get UETable from data base | mverwe/JetRecoValidation | tools/getUETable_cfg.py | tools/getUETable_cfg.py | import FWCore.ParameterSet.Config as cms
process = cms.Process("jectxt")
process.load('Configuration.StandardSequences.Services_cff')
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
# define your favorite global tag
process.GlobalTag.globaltag = '74X_dataRun2_HLT_ppAt5TeV_v0'#Prompt_v4'... | cc0-1.0 | Python | |
5e1440874bc4e3f5ab2de23f72ad7f950ccce12e | add missing migration for the `fake` backend | terceiro/squad,terceiro/squad,terceiro/squad,terceiro/squad | squad/ci/migrations/0019_add_fake_backend.py | squad/ci/migrations/0019_add_fake_backend.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-26 21:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ci', '0018_testjob_dates'),
]
operations = [
migrations.AlterField(
... | agpl-3.0 | Python | |
0083a6fadad8bb0f202bab2af183a10f09e19459 | Add simple demo of piglow - lighting arms | claremacrae/raspi_code,claremacrae/raspi_code,claremacrae/raspi_code | piglow/demo_piglow.py | piglow/demo_piglow.py | from piglow import PiGlow
import time
def brighten_arm( arm ):
for i in range( 1, 10 ):
piglow.arm( arm, i )
time.sleep( 0.11 )
time.sleep( 0.5 )
piglow.arm( arm, 0 )
piglow = PiGlow()
piglow.all(0)
brighten_arm( 1 )
brighten_arm( 2 )
brighten_arm( 3 )
| mit | Python | |
b3f8be5b6ab7e4e713004447a3cfbda743d80394 | Add management command to update corpus logic hashes | PUNCH-Cyber/YaraGuardian,PUNCH-Cyber/YaraGuardian,PUNCH-Cyber/YaraGuardian,PUNCH-Cyber/YaraGuardian | rules/management/commands/CorpusLogicUpdate.py | rules/management/commands/CorpusLogicUpdate.py | import logging
from django.core.management.base import BaseCommand, CommandError
from plyara import YaraParser
from rules.models import YaraRule
# Configure Logging
logging.basicConfig(level=logging.INFO)
class Command(BaseCommand):
help = 'Recalculate the logic hashes of the entire rule corpus'
def handl... | apache-2.0 | Python | |
aefb6fbf38f8756458e487328139caf41afb6cee | Create MD5-DICT.py | thezakman/CTF-Scripts,thezakman/CTF-Scripts | MD5-DICT.py | MD5-DICT.py | from hashlib import md5
# by TheZakMan
# Exemplo de md5: 21232f297a57a5a743894a0e4a801fc3 (admin)
# dict: /usr/share/wordlists/rockyou.txt
print "[Md5 Dict-Cracker]"
print "| wordlist.txt |\n"
crackme = raw_input("MD5:")
#f = open('wordlist.txt', 'r')
f = open('/usr/share/wordlists/rockyou.txt', 'r')
words = [line... | artistic-2.0 | Python | |
96e17fbac42354be33b90e23759220ccb81d3223 | add sample + MM/DD/YY | 98pm/youtube_upload_timelapse,98pm/youtube_upload_timelapse | sample.py | sample.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | apache-2.0 | Python | |
14e32e60181083c8d0271fc974f3f1161ea81c74 | Add first pass on create_tab script | tock/libtock-c,tock/libtock-c,tock/libtock-c | tools/tab/create_tab.py | tools/tab/create_tab.py | #!/usr/bin/env python
import datetime
import io
import os
import sys
import tarfile
TAB_VERSION = 1
output_filename = sys.argv[1]
name = sys.argv[2]
inputs = sys.argv[3:]
metadata = []
metadata.append('tab-version = {}'.format(TAB_VERSION))
metadata.append('name = "{}"'.format(name))
metadata.append('only-for-boa... | apache-2.0 | Python | |
916250bc9509986f1dfce3b09ddbc7a49aa79d42 | Add admin for payments | ygrass/handsome,ygrass/handsome | payments/admin.py | payments/admin.py | # -*- coding: utf-8 -*-
from django.contrib import admin
from .models import Payment, Refund
admin.site.register(Payment)
admin.site.register(Refund)
| unlicense | Python | |
25f0615f4fb35779ce8688c5d29f92288ac2c30d | Add filesystem checks class | rzeka/QLDS-Manager | util/filesystem.py | util/filesystem.py | import os
class FSCheck:
def __init__(self, filepath, name: None):
if name is None:
name = filepath
self.filepath = filepath
self.name = name
def exists(self, error: True):
if not os.path.exists(self.filepath):
if error:
print('%s execu... | mit | Python | |
c0621b765234d33481318828dd3dc4bbc8481131 | Add edges script, which generates a set of outline tiles for a double-height tileset | tbentropy/pytile | edges.py | edges.py | from PIL import Image, ImageDraw, ImageFont
# compare a to b, b to c, c to d and d to a
max_edge_difference = 2
output = []
for a in range(5):
for b in range(5):
for c in range(5):
for d in range(5):
if 0 in [a,b,c,d]:
# Must be one vertex at 0
... | bsd-3-clause | Python | |
edabec29ebb99e938fd3523951597e336ddd3adc | Add text vectorizers benchmarks (#9086) | scikit-learn/scikit-learn,bnaul/scikit-learn,aflaxman/scikit-learn,chrsrds/scikit-learn,vinayak-mehta/scikit-learn,zorroblue/scikit-learn,scikit-learn/scikit-learn,glemaitre/scikit-learn,betatim/scikit-learn,huzq/scikit-learn,jakirkham/scikit-learn,nhejazi/scikit-learn,wazeerzulfikar/scikit-learn,nhejazi/scikit-learn,a... | benchmarks/bench_text_vectorizers.py | benchmarks/bench_text_vectorizers.py | """
To run this benchmark, you will need,
* scikit-learn
* pandas
* memory_profiler
* psutil (optional, but recommended)
"""
from __future__ import print_function
import timeit
import itertools
import numpy as np
import pandas as pd
from memory_profiler import memory_usage
from sklearn.datasets import fetch_... | bsd-3-clause | Python | |
9bee248bce5edbf073f66e5d7a621f22bbba314f | Fix a failing test | ArvinPan/pyzmq,swn1/pyzmq,ArvinPan/pyzmq,Mustard-Systems-Ltd/pyzmq,yyt030/pyzmq,yyt030/pyzmq,caidongyun/pyzmq,dash-dash/pyzmq,yyt030/pyzmq,dash-dash/pyzmq,swn1/pyzmq,caidongyun/pyzmq,dash-dash/pyzmq,Mustard-Systems-Ltd/pyzmq,Mustard-Systems-Ltd/pyzmq,swn1/pyzmq,ArvinPan/pyzmq,caidongyun/pyzmq | zmq/devices/__init__.py | zmq/devices/__init__.py | """0MQ Device classes for running in background threads or processes."""
#
# Copyright (c) 2010 Brian E. Granger
#
# This file is part of pyzmq.
#
# pyzmq is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free Soft... | """0MQ Device classes for running in background threads or processes."""
#
# Copyright (c) 2010 Brian E. Granger
#
# This file is part of pyzmq.
#
# pyzmq is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free Soft... | bsd-3-clause | Python |
8c168933c85f828ec85d6c069143e3c4174657b7 | Create 10.CubeProperties.py | stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity,stoyanov7/SoftwareUniversity | TechnologiesFundamentals/ProgrammingFundamentals/MethodsAndDebugging-Excercises/10.CubeProperties.py | TechnologiesFundamentals/ProgrammingFundamentals/MethodsAndDebugging-Excercises/10.CubeProperties.py | import math
cubeSide = float(input())
parameter = input()
if parameter == "face":
face = math.sqrt(math.pow(cubeSide, 2) * 2)
print("%.2f" % face)
elif parameter == "space":
space = math.sqrt(math.pow(cubeSide, 2) * 3)
print("%.2f" % space)
elif parameter == "volume":
volume = math.pow(cubeSide,... | mit | Python | |
9df4f11d878ee8d13dcbcee49745bdcc8ab3e507 | Remove logging from test config | dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,gmimano/commcaretest,SEL-Columbia/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,gmimano/commcaretest,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,gmimano/commcaretest,puttarajubr... | .travis/localsettings.py | .travis/localsettings.py | import os
####### Configuration for CommCareHQ Running on Travis-CI #####
####### Database config. This assumes Postgres #######
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'commcarehq',
'USER': 'postgres',
'PASSWORD': '',
'HOST':... | import os
####### Configuration for CommCareHQ Running on Travis-CI #####
####### Database config. This assumes Postgres #######
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'commcarehq',
'USER': 'postgres',
'PASSWORD': '',
'HOST':... | bsd-3-clause | Python |
16f29bfc832a64accd6ef67c2140f70ea07f2f05 | Add PyUnit for deep feature extraction of a LeNet model with mxnet. | michalkurka/h2o-3,mathemage/h2o-3,h2oai/h2o-3,h2oai/h2o-3,spennihana/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,mathemage/h2o-3,michalkurka/h2o-3,mathemage/h2o-3,spennihana/h2o-3,h2oai/h2o-dev,h2oai/h2o-dev,h2oai/h2o-3,spennihana/h2o-3,michalkurka/h2o-3,spennihana/h2o-3,michalkurka/h2o-3,h2oai/h2o-3,spennihana/h2o-3,mathemage... | h2o-py/tests/testdir_algos/deepwater/pyunit_lenet_deepwater_feature_extraction.py | h2o-py/tests/testdir_algos/deepwater/pyunit_lenet_deepwater_feature_extraction.py | from __future__ import print_function
import sys, os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from tests import pyunit_utils
from h2o.estimators.deepwater import H2ODeepWaterEstimator
def deepwater_lenet():
if not H2ODeepWaterEstimator.available(): return
frame = h2o.import_file(pyunit_utils.lo... | apache-2.0 | Python | |
9a1635dcdb21548fcb7b1f718624c991602588e6 | Initialize P01_isPhoneNumber | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter07/P01_isPhoneNumber.py | books/AutomateTheBoringStuffWithPython/Chapter07/P01_isPhoneNumber.py | # This program returns True if a string is a phone number and False if not
# However, it's not very efficient
def isPhoneNumber(text):
if len(text) != 12:
return False
for i in range(0, 3):
if not text[i].isdecimal():
return False
if text[3] != '-':
return False
for... | mit | Python | |
af6272941a66967c3a64d735223fefc917056562 | add example | jontrulson/upm,MakerCollider/upm,stefan-andritoiu/upm,tripzero/upm,ShawnHymel/upm,Jon-ICS/upm,sasmita/upm,mircea/upm,kissbac/upm,andreivasiliu2211/upm,arfoll/upm,srware/upm,nitirohilla/upm,sasmita/upm,Vaghesh/upm,g-vidal/upm,yoyojacky/upm,0xD34D/upm,tripzero/upm,kissbac/upm,andreivasiliu2211/upm,Vaghesh/upm,tylergibson... | examples/python/rgb-lcd.py | examples/python/rgb-lcd.py | # Author: Brendan Le Foll <brendan.le.foll@intel.com>
# Copyright (c) 2014 Intel Corporation.
#
# 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 limita... | mit | Python | |
771eede117c29af75c1d8d21f0da538bd280b5c1 | Create search.py | Chick3nman/MD5-Record-Search | search.py | search.py | # Requires Parallel to be installed
# Use the below command to start with all available cores used
# seq `nproc` | parallel -u python script.py
__authors__ = ['Chick3nputer', 'Supersam654']
from itertools import islice, product
import string
import hashlib
from random import shuffle
from sys import argv
chars = stri... | mit | Python | |
5ee78767ebaa5c1bbceb7ce2c82fa6687169b0c2 | Add exercice The Paranoid Android | AntoineAugusti/katas,AntoineAugusti/katas,AntoineAugusti/katas | codingame/medium/paranoid_android.py | codingame/medium/paranoid_android.py | class Elevator(object):
def __init__(self, floor, pos):
super(Elevator, self).__init__()
self.floor = floor
self.pos = pos
self.direction = None
def __str__(self):
return 'Elevator on floor %i (pos %i) with dir %s' % (self.floor, self.pos, self.direction)
class Game(ob... | mit | Python | |
f7132b86ca5f4dafeb88ca65b3d7fe71c6886cc5 | Add packageinfo command | ylatuya/cerbero,jackjansen/cerbero-2013,brion/cerbero,flexVDI/cerbero,sdroege/cerbero,BigBrother-International/gst-cerbero,OptoFidelity/cerbero,jackjansen/cerbero-2013,nzjrs/cerbero,multipath-rtp/cerbero,AlertMe/cerbero,cee1/cerbero-mac,sdroege/cerbero,jackjansen/cerbero-2013,brion/cerbero,ramaxlo/cerbero,shoreflyer/ce... | cerbero/commands/info.py | cerbero/commands/info.py | # cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | lgpl-2.1 | Python | |
cb79c9bf74cb18f3ee86c7c3d5415ce1b088dde2 | Add missing markdown file. | AllMyChanges/allmychanges.com,AllMyChanges/allmychanges.com,AllMyChanges/allmychanges.com,AllMyChanges/allmychanges.com | allmychanges/markdown.py | allmychanges/markdown.py | import CommonMark
def render_markdown(text):
parser = CommonMark.DocParser()
renderer = CommonMark.HTMLRenderer()
ast = parser.parse(text)
return renderer.render(ast)
| bsd-2-clause | Python | |
114ea6c10658d2c199c68637d04bdd968fcc4452 | Test case for task.info.json files | voyagersearch/voyager-py,voyagersearch/voyager-py | voyager_tasks/test/test_info_files.py | voyager_tasks/test/test_info_files.py | import os
import sys
import glob
import json
import unittest
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
import voyager_tasks
class TestInfoFiles(unittest.TestCase):
"""Test case for checking info files exist
for each task and have a valid structure.
"""
@classmethod
def setUpClass... | apache-2.0 | Python | |
24f536a72b0467ff3ee1615f515ecff9fbf36bb3 | Add pair sum | sitdh/com-prog | ch07_04.py | ch07_04.py | number_of_data = int(input().strip())
ma = [0] * number_of_data
numbers = [int(c) for c in input().strip().split()]
for i in range(1, number_of_data - 1):
ma[i] = (sum(numbers[i-1:i+2])/3)
ma[0] = sum(numbers[0:2])/2
ma[-1] = sum(numbers[number_of_data - 2:])/2
ma = [str(d) for d in ma]
print("\n".join(ma))
| mit | Python | |
afa0efbdfc6bc4d19eaba919bc82c907fce37fa7 | add base for API endpoint | devinit/extractormeter | datasets/api.py | datasets/api.py | import json
from flask import request, Response, url_for
from jsonschema import validate, ValidationError
import models
import decorators
from datasets import app
from database import session
| mit | Python | |
ce9ac96a6f1e57ebbce162b7e097675c23f1f2f4 | Implement simple gaussian process regression. | alasdairtran/mclearn,chengsoonong/mclass-sky,alasdairtran/mclearn,alasdairtran/mclearn,chengsoonong/mclass-sky,chengsoonong/mclass-sky,alasdairtran/mclearn,chengsoonong/mclass-sky | projects/jakub/gaussian_processes/gaussian_process_regression.py | projects/jakub/gaussian_processes/gaussian_process_regression.py | import csv
import sys
import matplotlib.pyplot as plt
import numpy as np
import sklearn
import sklearn.gaussian_process.kernels
kernel = (sklearn.gaussian_process.kernels.ConstantKernel()
+ sklearn.gaussian_process.kernels.Matern(length_scale=2, nu=3/2)
+ sklearn.gaussian_process.kernels.WhiteKer... | bsd-3-clause | Python | |
c4aca4fe1bf02286f218ca855a41e380987818f7 | Add test example | cloudcomputinghust/CAL_Appliances,cloudcomputinghust/CAL_Appliances,cloudcomputinghust/CAL_Appliances | fcap/tests/test_example.py | fcap/tests/test_example.py | import unittest
class BasicTestSuite(unittest.TestCase):
"""Basic test cases."""
def test_absolute_truth_and_meaning(self):
assert True
| mit | Python | |
fa27978c50364c903e2c343560f66db6ddc76bdb | add setup.py | ccwang002/2014-Taipeipy-venv | play_tox/setup.py | play_tox/setup.py | from setuptools import setup
setup(name="x")
| mit | Python | |
6c4edaefe30905f62b885b931a1c5ca6d65cd220 | Add tests for project model | ganemone/ontheside,ganemone/ontheside,ganemone/ontheside | server/tests/models/test_project.py | server/tests/models/test_project.py | from server.models import Project
from server.tests.helpers import fixtures, FlaskTestCase
class TestProject(FlaskTestCase):
@fixtures('single_project.json')
def test_get_single_owner(self):
"""Test getting single project owner
"""
with self.flaskapp.test_request_context():
... | mit | Python | |
ea7f32243c70de2737b1759db2c0e12337ecf840 | add missing file | simphony/simphony-common | simphony/testing/abc_check_lattice.py | simphony/testing/abc_check_lattice.py | import abc
from functools import partial
import numpy
from numpy.testing import assert_array_equal
from simphony.testing.utils import (
create_data_container, compare_data_containers, compare_lattice_nodes)
from simphony.cuds.lattice import LatticeNode
from simphony.core.data_container import DataContainer
clas... | bsd-2-clause | Python | |
ee62d6a972e5af72fc9a5e2e36d1a7822a1703af | Add sample on veh handle setup in remote process | hakril/PythonForWindows | samples/remote_veh_segv.py | samples/remote_veh_segv.py | import windows
import windows.test
from windows.generated_def.winstructs import *
#c = windows.test.pop_calc_64()
c = windows.test.pop_calc_64(dwCreationFlags=CREATE_SUSPENDED)
python_code = """
import windows
import ctypes
import windows
from windows.vectored_exception import VectoredException
import windows.gen... | bsd-3-clause | Python | |
0e5ba1d9ae7ca7d5439d886abe732f0fcebed49b | Create classes.py | V1Soft/Essential | classes.py | classes.py | class String(object):
| bsd-3-clause | Python | |
e29bdc567c3d1f04f9e9ec17792052b0f66f918e | reorder users migration | monty5811/apostello,monty5811/apostello,monty5811/apostello,monty5811/apostello | apostello/migrations/0010_auto_20160421_1411.py | apostello/migrations/0010_auto_20160421_1411.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-21 13:11
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('apostello', '0009_userprofile_message_cost_limit'),
]
operations = [
migrations.Alte... | mit | Python | |
a519b7c91a8ea84549efcdf145aed56cf89b9d59 | Create users.py | chidaobanjiu/Loocat.cc,chidaobanjiu/Flask_Web,chidaobanjiu/MANA2077,chidaobanjiu/MANA2077,chidaobanjiu/Flask_Web,chidaobanjiu/MANA2077,chidaobanjiu/Loocat.cc,chidaobanjiu/Loocat.cc,chidaobanjiu/Flask_Web,chidaobanjiu/MANA2077,chidaobanjiu/MANA2077,chidaobanjiu/Flask_Web,chidaobanjiu/MANA2077 | app/api_1_0/users.py | app/api_1_0/users.py | from flask import jsonify, request, current_app, url_for
from . import api
from ..models import User, Post
@api.route('/users/<int:id>')
def get_user(id):
user = User.query.get_or_404(id)
return jsonify(user.to_json())
@api.route('/users/<int:id>/posts/')
def get_user_posts(id):
user = User.query.get_or... | mit | Python | |
7445d91a68753052c837d5e0c919585d1f09d3d6 | Add deterministic annealing demo | SalemAmeen/bayespy,bayespy/bayespy,jluttine/bayespy,fivejjs/bayespy | bayespy/demos/annealing.py | bayespy/demos/annealing.py | ######################################################################
# Copyright (C) 2015 Jaakko Luttinen
#
# This file is licensed under Version 3.0 of the GNU General Public
# License. See LICENSE for a text of the license.
######################################################################
####################... | mit | Python | |
52a8a1cd093f8bdbaf0abfc85eff2d3682e24b12 | Add Python script for questions linting | PavloKapyshin/rusk,PavloKapyshin/rusk,PavloKapyshin/rusk | scripts/check-questions.py | scripts/check-questions.py | #!/usr/bin/env python3
import os
import sys
import json
import collections
import unicodedata
TEXT_FIELD = "t"
OPTIONS_FIELD = "o"
KIND_FIELD = "k"
CORRECT_FIELD = "c"
MANDATORY_FIELDS = {TEXT_FIELD, OPTIONS_FIELD, CORRECT_FIELD}
def norm(s):
return unicodedata.normalize("NFD", s)
def error(message, *, n):
... | bsd-3-clause | Python | |
3a662b5820ea90c0cd63116a610ede25558c5562 | Add tests directory to sourceterm package and start test module. | ihuston/pyflation,ihuston/pyflation | sourceterm/tests/test_srcequations.py | sourceterm/tests/test_srcequations.py | '''
Created on 25 Aug 2010
@author: ith
'''
import unittest
class Test(unittest.TestCase):
def testName(self):
pass
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testName']
unittest.main() | bsd-3-clause | Python | |
3d11921f67c1928bb79869c3af1f8836360219fd | Add SIF assembler for Boolean network generation | sorgerlab/indra,johnbachman/indra,bgyori/indra,sorgerlab/belpy,sorgerlab/belpy,pvtodorov/indra,johnbachman/belpy,pvtodorov/indra,sorgerlab/indra,jmuhlich/indra,jmuhlich/indra,pvtodorov/indra,jmuhlich/indra,johnbachman/indra,sorgerlab/belpy,johnbachman/indra,pvtodorov/indra,bgyori/indra,sorgerlab/indra,bgyori/indra,john... | indra/assemblers/sif_assembler.py | indra/assemblers/sif_assembler.py | import networkx as nx
from indra.statements import *
class SifAssembler(object):
def __init__(self, stmts=None):
if stmts is None:
self.stmts = []
else:
self.stmts = stmts
self.graph = nx.DiGraph()
self.nodes = {}
def make_model(self):
for st in ... | bsd-2-clause | Python | |
1b10427e309861bb8afb00c45446f5a9cce5ba96 | Create whenido-renamer.py | tingmakpuk/Renamer | whenido-renamer.py | whenido-renamer.py | """Renamer, Copyright 2014, Whenido, /u/tingmakpuk. Open source license available.
This program was the first project of a complete novice, and the use of the program is at your own risk.
Current version 3.0: More eligantly avoids renaming this program file. However, it can still rename other folders in the director... | apache-2.0 | Python | |
f552979125531fade029bc8baa51e2d0bb9dd320 | Simplify retrieving of config home in core init method | prvnkumar/powerline,Luffin/powerline,IvanAli/powerline,s0undt3ch/powerline,kenrachynski/powerline,DoctorJellyface/powerline,firebitsbr/powerline,wfscheper/powerline,xfumihiro/powerline,magus424/powerline,russellb/powerline,seanfisk/powerline,xxxhycl2010/powerline,darac/powerline,junix/powerline,s0undt3ch/powerline,wfsc... | powerline/core.py | powerline/core.py | # -*- coding: utf-8 -*-
import importlib
import json
import os
import sys
from colorscheme import Colorscheme
from theme import Theme
class Powerline(object):
def __init__(self, ext):
config_home = os.environ.get('XDG_CONFIG_HOME', os.path.expanduser('~/.config'))
config_path = os.path.join(config_home, 'powe... | # -*- coding: utf-8 -*-
import importlib
import json
import os
import sys
from colorscheme import Colorscheme
from theme import Theme
class Powerline(object):
def __init__(self, ext):
try:
config_home = os.environ['XDG_CONFIG_HOME']
except KeyError:
config_home = os.path.expanduser('~/.config')
config... | mit | Python |
5999d8b572d8f28fc4fee0826660a40ec108d15b | Create trimfile.py | suzannerohrback/somaticCNVpipeline,suzannerohrback/somaticCNVpipeline | bin/preprocess/trimfile.py | bin/preprocess/trimfile.py | #!/usr/bin/python
def trimOne():
return 0
| mit | Python | |
5bcc8e8fb427322e98bb8cd27f3b15270a6e75a7 | Add script to automatically populate struct fields | bazad/ida_kernelcache | scripts/populate_struct.py | scripts/populate_struct.py | #
# scripts/populate_struct.py
# Brandon Azad
#
# Populate a struct using data flow analysis.
#
def kernelcache_populate_struct(struct=None, address=None, register=None, delta=None):
import idc
import idautils
import idaapi
import ida_kernelcache as kc
import ida_kernelcache.ida_utilities as idau
... | mit | Python | |
d268c5870623b1c5f6da202264cb1b399f037ec8 | Create rename.py | nrikee/Unix-Like_tools_in_Python | rename.py | rename.py | import sys
import os
if len ( sys.argv ) == 4:
args = sys.argv [ 1: ]
else:
print 'Usage: python rename.py [path]'
sys.exit ( 0 )
path = '.'
filenames = os.listdir ( str ( path ) )
# Check some things
text = open ( args [ 0 ], 'r' ).read ( )
original_names = text.split ( '\n' )
text = open ( args [ 1 ], 'r' ).re... | mit | Python | |
8e61c18d23812a70d65ec42d7c36c5f1b7ed829d | add script for 50bp window gff summary. | brentp/methylcode,brentp/methylcode,brentp/methylcode,brentp/methylcode | scripts/summarize_gff50.py | scripts/summarize_gff50.py | import sys
import os.path as op
sys.path.insert(0, "/home/brentp/src/methylcode/code/")
from methyl import MethylGroup
prefix = sys.argv[1] # something like: out1234n/thaliana_v9
acontext = sys.argv[2] # CHH or CHG or CG
window = 50
mg = MethylGroup(prefix)
fh = open(mg.dir + mg.prefix + ".test.%ibp.%s.gff" % (wind... | bsd-3-clause | Python | |
3dc9204c80f2f7be5f82200c059a6a62f02bf6c1 | Update blogroll and social links. | enthought/distarray,enthought/distarray,RaoUmer/distarray,RaoUmer/distarray | www/pelicanconf.py | www/pelicanconf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'IPython development team and Enthought, Inc.'
SITENAME = u'DistArray'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/Chicago'
DEFAULT_LANG = u'en'
# Feed generation is usually not desired when developing
FEED_ALL_... | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'IPython development team and Enthought, Inc.'
SITENAME = u'DistArray'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/Chicago'
DEFAULT_LANG = u'en'
# Feed generation is usually not desired when developing
FEED_ALL_... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.