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 |
|---|---|---|---|---|---|---|---|---|
bdb75567519914386da7f1d598c6c7aaf96d8e02 | Add sql solution for 561. Array Partition I | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/array-partition-i.py | py/array-partition-i.py | class Solution(object):
def arrayPairSum(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
return sum(sorted(nums)[::2])
| apache-2.0 | Python | |
7275a50343cba5073dc2fa77e2e964daec002c38 | move refactored OttTestCase to utils | OpenTransitTools/utils | ott/utils/tests/ott_test_case.py | ott/utils/tests/ott_test_case.py | import os
import sys
import unittest
import urllib
import contextlib
from ott.utils import config_util
from ott.utils import file_utils
class OttTestCase(unittest.TestCase):
domain = "localhost"
port = "33333"
path = None
url_file = None
def get_url(self, svc_name, params=None, lang=None):
... | mpl-2.0 | Python | |
e07c699caf699852c98b3396150b343553a386c4 | Add tests for language api | ganemone/ontheside,ganemone/ontheside,ganemone/ontheside | server/tests/api/test_language_api.py | server/tests/api/test_language_api.py | import json
from server.tests.helpers import FlaskTestCase, fixtures
class TestLanguageAPI(FlaskTestCase):
@fixtures('base.json')
def test_get_empty_languages(self):
"""Test GET /api/languages endpoint with no data"""
response, data = self.api_request('get', '/api/languages')
assert d... | mit | Python | |
6e736a48f8c49b8257305125742d89cb7f729fbc | index Ansible source versions | johntellsall/shotglass,johntellsall/shotglass,johntellsall/shotglass | shotglass/make_ver_ansible.py | shotglass/make_ver_ansible.py | #!/usr/bin/env python
'''
make_versions -- index many versions of a project
ALPHA code, will need modification for general use.
'''
import re
import subprocess
import sys
import git
NAME = 'ansible'
bad_tag_re = re.compile(r'(rc|beta|alpha)')
repos = git.Repo(NAME)
tags = [tag.name for tag in repos.tags
if t... | mit | Python | |
24e6a8a21ef61edbe00e6af8a1aea274394a23ed | Add a snippet (python/pygtk). | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/pygtk/minimal.py | python/pygtk/minimal.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including withou... | mit | Python | |
08e4f449f0e871f996e9a265fd23a967a0377078 | Add bfx example | doubleDragon/QuantBot | quant/example/ex_bfx.py | quant/example/ex_bfx.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import time
from quant import config
from quant.api.bitfinex import PrivateClient
client = PrivateClient(key=config.Bitfinex_SUB_API_KEY, secret=config.Bitfinex_SUB_SECRET_TOKEN)
# client = PrivateClient(key=config.Bitfinex_API_KEY, secret=config.Bitfinex_SECRET_TOKEN)
# ... | mit | Python | |
800639fe381ec502e54a3fbd95241b460bd3e3c3 | add tests for shannon.py | dit/dit,dit/dit,dit/dit,chebee7i/dit,Autoplectic/dit,dit/dit,Autoplectic/dit,chebee7i/dit,chebee7i/dit,chebee7i/dit,Autoplectic/dit,Autoplectic/dit,dit/dit,Autoplectic/dit | dit/algorithms/tests/test_shannon.py | dit/algorithms/tests/test_shannon.py | from __future__ import division
from nose.tools import *
from dit import Distribution as D, ScalarDistribution as SD
from dit.algorithms import (entropy as H,
mutual_information as I,
conditional_entropy as CH)
def test_H1():
d = SD([1/2, 1/2])
assert_a... | bsd-3-clause | Python | |
8c1353537d0920d8137d5ea9d22843da67e41d9a | Add string_format pylint plugin. | thaim/ansible,thaim/ansible | test/sanity/pylint/plugins/string_format.py | test/sanity/pylint/plugins/string_format.py | # (c) 2018, Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import six
import astroid
from pylint.interfaces import IAstr... | mit | Python | |
d6d21f6e7b8d2a44ff3406ddc9a050cc17372da8 | Add analyze_nir_intensity tests module | danforthcenter/plantcv,danforthcenter/plantcv,danforthcenter/plantcv | tests/plantcv/test_analyze_nir_intensity.py | tests/plantcv/test_analyze_nir_intensity.py | import cv2
import numpy as np
from plantcv.plantcv import analyze_nir_intensity, outputs
def test_analyze_nir(test_data):
# Clear previous outputs
outputs.clear()
# Read in test data
img = cv2.imread(test_data.small_gray_img, -1)
mask = cv2.imread(test_data.small_bin_img, -1)
_ = analyze_nir_... | mit | Python | |
9790fb109d59214ee016750307cd39b2f2780cf7 | solve increment counter | gsathya/dsalgo,gsathya/dsalgo | algo/incrementcounter.py | algo/incrementcounter.py | from datetime import datetime, timedelta
from time import sleep
second = timedelta(seconds=1)
day = timedelta(days=1)
class Increment:
def __init__(self):
self.last_second_count = 0
self.last_day_count = 0
self.seconds_now = datetime.now()
self.days_now = datetime.now()
... | mit | Python | |
aa2b788c4d0b148ed9881da86de97965311b9cb4 | Add server.py | GraysonScherm/Distributed-Internet-Service-Delivery,GraysonScherm/Distributed-Internet-Service-Delivery | server.py | server.py | import socket, sys
import datetime
import time, random
TCP_IP = '72.36.65.116'
TCP_PORT = 5005
BUFFER_SIZE = 1024
if len(sys.argv) < 2:
print ("Enter the server id")
sys.exit(1)
while True:
v = random.randint(1, 10)
ts = time.time()
MESSAGE = str(v) + ";" + sys.argv[1] + ";" + datetime.datetime.fromtimestamp(... | mit | Python | |
dcca93fbb66e5cd8bf0e0500aca3f187922e8806 | Add in team id spider | danmoeller/ncaa-bball-attendance,danmoeller/ncaa-bball-attendance,danmoeller/ncaa-bball-attendance | scrapy_espn/scrapy_espn/spiders/team_spider.py | scrapy_espn/scrapy_espn/spiders/team_spider.py | import scrapy
class TeamSpider(scrapy.Spider):
name = "team"
start_urls = [
'http://www.espn.com/mens-college-basketball/teams',
]
def parse(self, response):
for conf in response.css('ul'):
for team in conf.css('li'):
yield {
'team':team.css('h5 a::text').extract(),
'id':team.css('h5 a::attr(... | mit | Python | |
4eb6c05df9b8faf4492b23db1ef0e2aee141d24b | test case for tpt | trendelkampschroer/PyEMMA,arokem/PyEMMA,trendelkampschroer/PyEMMA,arokem/PyEMMA | emma2/msm/analysis/api_test.py | emma2/msm/analysis/api_test.py | '''
Created on 18.10.2013
@author: marscher
'''
import unittest
import emma2.msm.analysis.api as api
import numpy as np
class Test(unittest.TestCase):
def testTPT(self):
A = np.ndarray([1, 2, 3], dtype=int)
B = np.ndarray([4, 2], dtype=int)
T = np.ndarray([[ 0.5, 0, 0.5, 0],
... | bsd-2-clause | Python | |
458cf526a4ebb72b4fad84e8cd2b665e0f093c1b | Add functional test for cluster check recover | openstack/senlin,openstack/senlin,tengqm/senlin-container,openstack/senlin,stackforge/senlin,stackforge/senlin,tengqm/senlin-container | senlin/tests/functional/test_cluster_health.py | senlin/tests/functional/test_cluster_health.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | apache-2.0 | Python | |
48c008b4ac08114e30f4bee7a208d5d3fb925296 | Add partial simple greedy algorithm (baseline). | karulont/combopt | problem1/steiner-simplegreedy.py | problem1/steiner-simplegreedy.py | import networkx as nx
from sys import argv
def main():
# G = nx.read_gml(argv[1])
G = nx.read_gml("steiner-small.gml")
T = [] # terminals
for v,d in G.nodes_iter(data=True):
if d['T'] == 1:
T.append(v)
U = T[:] # Steiner tree vertices
F = [] # Steiner tree edges
D = [] # cand... | mit | Python | |
fca390e7dd0d806cd87fa3570ce23ad132d8c852 | add new example | pignacio/python-nvd3,pignacio/python-nvd3,BibMartin/python-nvd3,mgx2/python-nvd3,oz123/python-nvd3,liang42hao/python-nvd3,oz123/python-nvd3,vdloo/python-nvd3,vdloo/python-nvd3,vdloo/python-nvd3,oz123/python-nvd3,Coxious/python-nvd3,liang42hao/python-nvd3,Coxious/python-nvd3,yelster/python-nvd3,mgx2/python-nvd3,mgx2/pyt... | examples/lineWithFocusChart.py | examples/lineWithFocusChart.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Examples for Python-nvd3 is a Python wrapper for NVD3 graph library.
NVD3 is an attempt to build re-usable charts and chart components
for d3.js without taking away the power that d3.js gives you.
Project location : https://github.com/areski/python-nvd3
"""
from nvd3 imp... | mit | Python | |
0114173d508298d6e9f72fd7f344d9123e4a7e59 | Create wtospark.py | jgarnier/iot-corner,jgarnier/iot-corner,jgarnier/iot-corner | sparkgw/wtospark.py | sparkgw/wtospark.py | from flask import Flask, request, abort
import json
import urllib2
app = Flask(__name__)
#Secret provided by
# fbabottemp99
# MmQ3YTA0MGUtNGI1Zi00MTI3LTlmZTMtMjQxNGJhYmRjMTI0MzI2ZDFlYWYtYzhh
# curl -X POST -H "X-Device-Secret: 12345" http://localhost:8080/report?temp=32
YOUR_DEVICE_SECRET = "12345"
YOUR_BOT_TOKEN ... | apache-2.0 | Python | |
5432dd2ee2e1d20494d0b4cf8d816b298e70067c | Add test script. | nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome,nmc-probe/emulab-nome | protogeni/test/ma/lookup_keys.py | protogeni/test/ma/lookup_keys.py | #! /usr/bin/env python
#
# Copyright (c) 2012-2014 University of Utah and the Flux Group.
#
# {{{GENIPUBLIC-LICENSE
#
# GENI Public License
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without rest... | agpl-3.0 | Python | |
d1edac38e3402ebe03f96597500c3d39e49f299d | add run_pylint.py | asah/pylint-setup,asah/pylint-setup | run_pylint.py | run_pylint.py | #!/usr/bin/python
#
# wrapper script for pylint which just shows the errors and changes the return value if there's problems
# (enforcing a minscore and/or maxerrors - defaults to perfection)
#
import sys, re, subprocess, os
MINSCORE = 10.0
MAXERRORS = 0
command = 'pylint --rcfile=pylintrc --disable=W0511,W9911,W... | mit | Python | |
a96c25cf46cd82716b397ba61c2b67acb8b7c2d7 | Add code reading. | thewizardplusplus/micro,thewizardplusplus/micro,thewizardplusplus/micro | micro.py | micro.py | #!/usr/bin/env python
from sys import argv
def get_code():
return argv[1]
if __name__ == '__main__':
code = get_code()
print(code)
| mit | Python | |
084ebff19703c42c50621eb94ac070c6a471e983 | Solve the most wanted letter problem. | edwardzhu/checkio-solution | Home/mostWantedLetter.py | Home/mostWantedLetter.py | def checkio(word):
word = word.lower()
arr = dict()
for i in range(len(word)):
char = word[i]
if not str.isalpha(char):
continue
if not arr.__contains__(char):
arr[char] = 0
arr[char] = arr[char] + 1
result = ""
counter = 0
for k, v in arr.... | mit | Python | |
d437f494db827c69da7aaec00a5acf1d133e16b2 | Add basic slash command example | rapptz/discord.py,Rapptz/discord.py | examples/app_commands/basic.py | examples/app_commands/basic.py | from typing import Optional
import discord
from discord import app_commands
MY_GUILD = discord.Object(id=0) # replace with your guild id
class MyClient(discord.Client):
def __init__(self, *, intents: discord.Intents, application_id: int):
super().__init__(intents=intents, application_id=application_id)... | mit | Python | |
8fb4df5367b5c03d2851532063f6fa781fe2f980 | Add Fibonacci Series Using Recursion | TheAlgorithms/Python | Maths/fibonacciSeries.py | Maths/fibonacciSeries.py | # Fibonacci Sequence Using Recursion
def recur_fibo(n):
if n <= 1:
return n
else:
return(recur_fibo(n-1) + recur_fibo(n-2))
limit = int(input("How many terms to include in fionacci series:"))
if limit <= 0:
print("Plese enter a positive integer")
else:
print("Fibonacci series:")
for ... | mit | Python | |
5f8e01f976d75eca651e29ebdd379c865aa5bda9 | update merge_two_binary_trees_617 | lanpong/LeetCode,lanpong/LeetCode | Python/merge_two_binary_trees_617.py | Python/merge_two_binary_trees_617.py | # Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.
# You need to merge them into a new binary tree. The merge rule is that if two nodes overlap, then sum node values up as the new value of the merged node.
# Otherw... | mit | Python | |
8c6983656e550ebaf32ff714a3c22be276ba842b | Add ScribdDownloader.py | aknuck/Scribd-Downloader | ScribdDownloader.py | ScribdDownloader.py | #Scribd Downloader
#Adam Knuckey September 2015
print ("Starting Scribd Downloader")
import os
import re
import urllib, urllib2
import threading
from time import sleep
def download(link,destination):
#print link
urllib.urlretrieve(link,destination)
print("Enter textbook link:")
website = raw_input(" > ")
request =... | mit | Python | |
97ae80b08958646e0c937f65a1b396171bf61e72 | Add a proper unit test for xreload.py. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_xreload.py | Lib/test/test_xreload.py | """Doctests for module reloading.
>>> from xreload import xreload
>>> from test.test_xreload import make_mod
>>> make_mod()
>>> import x
>>> C = x.C
>>> Cfoo = C.foo
>>> Cbar = C.bar
>>> Cstomp = C.stomp
>>> b = C()
>>> bfoo = b.foo
>>> b.foo()
42
>>> bfoo()
42
>>> Cfoo(b)
42
>>> Cbar()
42 42
>>> Cstomp()
42 42 42
>>>... | mit | Python | |
53e851f68f106bff919a591a3516f26d5b07c375 | add unit test case for FedMsgContext.send_message | fedora-infra/fedmsg,cicku/fedmsg,vivekanand1101/fedmsg,pombredanne/fedmsg,mathstuf/fedmsg,vivekanand1101/fedmsg,maxamillion/fedmsg,fedora-infra/fedmsg,chaiku/fedmsg,vivekanand1101/fedmsg,cicku/fedmsg,pombredanne/fedmsg,chaiku/fedmsg,maxamillion/fedmsg,fedora-infra/fedmsg,mathstuf/fedmsg,pombredanne/fedmsg,mathstuf/fedm... | fedmsg/tests/test_core.py | fedmsg/tests/test_core.py | import unittest
import mock
import warnings
from fedmsg.core import FedMsgContext
from common import load_config
class TestCore(unittest.TestCase):
def setUp(self):
config = load_config()
config['io_threads'] = 1
self.ctx = FedMsgContext(**config)
def test_send_message(self):
... | lgpl-2.1 | Python | |
aa38c6604476f1181903c688c0444ed87c9d75a1 | Add engine tests. | simphony/simphony-common | simphony/engine/tests/test_engine_metadata.py | simphony/engine/tests/test_engine_metadata.py | """Tests regarding loading engine's metadata."""
import sys
import unittest
import simphony.engine as engine_api
from simphony.engine import ABCEngineExtension, EngineInterface
from simphony.engine.extension import EngineManager, EngineManagerException
from simphony.engine.extension import EngineFeatureMetadata, Engin... | bsd-2-clause | Python | |
8483174f32801318d1cd8aa33abb04819b4a7810 | Create usonic.py | JayJanarthanan/RPI-GARAGE,JayJanarthanan/RPI-GARAGE,JayJanarthanan/RPI-GARAGE,JayJanarthanan/RPi-Garage-Opener,JayJanarthanan/RPI-GARAGE,JayJanarthanan/RPi-Garage-Opener | usonic.py | usonic.py |
#!/usr/bin/python
# remember to change the GPIO values below to match your sensors
# GPIO output = the pin that's connected to "Trig" on the sensor
# GPIO input = the pin that's connected to "Echo" on the sensor
def reading(sensor):
import time
import RPi.GPIO as GPIO
# Disable any warning m... | mit | Python | |
7a7d597c771ba8100957b5ca00156d7147c695c5 | Add clear_db_es_contents tests | hms-dbmi/fourfront,hms-dbmi/fourfront,4dn-dcic/fourfront,hms-dbmi/fourfront,4dn-dcic/fourfront,4dn-dcic/fourfront,hms-dbmi/fourfront,4dn-dcic/fourfront,hms-dbmi/fourfront | src/encoded/tests/test_clear_db_es_contents.py | src/encoded/tests/test_clear_db_es_contents.py | import pytest
from encoded.commands.clear_db_es_contents import (
clear_db_tables,
run_clear_db_es
)
pytestmark = [pytest.mark.setone, pytest.mark.working]
def test_clear_db_tables(app, testapp):
# post an item and make sure it's there
post_res = testapp.post_json('/testing-post-put-patch/', {'requir... | mit | Python | |
28677132dbcacd7d348262007256b3e2a9e44da2 | add gate client module | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | server/Mars/Client/GateClient.py | server/Mars/Client/GateClient.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2016 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... | bsd-2-clause | Python | |
36fdfa89230fd08b6c28501f3f277bff642e36e3 | Create ipy_custom_action_button.py | satishgoda/learningqt,satishgoda/learningqt | pyside/pyside_basics/jamming/QAction/ipy_custom_action_button.py | pyside/pyside_basics/jamming/QAction/ipy_custom_action_button.py | from collections import OrderedDict
from functools import partial
from PySide import QtCore
from PySide import QtGui
##
class CustomAction(QtGui.QAction):
def __init__(self, message, *args, **kwargs):
super(CustomAction, self).__init__(*args, **kwargs)
self.message = message
self.triggere... | mit | Python | |
18f63b98bf7eefe3022dc4681e81ada9969d5228 | Create guess-the-word.py | tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015 | Python/guess-the-word.py | Python/guess-the-word.py | # Time: O(n^2)
# Space: O(n)
# This problem is an interactive problem new to the LeetCode platform.
#
# We are given a word list of unique words, each word is 6 letters long,
# and one word in this list is chosen as secret.
#
# You may call master.guess(word) to guess a word.
# The guessed word should have type strin... | mit | Python | |
803a2702a1330be1f51428f8d7533cfee27c3f90 | Add facebook_test_user support. | merwok-forks/facepy,buzzfeed/facepy,jwjohns/facepy,liorshahverdi/facepy,Spockuto/facepy,jgorset/facepy,jwjohns/facepy | facepy/test.py | facepy/test.py | import facepy
class FacebookTestUser(object):
def __init__(self, **kwargs):
fields = ('id', 'access_token', 'login_url', 'email', 'password')
for field in fields:
setattr(self, field, kwargs[field])
self.graph = facepy.GraphAPI(self.access_token)
class TestUserManager(object)... | mit | Python | |
332f1fc67481432f6e8dd7cd9a35b02b12c9b6f6 | Create numpy.py | ticcky/code101,ticcky/code101 | numpy.py | numpy.py | # Best dimensions in each column of a matrix x.
for i in range(x.shape[0]):
dims = x[:,i].argsort()[-5:]
vals = x[dims,i]
print dims, vals
| apache-2.0 | Python | |
4d4904e69e030be3f2b0e30c957507626d58a50e | Teste nas listas | M3nin0/supreme-broccoli,M3nin0/supreme-broccoli,M3nin0/supreme-broccoli,M3nin0/supreme-broccoli | _Listas/sherlock.py | _Listas/sherlock.py | # Quem é o culpado
perguntas = []
ct = 0
pt = 0
quest = input("Você telefonou a vitima: ")
perguntas.append(quest)
quest = input("Vocẽ esteve no local do crime: ")
perguntas.append(quest)
quest = input("Você mora perto da vitima? ")
perguntas.append(quest)
quest = input("Devia para a vitima? ")
perguntas.append(ques... | apache-2.0 | Python | |
235bfc6db908b6701de77df11e00e89a307d738e | Create tinymongo.py | jjonesAtMoog/tinymongo,schapman1974/tinymongo | tinymongo/tinymongo.py | tinymongo/tinymongo.py | mit | Python | ||
b351e5106684b0af8b862bb6ba5375671c1f431d | include getcomments.py | jaredsohn/hacker-news-download-all-comments | getcomments.py | getcomments.py | import urllib2
import json
import datetime
import time
import pytz
import pandas as pd
from pandas import DataFrame
ts = str(int(time.time()))
df = DataFrame()
hitsPerPage = 1000
requested_keys = ["author", "comment_text", "created_at_i", "objectID", "points"]
i = 0
while True:
try:
url = 'https://hn.algolia.com/... | apache-2.0 | Python | |
74ecac2dbca41d737f62325955fd4d0dc393ac16 | Rename flots.py to plots.py | whbrewer/spc,whbrewer/spc,whbrewer/spc,whbrewer/spc | plots.py | plots.py | import json
import re
class plot(object):
def get_data(self,fn,col1,col2):
y = ''
for line in open(fn, 'rU'):
# don't parse comments
if re.search(r'#',line): continue
x = line.split()
if not re.search(r'[A-Za-z]{2,}\s+[A-Za-z]{2,}',line):
... | mit | Python | |
f13da24b8fb4cf6d8fff91e88afb1507528c2c2a | Add `.ycm_extra_conf.py` for https://github.com/Valloric/ycmd | exponent/exponent,exponentjs/exponent,exponent/exponent,exponent/exponent,exponentjs/exponent,exponent/exponent,exponent/exponent,exponentjs/exponent,exponent/exponent,exponentjs/exponent,exponentjs/exponent,exponent/exponent,exponentjs/exponent,exponent/exponent,exponentjs/exponent,exponent/exponent,exponentjs/exponen... | android/.ycm_extra_conf.py | android/.ycm_extra_conf.py | import os
basePath = os.path.dirname(os.path.realpath(__file__))
def FlagsForFile(filename, **kwargs):
return {
'flags': [
'-std=c++11',
'-DFOLLY_NO_CONFIG=1',
'-DFOLLY_USE_LIBCPP',
'-I' + basePath + '/ReactAndroid/../ReactCommon/cxxreact/..',
'-I' + basePath + '/ReactAndroid/../Re... | bsd-3-clause | Python | |
654f21b39a68aa461b6457199403e7d89781cc79 | add migration | d120/pyophase,d120/pyophase,d120/pyophase,d120/pyophase | students/migrations/0010_auto_20161010_1345.py | students/migrations/0010_auto_20161010_1345.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-10 11:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('students', '0009_auto_20161005_1820'),
]
operations = [
migrations.AlterFie... | agpl-3.0 | Python | |
b90b43ceefb78e1a94ba898ed23443567786cf25 | Add /monitoring/status handler | diyan/falcon_seed | app/monitoring/handlers.py | app/monitoring/handlers.py | from __future__ import unicode_literals, absolute_import, division
import json
from structlog import get_logger
class StatusHandler:
def __init__(self):
self.logger = get_logger()
def on_get(self, req, res):
"""
@type req: falcon.request.Request
@type res: falcon.response.Res... | mit | Python | |
95c71727bf340f55e17a15d475aba54438eb0b8e | add solution for Partition List | zhyu/leetcode,zhyu/leetcode | src/partitionList.py | src/partitionList.py | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param head, a ListNode
# @param x, an integer
# @return a ListNode
def partition(self, head, x):
head1, head2 = ListNode(0), ListNode(0)
... | mit | Python | |
ef14676bd07cb53cecaaaa6cb3a0a56c248aa74d | clone for refactoring | igelbox/blender-ogf | io_scene_ogf/ogf_utils.py | io_scene_ogf/ogf_utils.py | #! /usr/bin/python
import io, struct
class Chunks:
OGF_HEADER = 0x1
OGF4_S_DESC = 0x12
OGF4_CHILDREN = 0x9
OGF4_TEXTURE = 0x2
OGF4_VERTICES = 0x3
OGF4_INDICES = 0x4
class rawr:
def __init__(self, data):
self.offs = 0
self.data = data
def read(sz=1):
... | bsd-2-clause | Python | |
5bff284204a1397dbc63e83363d865213a35efe6 | add a new test file test_begin_end.py | alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl | tests/unit/selection/modules/test_begin_end.py | tests/unit/selection/modules/test_begin_end.py | # Tai Sakuma <tai.sakuma@gmail.com>
import pytest
try:
import unittest.mock as mock
except ImportError:
import mock
from alphatwirl.selection.modules import Not, NotwCount
##__________________________________________________________________||
not_classes = [Not, NotwCount]
not_classe_ids = [c.__name__ for c ... | bsd-3-clause | Python | |
7655fe94decf2fc9c3a07104f8fa76cf39442ddb | implement rectified drive | FRC-1123/frc2017-1123,FRC-1123/frc2017-1123,FRC-1123/frc2017-1123,FRC-1123/frc2017-1123 | rectifieddrive.py | rectifieddrive.py | import navx
import subsystems
class RectifiedDrive:
"""
This class implemented the rectifiedDrive function, which sets the motor outputs
given a desired power and angular velocity using the NavX and a PID controller.
"""
def __init__(self, kp, ki, kd, period=0.05):
self.kp = kp
se... | mit | Python | |
dd1d0893823561efec203cdfbb927b8edac7a72a | Add a coupld tests to create exception classes from error code names | darjus-amzn/boto,Asana/boto,vishnugonela/boto,podhmo/boto,weebygames/boto,SaranyaKarthikeyan/boto,clouddocx/boto,bleib1dj/boto,TiVoMaker/boto,tpodowd/boto,rayluo/boto,tpodowd/boto,disruptek/boto,stevenbrichards/boto,revmischa/boto,pfhayes/boto,ekalosak/boto,ryansb/boto,shaunbrady/boto,acourtney2015/boto,alfredodeza/bot... | tests/unit/beanstalk/test_exception.py | tests/unit/beanstalk/test_exception.py | # Copyright (c) 2014 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 limitation the rights... | mit | Python | |
de38b3e7b3d8458920b913316b06bb10b886df9f | Implement ArgumentSelector for overload disambiguation | ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang | thinglang/symbols/argument_selector.py | thinglang/symbols/argument_selector.py | import collections
import copy
from thinglang.compiler.errors import NoMatchingOverload
from thinglang.lexer.values.identifier import Identifier
SymbolOption = collections.namedtuple('SymbolOption', ['symbol', 'remaining_arguments'])
class ArgumentSelector(object):
"""
Aids in disambiguating overloaded meth... | mit | Python | |
609bd2a0712ee488dd76bb3619aef70343adb304 | add test__doctests.py | lindenlab/eventlet,tempbottle/eventlet,tempbottle/eventlet,collinstocks/eventlet,lindenlab/eventlet,collinstocks/eventlet,lindenlab/eventlet | greentest/test__doctests.py | greentest/test__doctests.py | import os
import re
import doctest
import unittest
import eventlet
base = os.path.dirname(eventlet.__file__)
modules = set()
for path, dirs, files in os.walk(base):
package = 'eventlet' + path.replace(base, '').replace('/', '.')
modules.add((package, os.path.join(path, '__init__.py')))
for f in files:
... | mit | Python | |
2885adb781ba5179e0dcc7645644bcb182e7bfe7 | Create hacks/eKoomerce/__init__.py | priyamanibhat/eKoomerce,priyamanibhat/eKoomerce,priyamanibhat/eKoomerce | hacks/eKoomerce/__init__.py | hacks/eKoomerce/__init__.py | import bs4
| mit | Python | |
d9cce6f06503f1527d56d40d3037f46344c517d4 | Add PerUserData utility. | rhertzog/librement,rhertzog/librement,rhertzog/librement | src/librement/utils/user_data.py | src/librement/utils/user_data.py | from django.db import models
from django.db.models.signals import post_save, pre_delete
from django.contrib.auth.models import User
def PerUserData(related_name=None):
"""
Class factory that returns an abstract model attached to a ``User`` object
that creates and destroys concrete child instances where req... | agpl-3.0 | Python | |
e58d30a64ae2ce2962dbaaf119e5e4c4ee33e4e7 | Create pub.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | cloud/mqtt_server/pub.py | cloud/mqtt_server/pub.py | #!/usr/bin/env python
import asyncio
from hbmqtt.client import MQTTClient
from hbmqtt.mqtt.constants import QOS_0, QOS_1, QOS_2
async def publish_test():
try:
C = MQTTClient()
ret = await C.connect('mqtt://192.168.0.4:1883/')
message = await C.publish('server', 'MESSAGE-QOS_0'.encode(), qos=QOS_0)
m... | mit | Python | |
8551c56a9fea5d21ea9dc6761eff8e93d451f6b3 | Add pip setup.py | google/gin-config,google/gin-config | setup.py | setup.py | """Setup script for gin-config.
See:
https://github.com/google/gin-config
"""
import codecs
from os import path
from setuptools import find_packages
from setuptools import setup
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with codecs.open(path.join(here, 'README.md'... | apache-2.0 | Python | |
379c5e73d767753142a62ba57f5928acf754b508 | Add simple setup.py for ease of system-installing | lahwran/crow2 | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name="crow2",
version="0.1.dev0",
packages=find_packages(),
scripts=["bin/crow2"],
install_requires=["twisted", "zope.interface"]
)
| mit | Python | |
c2d14b8c3beaee3cff498fc02106751fce8e8e1c | Add setup.py | bridgewell/pb2df,jason2506/pb2df | setup.py | setup.py | import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import pb2df
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
sel... | bsd-3-clause | Python | |
a7bf54f417576bfc355e1851258e711dadd73ad3 | Add python trove classifiers | orbitvu/django-taggit,cimani/django-taggit,izquierdo/django-taggit,doselect/django-taggit,kaedroho/django-taggit,Maplecroft/django-taggit,vhf/django-taggit,7kfpun/django-taggit,nealtodd/django-taggit,laanlabs/django-taggit,kminkov/django-taggit,Eksmo/django-taggit,IRI-Research/django-taggit,guoqiao/django-taggit,tamarm... | setup.py | setup.py | from setuptools import setup, find_packages
from taggit import VERSION
f = open('README.rst')
readme = f.read()
f.close()
setup(
name='django-taggit',
version=".".join(map(str, VERSION)),
description='django-taggit is a reusable Django application for simple tagging.',
long_description=readme,
a... | from setuptools import setup, find_packages
from taggit import VERSION
f = open('README.rst')
readme = f.read()
f.close()
setup(
name='django-taggit',
version=".".join(map(str, VERSION)),
description='django-taggit is a reusable Django application for simple tagging.',
long_description=readme,
a... | bsd-3-clause | Python |
733289636661f3c0034a66eaa8763058ef43796d | update setup.py | arcturusannamalai/open-tamil,tuxnani/open-telugu,Ezhil-Language-Foundation/open-tamil,tuxnani/open-telugu,tshrinivasan/open-tamil,tuxnani/open-telugu,tshrinivasan/open-tamil,atvKumar/open-tamil,tshrinivasan/open-tamil,tshrinivasan/open-tamil,atvKumar/open-tamil,atvKumar/open-tamil,Ezhil-Language-Foundation/open-tamil,a... | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
from codecs import open
setup(name='Open-Tamil',
version='0.1-dev',
description='Tamil language text processing tools',
author='Muthiah Annamalai',
author_email='ezhillang@gmail.com',
url='https://github.com/arcturusannamalai/open-ta... | #!/usr/bin/env python
from distutils.core import setup
from codecs import open
setup(name='Open Tamil',
version='0.1-dev',
description='Tamil language text processing tools',
author='Muthiah Annamalai',
author_email='ezhillang@gmail.com',
url='https://github.com/arcturusannamalai/open-ta... | mit | Python |
231d050fe611adb201cd7ae55f52212d0b84caa1 | Check for pandoc. add pyandoc to setup_requires | djipko/sparts,facebook/sparts,djipko/sparts,fmoo/sparts,facebook/sparts,pshuff/sparts,fmoo/sparts,bboozzoo/sparts,bboozzoo/sparts,pshuff/sparts | setup.py | setup.py | from setuptools import setup, find_packages, Command
from setuptools.command.build_py import build_py as _build_py
from distutils.spawn import find_executable
import os.path
import imp
import pandoc.core
pandoc.core.PANDOC_PATH = find_executable('pandoc')
assert pandoc.core.PANDOC_PATH is not None, \
"'pandoc' is... | from setuptools import setup, find_packages, Command
from setuptools.command.build_py import build_py as _build_py
from distutils.spawn import find_executable
import os.path
import imp
import pandoc.core
pandoc.core.PANDOC_PATH = find_executable('pandoc')
ROOT = os.path.abspath(os.path.dirname(__file__))
def read(fn... | bsd-3-clause | Python |
5a16ada916d719a0499d75bc5c82aaa5228dec15 | Split off IP/hostname munging to addr_util | catap/namebench,jimmsta/namebench-1 | libnamebench/addr_util.py | libnamebench/addr_util.py | # Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | apache-2.0 | Python | |
e458733b0aa1cbb142fc6818ae1f7cf84bef6518 | Add setup | xiaohaiguicc/friendly-computing-machine | setup.py | setup.py | import setuptools
if __name__ == "__main__":
setuptools.setup(
name='friendly_computing_machine',
version="0.1.1",
description='A starting template for Python programs',
author='CHENXI CAI',
author_email='ccai28@emory.edu',
url="https://github.com/xiaohaiguicc/friend... | bsd-3-clause | Python | |
bc17ea522b0120ec7308ba0309d87b18ba9163d9 | Add setup.py | joelverhagen/PingdomBackup | setup.py | setup.py | import sys
from setuptools import setup
setup(
name='pingdombackup',
version="0.1.0",
description='Backup Pingdom logs',
long_description='Backup Pingdom result logs to a SQLite database.',
author='Joel Verhagen',
author_email='joel.verhagen@gmail.com',
install_requires=['requests>=2.1.0'],... | mit | Python | |
1dd8a34cba565f70a30a6c8ab4604a489377e752 | Add template remove script | tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes | src/utils/remove_templates.py | src/utils/remove_templates.py | def remove_templates(text):
"""Remove all text contained between '{{' and '}}', even in the case of
nested templates.
Args:
text (str): Full text of a Wikipedia article as a single string.
Returns:
str: The full text with all templates removed.
"""
start_char = 0
while '{{... | apache-2.0 | Python | |
ad714cbf92d2984c9cc855e99e31bf622c38a220 | add setup file | sigurdga/samklang-menu,sigurdga/samklang-menu | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(
name = 's7n-menu',
version = "1a1",
packages = ['s7n', 's7n.menu'],
)
| agpl-3.0 | Python | |
ff147838ce320c97c34e00be4dafb63b6d0603fc | Add setup.py | seguri/python-oneliner | setup.py | setup.py | """A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
import sys
here... | apache-2.0 | Python | |
73d9b80d6fa1cf75dba73e396d1f5d3bd4963df6 | Create setup.py | sevenbigcat/wthen | setup.py | setup.py | from distutils.core import setup
setup(
name = 'wthen',
packages = ['wthen'], # this must be the same as the name above
version = '0.1',
description = 'A simple rule engine with YAML format',
author = 'Alex Yu',
author_email = 'mltest2000@aliyun.com',
url = 'https://github.com/sevenbigcat/wthen', # use th... | mit | Python | |
62e126908e08544f8595be368d300b0abaca82d3 | support old setuptools versions | python-hyper/hyper-h2,vladmunteanu/hyper-h2,python-hyper/hyper-h2,bhavishyagopesh/hyper-h2,Kriechi/hyper-h2,vladmunteanu/hyper-h2,Kriechi/hyper-h2 | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
# Get the version
version_regex = r'__version__ = ["\']([^"\']*)["\']'
with open('h2/__init__.py', 'r') as f:
text = f.read()
match = re.s... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
# Get the version
version_regex = r'__version__ = ["\']([^"\']*)["\']'
with open('h2/__init__.py', 'r') as f:
text = f.read()
match = re.s... | mit | Python |
4d16ae6d1ad8b308c14c23e802349001b81ae461 | Add Python-based opcode enum parser | ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang | thinglang/compiler/opcodes.py | thinglang/compiler/opcodes.py | import os
import re
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ENUM_PARSER = re.compile(r'(.*)\s*?=\s*?(\d+)')
def read_opcodes():
with open(os.path.join(BASE_DIR, '..', '..', 'thingc', 'execution', 'Opcode.h')) as f:
for line in f:
if 'enum class Opcode' in line:
b... | mit | Python | |
ac823e61fd214f9818bb7a893a8ed52a3bfa3af4 | Add utils for graph visualization. | cerrno/neurokernel | neurokernel/conn_utils.py | neurokernel/conn_utils.py | #!/usr/bin/env python
import itertools
import os
import tempfile
import conn
import matplotlib.pyplot as plt
import networkx as nx
def imdisp(f):
"""
Display the specified image file using matplotlib.
"""
im = plt.imread(f)
plt.imshow(im)
plt.axis('off')
plt.draw()
return im
def... | bsd-3-clause | Python | |
e663394d1dc4de7b8e3a877f0c9870a804e804f2 | Make tests runnable from lifelines.tests | nerdless/lifelines,CamDavidsonPilon/lifelines,jstoxrocky/lifelines,wavelets/lifelines | lifelines/tests/__main__.py | lifelines/tests/__main__.py | import unittest
from . import test_suite
if __name__ == '__main__':
unittest.main(module=test_suite)
| mit | Python | |
525a8438bd601592c4f878ca5d42d3dab8943be0 | Test that specific Failures are caught before parent Failures | 0xPoly/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe | ooni/tests/test_errors.py | ooni/tests/test_errors.py | from twisted.trial import unittest
import ooni.errors
class TestErrors(unittest.TestCase):
def test_catch_child_failures_before_parent_failures(self):
"""
Verify that more specific Failures are caught first by
handleAllFailures() and failureToString().
Fails if a subclass is list... | bsd-2-clause | Python | |
90d079928eaf48e370d21417e4d6e649ec0f5f6f | Update tasks and evaluate viewports on saving | phha/taskwiki,Spirotot/taskwiki | taskwiki/taskwiki.py | taskwiki/taskwiki.py | import sys
import re
import vim
from tasklib.task import TaskWarrior, Task
# Insert the taskwiki on the python path
sys.path.insert(0, vim.eval("s:plugin_path") + '/taskwiki')
from regexp import *
from task import VimwikiTask
from cache import TaskCache
"""
How this plugin works:
1.) On startup, it reads all t... | import sys
import re
import vim
from tasklib.task import TaskWarrior, Task
# Insert the taskwiki on the python path
sys.path.insert(0, vim.eval("s:plugin_path") + '/taskwiki')
from regexp import *
from task import VimwikiTask
from cache import TaskCache
"""
How this plugin works:
1.) On startup, it reads all t... | mit | Python |
f2e9f2adbc81a37847bbe27401dd852317243486 | add a test for the session tables | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | test/sessionstest.py | test/sessionstest.py | #!/usr/bin/python2.4
#
# Copyright (c) 2004-2005 rpath, Inc.
#
import time
import testsuite
testsuite.setup()
import sqlite3
import rephelp
from mint_rephelp import MintRepositoryHelper
from mint import dbversion
from mint import sessiondb
class SessionTest(MintRepositoryHelper):
def testSessions(self):
... | apache-2.0 | Python | |
ddbfc403034c1ed98590088889687ff23f222aab | add package | EmreAtes/spack,mfherbst/spack,matthiasdiener/spack,mfherbst/spack,skosukhin/spack,krafczyk/spack,EmreAtes/spack,lgarren/spack,krafczyk/spack,matthiasdiener/spack,TheTimmy/spack,iulian787/spack,krafczyk/spack,TheTimmy/spack,iulian787/spack,skosukhin/spack,skosukhin/spack,matthiasdiener/spack,TheTimmy/spack,EmreAtes/spac... | var/spack/packages/paraview/package.py | var/spack/packages/paraview/package.py | from spack import *
class Paraview(Package):
homepage = 'http://www.paraview.org'
url = 'http://www.paraview.org/files/v4.4/ParaView-v4.4.0-source.tar.gz'
version('4.4.0', 'fa1569857dd680ebb4d7ff89c2227378', url='http://www.paraview.org/files/v4.4/ParaView-v4.4.0-source.tar.gz')
variant('python'... | lgpl-2.1 | Python | |
eb71a3d3319480b3f99cb44f934a51bfb1b5bd67 | Add abstract class for HAP channels | postlund/pyatv,postlund/pyatv | pyatv/auth/hap_channel.py | pyatv/auth/hap_channel.py | """Base class for HAP based channels (connections)."""
from abc import ABC, abstractmethod
import asyncio
import logging
from typing import Callable, Tuple, cast
from pyatv.auth.hap_pairing import PairVerifyProcedure
from pyatv.auth.hap_session import HAPSession
from pyatv.support import log_binary
_LOGGER = logging.... | mit | Python | |
5fa7514d9cf6bed319adb5f63b07c29feb5e29ea | add hex.cmdline.py3.py | TristanCavelier/notesntools,TristanCavelier/notesntools,TristanCavelier/notesntools,TristanCavelier/notesntools,TristanCavelier/notesntools | python/hex.cmdline.py3.py | python/hex.cmdline.py3.py | #!/usr/bin/env python3
# Copyright (c) 2014 Tristan Cavelier <t.cavelier@free.fr>
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as p... | mit | Python | |
0089de0eccae27bf4cd5a2f9166e8418d64171c3 | Create XOR.py | jenniferwx/Programming_Practice,jenniferwx/Programming_Practice,jenniferwx/Programming_Practice | XOR.py | XOR.py | '''
Implement XOR operation
'''
def XOR(a,b):
result = 0
power = 1
while a>0 or b>0:
m = a%2
n = b%2
if m+n==1:
result = result+power
power *=2
a = a/2
b = b/2
return result
if __name__=='__main__':
a = 123
b = 230
p... | bsd-3-clause | Python | |
bd01797f18012927202b87872dc33caf685306c0 | Add GDB plugin for printing ABC values | klkblake/abcc,klkblake/abcc,klkblake/abcc,klkblake/abcc | gdb.py | gdb.py | deadbeef = 0xdeadbeefdeadbeef
abc_any = gdb.lookup_type("union any")
def color(s, c):
return "\x1b[" + str(c) + "m" + s + "\x1b[0m"
def gray(s):
return color(s, 90)
def red(s):
return color(s, "1;31")
def p(indent, tag, value):
print(" " * indent + tag + ": " + str(value))
def print_abc(i, v):
... | bsd-3-clause | Python | |
2d320058c96f88348d8226fa4a827a6c2c973237 | Add Classical multidimensional scaling algorithm. | ntduong/ML | mds.py | mds.py | """
Simple implementation of classical MDS.
See http://www.stat.cmu.edu/~ryantibs/datamining/lectures/09-dim3-marked.pdf for more details.
"""
import numpy as np
import numpy.linalg as linalg
import matplotlib.pyplot as plt
def square_points(size):
nsensors = size**2
return np.array([(i/size, i%size) for i in range... | mit | Python | |
a78d879c9c097c32c58f5246d46a4a188b17d99c | Add workup vebose name change migration. | SaturdayNeighborhoodHealthClinic/clintools,SaturdayNeighborhoodHealthClinic/clintools,SaturdayNeighborhoodHealthClinic/clintools | workup/migrations/0002_add_verbose_names.py | workup/migrations/0002_add_verbose_names.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('workup', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='historicalworkup',
nam... | mit | Python | |
d4a87c2131c02b3638743167ce32c779ece14fd5 | Create crawlerino.py | dmahugh/crawlerino,dmahugh/crawlerino | crawlerino.py | crawlerino.py | """Simple web crawler, to be extended for various uses.
Written in Python 3, uses requests and BeautifulSoup modules.
"""
def crawler(startpage, maxpages=100, singledomain=True):
"""Crawl the web starting from specified page.
1st parameter = starting page url
maxpages = maximum number of pages to crawl
... | mit | Python | |
91facfcc42e001e2a598d6d06e55270ef9239b1d | add migration | jrsupplee/django-activity-stream,jrsupplee/django-activity-stream | actstream/migrations/0006_auto_20170329_2048.py | actstream/migrations/0006_auto_20170329_2048.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-29 20:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('actstream', '0005_auto_20161119_2211'),
]
operations = [
migrations.AddFiel... | bsd-3-clause | Python | |
1e050f30e8307a75976a52b8f1258a5b14e43733 | Add middleware for static serving | cggh/DQXServer | wsgi_static.py | wsgi_static.py | import wsgi_server
import os
from werkzeug.wsgi import SharedDataMiddleware
application = SharedDataMiddleware(wsgi_server.application, {
'/static': os.path.join(os.path.dirname(__file__), 'static')
})
| agpl-3.0 | Python | |
a086307e6aac341ed8a6596d0a05b7a8d198c7ec | Add command to dump and restore user pointers. | brainwane/zulip,dwrpayne/zulip,dotcool/zulip,nicholasbs/zulip,ikasumiwt/zulip,DazWorrall/zulip,xuanhan863/zulip,tdr130/zulip,alliejones/zulip,brainwane/zulip,vabs22/zulip,Qgap/zulip,DazWorrall/zulip,souravbadami/zulip,developerfm/zulip,mdavid/zulip,mohsenSy/zulip,rishig/zulip,shubhamdhama/zulip,kaiyuanheshang/zulip,hac... | zephyr/management/commands/dump_pointers.py | zephyr/management/commands/dump_pointers.py | from optparse import make_option
from django.core.management.base import BaseCommand
from zephyr.models import Realm, UserProfile
import simplejson
def dump():
pointers = []
for u in UserProfile.objects.select_related("user__email").all():
pointers.append((u.user.email, u.pointer))
file("dumped-poi... | apache-2.0 | Python | |
769abf579f7bd082f7c6f4295edb49b41b252bce | Add empty alembic revision | agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,lukasjuhrich/pycroft | alembic/versions/4784a128a6dd_empty_revision.py | alembic/versions/4784a128a6dd_empty_revision.py | """Empty revision
This is the empty revision that can be used as the base for future
migrations.
Initial database creation shall be done via `metadata.create_all()` and
`alembic stamp head`.
Revision ID: 4784a128a6dd
Revises:
Create Date: 2017-12-13 00:48:12.079431
"""
from alembic import op
import sqlalchemy as s... | apache-2.0 | Python | |
4bf84b05b183916fd211f77ab8099ef14c9cec06 | Update migrations | teamtaverna/core | app/timetables/migrations/0003_auto_20171107_1103.py | app/timetables/migrations/0003_auto_20171107_1103.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-11-07 11:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('timetables', '0002_auto_20171005_2209'),
]
operations = [
migrations.AlterFie... | mit | Python | |
74135b8289fa4b6684c54d8c9e37671c75b92447 | add admin for area settings | liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4 | adhocracy4/maps/admin.py | adhocracy4/maps/admin.py | from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from . import models
@admin.register(models.AreaSettings)
class AreaSettingsAdmin(admin.ModelAdmin):
list_filter = ('module__project__organisation', 'module__project')
list_display = ('module',)
fieldsets = (
... | agpl-3.0 | Python | |
2dce9ed68463b536f246f01b2ac5cb275df2453b | add polynomial | Semen52/GIBDD | regression.py | regression.py | # coding: utf8
from datetime import datetime
import itertools
import matplotlib.pyplot as plt
import numpy as np
from sklearn.preprocessing import PolynomialFeatures, Imputer
from sklearn.pipeline import make_pipeline
from sklearn.linear_model import Ridge, BayesianRidge
from utils import *
data_accidents = load_data_... | apache-2.0 | Python | |
eb91b11930319369bc9cfc3b1b15c0b92fb4d85c | Add `OrganizationOption` tests based on `ProjectOption`. | JamesMura/sentry,gencer/sentry,nicholasserra/sentry,gencer/sentry,fotinakis/sentry,looker/sentry,JackDanger/sentry,gencer/sentry,looker/sentry,fotinakis/sentry,looker/sentry,jean/sentry,daevaorn/sentry,ifduyue/sentry,beeftornado/sentry,zenefits/sentry,alexm92/sentry,mvaled/sentry,mitsuhiko/sentry,nicholasserra/sentry,z... | tests/sentry/models/test_organizationoption.py | tests/sentry/models/test_organizationoption.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from sentry.models import OrganizationOption
from sentry.testutils import TestCase
class OrganizationOptionManagerTest(TestCase):
def test_set_value(self):
OrganizationOption.objects.set_value(self.organization, 'foo', 'bar')
assert ... | bsd-3-clause | Python | |
f264f8804c208f2b55471f27f92a9e8c1ab5d778 | Test our new happenings-by-year view. | hello-base/web,hello-base/web,hello-base/web,hello-base/web | tests/correlations/test_views.py | tests/correlations/test_views.py | # -*- coding: utf-8 -*-
import datetime
import pytest
from django.core.urlresolvers import reverse
from components.people.factories import GroupFactory, IdolFactory
@pytest.mark.django_db
def test_happenings_by_year_view(client):
[GroupFactory(started=datetime.date(2013, 1, 1)) for i in xrange(5)]
response ... | apache-2.0 | Python | |
43c4595ae26a7663538e712af37553c7a64fade7 | Add a couple unit tests for teuthology.parallel | michaelsevilla/teuthology,caibo2014/teuthology,ceph/teuthology,SUSE/teuthology,SUSE/teuthology,t-miyamae/teuthology,zhouyuan/teuthology,ktdreyer/teuthology,robbat2/teuthology,yghannam/teuthology,yghannam/teuthology,dmick/teuthology,dreamhost/teuthology,zhouyuan/teuthology,dmick/teuthology,ivotron/teuthology,caibo2014/t... | teuthology/test/test_parallel.py | teuthology/test/test_parallel.py | from ..parallel import parallel
def identity(item, input_set=None, remove=False):
if input_set is not None:
assert item in input_set
if remove:
input_set.remove(item)
return item
class TestParallel(object):
def test_basic(self):
in_set = set(range(10))
with pa... | mit | Python | |
f370ee48c8aec312f9ea8a9ce1737214e51e2eaf | Disable repaint.key_mobile_sites_repaint. | hgl888/chromium-crosswalk,Chilledheart/chromium,hgl888/chromium-crosswalk,axinging/chromium-crosswalk,Just-D/chromium-1,TheTypoMaster/chromium-crosswalk,Pluto-tv/chromium-crosswalk,axinging/chromium-crosswalk,axinging/chromium-crosswalk,chuan9/chromium-crosswalk,chuan9/chromium-crosswalk,Pluto-tv/chromium-crosswalk,The... | tools/perf/benchmarks/repaint.py | tools/perf/benchmarks/repaint.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from core import perf_benchmark
from benchmarks import silk_flags
from measurements import smoothness
from telemetry import benchmark
import page_sets
cla... | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from core import perf_benchmark
from benchmarks import silk_flags
from measurements import smoothness
from telemetry import benchmark
import page_sets
cla... | bsd-3-clause | Python |
3d523bca7377c0f4c80a4f697b0c41d340eb8200 | add a command to clear the celery queue | crateio/crate.web,crateio/crate.web | crate_project/apps/crate/management/clear_celery.py | crate_project/apps/crate/management/clear_celery.py | import redis
from django.conf import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **options):
r = redis.StrictRedis(host=settings.GONDOR_REDIS_HOST, port=settings.GONDOR_REDIS_PORT, password=settings.GONDOR_REDIS_PASSWORD)
r.del... | bsd-2-clause | Python | |
33e7216ae9b367c509b5075496fce08d346743e2 | Implement channel limit | ElementalAlchemist/txircd,Heufneutje/txircd | txircd/modules/rfc/cmode_l.py | txircd/modules/rfc/cmode_l.py | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import IMode, IModuleData, Mode, ModuleData
from txircd.utils import ModeType
from zope.interface import implements
class LimitMode(ModuleData, Mode):
implements(IPlugin, IModuleData, IMode)
name = "Lim... | bsd-3-clause | Python | |
fc03641455ce005c340bdd0baf2463a7db41ba8f | test with captured packet from chrome | colinmarc/python-spdy | test/b.py | test/b.py | from spdy.connection import Connection, SERVER
b = b'\x80\x02\x00\x01\x01\x00\x01\x0e\x00\x00\x00\x01\x00\x00\x00\x00\x00\x008\xea\xdf\xa2Q\xb2b\xe0b`\x83\xa4\x17\x06{\xb8\x0bu0,\xd6\xae@\x17\xcd\xcd\xb1.\xb45\xd0\xb3\xd4\xd1\xd2\xd7\x02\xb3,\x18\xf8Ps,\x83\x9cg\xb0?\xd4=:`\x07\x81\xd5\x99\xeb@\xd4\x1b3\xf0\xa3\xe5i\x... | bsd-2-clause | Python | |
7c24ffe52fe96339d14f522dc7c67122d01cead6 | add istabular predicate | blaze/datashape,aterrel/datashape,quantopian/datashape,cowlicks/datashape,aterrel/datashape,cowlicks/datashape,cpcloud/datashape,quantopian/datashape,cpcloud/datashape,llllllllll/datashape,ContinuumIO/datashape,blaze/datashape,ContinuumIO/datashape,llllllllll/datashape | datashape/predicates.py | datashape/predicates.py | from .util import collect, remove, dshape
from .coretypes import *
# https://github.com/ContinuumIO/datashape/blob/master/docs/source/types.rst
dimension_types = (Fixed, Var, Ellipsis)
isunit = lambda x: isinstance(x, Unit)
def isdimension(ds):
""" Is a component a dimension?
>>> isdimension(Fixed(10))
... | from .util import collect, remove, dshape
from .coretypes import *
# https://github.com/ContinuumIO/datashape/blob/master/docs/source/types.rst
dimension_types = (Fixed, Var, Ellipsis)
isunit = lambda x: isinstance(x, Unit)
def isdimension(ds):
""" Is a component a dimension?
>>> isdimension(Fixed(10))
... | bsd-2-clause | Python |
3406467f3d17621d436fc05d8820e21b7399a241 | add simple depth frame network benchmark | rjw57/streamkinect2 | scripts/depth_client.py | scripts/depth_client.py | #!/usr/bin/env python
"""
Simple benchmark of how fast depth frames are delivered.
"""
import logging
import threading
import time
from tornado.ioloop import IOLoop, PeriodicCallback
from streamkinect2.server import ServerBrowser
from streamkinect2.client import Client
# Install the zmq ioloop
from zmq.eventloop imp... | bsd-2-clause | Python | |
9dd20f8361cff99329a5ab4b526e29edddac9a61 | add session.py | charlesbos/my-scripts,charlesbos/my-scripts | session.py | session.py | #!/usr/bin/python
#A quick and dirty interface to end a session
# This assumes systemd and xinitrc (for logout)
#By Charles Bos
from tkinter import *
import os
import sys
def getWm() :
args = sys.argv
if len(args) == 1 : return "-u $USER"
else : return args[1]
def runAction() :
if option.get() == 1 ... | agpl-3.0 | Python | |
c43d929f9ee2f21a7e93986171307cd0f17fa96c | add unittests of helpers | mail6543210/clime,moskytw/clime | tests/test_helper.py | tests/test_helper.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from types import BuiltinFunctionType
from clime.helper import *
class TestClimeHelper(unittest.TestCase):
def test_autotype(self):
cases = ('string', '100', '100.0', None)
answers = ('string', 100 , 100.0 , None)
for case,... | mit | Python | |
dd8496c61543b3e39c5ee3ccb8bc7b9f69e9487f | add tests for packet | kratsg/ironman | tests/test_packet.py | tests/test_packet.py | from zope.interface.verify import verifyClass, verifyObject
from ironman.packet import IPBusPacket
from ironman.interfaces import IIPbusPacket
def test_ipbus_packet_create():
obj = IPBusPacket()
assert obj is not None
def test_ipbus_packet_class_iface():
# Assure the class implements the declared interfac... | mit | Python | |
b2aace3212f51ac7db83281903e6282849a58adb | add portmanteau finder | darius/languagetoys,darius/languagetoys | portmanteau.py | portmanteau.py | """
Let's find pairs of words that blend nicely, like
book + hookup --> bookup
Strategy: given a wordlist, first remove generative affixes like un-
and -ly. Find all reasonably-long substrings of every word. Match
suffixes of candidate first words with midparts of candidate second
words.
TODO: get better at stripping... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.