commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
12afe43b0f2599b0c79fab8bb0af454ccf16e57f
gittip/orm/__init__.py
gittip/orm/__init__.py
from __future__ import unicode_literals import os from sqlalchemy import create_engine, MetaData from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, scoped_session class SQLAlchemy(object): def __init__(self): self.session = self.create_session() @property...
from __future__ import unicode_literals import os import pdb from sqlalchemy import create_engine, MetaData from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, scoped_session class Model(object): def __repr__(self): cols = self.__mapper__.c.keys() class...
Remove the convenience functions, reorganize around the SQLAlchemy class
Remove the convenience functions, reorganize around the SQLAlchemy class
Python
cc0-1.0
bountysource/www.gittip.com,eXcomm/gratipay.com,bountysource/www.gittip.com,studio666/gratipay.com,mccolgst/www.gittip.com,MikeFair/www.gittip.com,bountysource/www.gittip.com,gratipay/gratipay.com,studio666/gratipay.com,studio666/gratipay.com,gratipay/gratipay.com,MikeFair/www.gittip.com,mccolgst/www.gittip.com,mccolgs...
--- +++ @@ -1,25 +1,10 @@ from __future__ import unicode_literals import os +import pdb from sqlalchemy import create_engine, MetaData from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, scoped_session - -class SQLAlchemy(object): - def __init__(self): - s...
4e35b16b8aed2ccb9dbc34a2bb56ce129450546b
mode/formatter/format_server.py
mode/formatter/format_server.py
import socket from struct import pack, unpack import sys import autopep8 PORT = 10011 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_address = ('localhost', 10011) sock.bind(server_address) sock.listen(1) print >>sys.stderr, 'Format server up on %s port %s' % server_address while True: connection...
import socket from struct import pack, unpack import sys import autopep8 PORT = 10011 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_address = ('localhost', 10011) sock.bind(server_address) sock.listen(1) print >>sys.stderr, 'Format server up on %s port %s' % server_address while True: connection...
Fix a bug in format server not fully reading 4-byte length.
Fix a bug in format server not fully reading 4-byte length.
Python
apache-2.0
tildebyte/processing.py,mashrin/processing.py,Luxapodular/processing.py,tildebyte/processing.py,Luxapodular/processing.py,tildebyte/processing.py,mashrin/processing.py,mashrin/processing.py,jdf/processing.py,jdf/processing.py,Luxapodular/processing.py,jdf/processing.py
--- +++ @@ -13,7 +13,9 @@ while True: connection, client_address = sock.accept() try: - buf = connection.recv(4) + buf = '' + while len(buf) < 4: + buf += connection.recv(4 - len(buf)) (size,) = unpack('>i', buf) if size == -1: print >>sys.stde...
52dba233e5ca27a1f5c1152683d33037b8362c10
tests/test_visitor.py
tests/test_visitor.py
from __future__ import absolute_import from datetime import datetime import json import unittest from normalize.visitor import Visitor from testclasses import wall_one JSON_CAN_DUMP = (basestring, int, long, dict, list) class SimpleDumper(Visitor): def apply(self, value, *args): if isinstance(value, J...
Add a missing visitor test case
Add a missing visitor test case Very basic, doesn't test reduction yet.
Python
mit
tomo-otsuka/normalize,samv/normalize,hearsaycorp/normalize
--- +++ @@ -0,0 +1,29 @@ +from __future__ import absolute_import + +from datetime import datetime +import json +import unittest + +from normalize.visitor import Visitor +from testclasses import wall_one + + +JSON_CAN_DUMP = (basestring, int, long, dict, list) + + +class SimpleDumper(Visitor): + def apply(self, val...
66a8c82f43de9ff8856bdbb1cbe16bad271d81ed
tests/test_fei_tiff.py
tests/test_fei_tiff.py
"""Test FEI SEM image plugin functionality. FEI TIFFs contain metadata as ASCII plaintext at the end of the file. """ from __future__ import unicode_literals import os import numpy as np from imageio.testing import run_tests_if_main, get_test_dir, need_internet from imageio.core import get_remote_file import image...
Add tests for FEI format
Add tests for FEI format
Python
bsd-2-clause
imageio/imageio
--- +++ @@ -0,0 +1,31 @@ +"""Test FEI SEM image plugin functionality. + +FEI TIFFs contain metadata as ASCII plaintext at the end of the file. +""" +from __future__ import unicode_literals + +import os + +import numpy as np + +from imageio.testing import run_tests_if_main, get_test_dir, need_internet +from imageio.co...
22ea1609db983af84c770af5e04dc0d4c5af080f
tools/rebuild_index.py
tools/rebuild_index.py
#!/usr/bin/env python import datetime from flask_msearch import Search from cineapp import app from cineapp import models search = Search() search.init_app(app) search.create_index(models.Movie)
Add script for rebuilding FTS index
Add script for rebuilding FTS index Fixes: #116
Python
mit
ptitoliv/cineapp,ptitoliv/cineapp,ptitoliv/cineapp
--- +++ @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +import datetime +from flask_msearch import Search +from cineapp import app +from cineapp import models + +search = Search() +search.init_app(app) + +search.create_index(models.Movie)
ba16688a656b96ea263d61cc3f8b9247b832ae82
tests/test_event.py
tests/test_event.py
import unittest from event import Event class EventTest(unittest.TestCase): def test_a_listener_is_notified_when_event_is_raised(self): called = False def listener(): nonlocal called called = True event = Event() event.connect(listener) event.fire(...
Add EventTest class and a test method.
Add EventTest class and a test method.
Python
mit
bsmukasa/stock_alerter
--- +++ @@ -0,0 +1,16 @@ +import unittest +from event import Event + + +class EventTest(unittest.TestCase): + def test_a_listener_is_notified_when_event_is_raised(self): + called = False + + def listener(): + nonlocal called + called = True + + event = Event() + ev...
eb38566389d907f8a1e6070ccfa76118b7dee85c
scripts/odom_noisy.py
scripts/odom_noisy.py
#!/usr/bin/env python import rospy from nav_msgs.msg import Odometry import numpy as np from numpy.random import normal as noise from utils import quaternion_to_heading, heading_to_quaternion class NoisyOdom(object): def __init__(self): rospy.init_node('noisy_odom') self.odom = rospy.Subscriber('...
Create odom-modifier for simulating ekf noise
Create odom-modifier for simulating ekf noise
Python
mit
buckbaskin/drive_stack,buckbaskin/drive_stack,buckbaskin/drive_stack
--- +++ @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +import rospy +from nav_msgs.msg import Odometry + +import numpy as np +from numpy.random import normal as noise +from utils import quaternion_to_heading, heading_to_quaternion + +class NoisyOdom(object): + def __init__(self): + rospy.init_node('noisy_odom')...
8c6586820449bebdb5f7a686d75c9587fdbbe2b3
Lib/test/crashers/infinite_loop_re.py
Lib/test/crashers/infinite_loop_re.py
# This was taken from http://python.org/sf/1541697 # It's not technically a crasher. It may not even truly be infinite, # however, I haven't waited a long time to see the result. It takes # 100% of CPU while running this and should be fixed. import re starttag = re.compile(r'<[a-zA-Z][-_.:a-zA-Z0-9]*\s*(' r...
Add a "crasher" taken from the sgml bug report referenced in the comment
Add a "crasher" taken from the sgml bug report referenced in the comment
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
--- +++ @@ -0,0 +1,16 @@ + +# This was taken from http://python.org/sf/1541697 +# It's not technically a crasher. It may not even truly be infinite, +# however, I haven't waited a long time to see the result. It takes +# 100% of CPU while running this and should be fixed. + +import re +starttag = re.compile(r'<[a-z...
7cd31a93f13a49a26cb4ab44173ec38d0218456f
tests/test_dk.py
tests/test_dk.py
# coding: utf-8 # Copyright (c) 2003, Taro Ogawa. All Rights Reserved. # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved. # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation...
Add simple tests for lang_DK.py
Add simple tests for lang_DK.py
Python
lgpl-2.1
savoirfairelinux/num2words
--- +++ @@ -0,0 +1,37 @@ +# coding: utf-8 +# Copyright (c) 2003, Taro Ogawa. All Rights Reserved. +# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved. + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as publish...
36fd9a3bcbd84e6917e66a40df752084a818c83c
sockets/server_web.py
sockets/server_web.py
# A basic web server using sockets import socket PORT = 8092 MAX_OPEN_REQUESTS = 5 def process_client(clientsocket): print(clientsocket) print(clientsocket.recv(1024)) web_contents = "<h1>Received</h1>" web_headers = "HTTP/1.1 200" web_headers += "\n" + "Content-Type: text/html" web_headers ...
Add basic web server using directly TCP sockets
Add basic web server using directly TCP sockets
Python
mit
acs/python-red,acs/python-red
--- +++ @@ -0,0 +1,41 @@ +# A basic web server using sockets + + +import socket + +PORT = 8092 +MAX_OPEN_REQUESTS = 5 + +def process_client(clientsocket): + print(clientsocket) + print(clientsocket.recv(1024)) + web_contents = "<h1>Received</h1>" + web_headers = "HTTP/1.1 200" + web_headers += "\n" + "...
d9e880f76e5b627455056becb3981b5492c7a947
parse-zmmailbox-ids.py
parse-zmmailbox-ids.py
import re import sys # $ zmmailbox -z -m username@domain.tld search -l 200 "in:/inbox (before:today)" # num: 200, more: true # # Id Type From Subject Date # ------- ---- -------------------- -------------------------------------------------...
Add parser of 'zmmailbox search' output
Add parser of 'zmmailbox search' output
Python
apache-2.0
hgdeoro/zimbra7-to-zimbra8-password-migrator
--- +++ @@ -0,0 +1,43 @@ +import re +import sys + +# $ zmmailbox -z -m username@domain.tld search -l 200 "in:/inbox (before:today)" +# num: 200, more: true +# +# Id Type From Subject Date +# ------- ---- -------------------- --------------...
c2da2500693105f0ce7c0e6430489d6b8d780bbf
preprocess_birdclef.py
preprocess_birdclef.py
import numpy as np np.random.seed(1337) import xml.etree.ElementTree as ET import glob import csv import os import shutil import tqdm from bird import preprocessing as pp # Settings segment_size_seconds = 3 # Paths xml_paths = glob.glob("datasets/birdClef2016/xml/*.xml") source_dir = "./datasets/birdClef2016/wav" p...
Add preprocessing script for birdclef data
Add preprocessing script for birdclef data
Python
mit
johnmartinsson/bird-species-classification,johnmartinsson/bird-species-classification
--- +++ @@ -0,0 +1,49 @@ +import numpy as np +np.random.seed(1337) + +import xml.etree.ElementTree as ET +import glob +import csv +import os +import shutil +import tqdm +from bird import preprocessing as pp + + +# Settings +segment_size_seconds = 3 + +# Paths +xml_paths = glob.glob("datasets/birdClef2016/xml/*.xml") ...
948eced60d8c97535cf98422a8242fa12cdd502c
backend/scripts/new-samples/search.py
backend/scripts/new-samples/search.py
#!/usr/bin/env python import rethinkdb as r from optparse import OptionParser import sys import json def main(conn): value = list(r.table("samples") .eq_join("id", r.table("sample2attribute_set"), index="sample_id") .zip() .merge(lambda...
Add python code to conduct queries.
Add python code to conduct queries.
Python
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +import rethinkdb as r +from optparse import OptionParser +import sys +import json + + +def main(conn): + value = list(r.table("samples") + .eq_join("id", r.table("sample2attribute_set"), + index="sample_id") + ...
29b785da5882000758532e1467b5b7f10645193b
collect_cache_statistics.py
collect_cache_statistics.py
# Lab1 exercise 3. # # Setups the cache and runs the benchmark. You should have the benchmark # breakpointed to the magic breakpoint in your Simics configuration. Run with # something like: # # ./simics -stall -no-stc -c vortex.conf -no-win -q -p collect_cache_statistics.py conf.cpu0_0.instruction_fetch_mode = "instru...
Add script for collecting cache statistics
Add script for collecting cache statistics
Python
mit
myrjola/comparch_labs,myrjola/comparch_labs,myrjola/comparch_labs,myrjola/comparch_labs
--- +++ @@ -0,0 +1,38 @@ +# Lab1 exercise 3. +# +# Setups the cache and runs the benchmark. You should have the benchmark +# breakpointed to the magic breakpoint in your Simics configuration. Run with +# something like: +# +# ./simics -stall -no-stc -c vortex.conf -no-win -q -p collect_cache_statistics.py + +conf.cpu...
485b45333d1f3c21accfd074e75253073c37d60c
strings/palindrome/python/palindrome2.py
strings/palindrome/python/palindrome2.py
#We check if a string is palindrome or not using slicing #Accept a string input inputString = input("Enter any string:") #Caseless Comparison inputString = inputString.casefold() #check if the string is equal to its reverse if inputString == inputString[::-1]: print("Congrats! You typed in a PALINDROME!!") else: ...
Add an alternativie Python palindrome check
Add an alternativie Python palindrome check
Python
cc0-1.0
ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs...
--- +++ @@ -0,0 +1,13 @@ +#We check if a string is palindrome or not using slicing + +#Accept a string input +inputString = input("Enter any string:") + +#Caseless Comparison +inputString = inputString.casefold() + +#check if the string is equal to its reverse +if inputString == inputString[::-1]: + print("Congrats...
be6e9ab206deaa4f114e4c8901100c12533be532
client/examples/record_camera_trajectory.py
client/examples/record_camera_trajectory.py
import sys, atexit, argparse, json, time sys.path.append('..') import ue4cv trajectory = [] def message_handler(message): if message == 'clicked': rot = [float(v) for v in ue4cv.client.request('vget /camera/0/rotation').split(' ')] loc = [float(v) for v in ue4cv.client.request('vget /camera/0/loca...
Add a script to record camera trajectory.
Add a script to record camera trajectory.
Python
mit
qiuwch/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv
--- +++ @@ -0,0 +1,29 @@ +import sys, atexit, argparse, json, time +sys.path.append('..') +import ue4cv + +trajectory = [] + +def message_handler(message): + if message == 'clicked': + rot = [float(v) for v in ue4cv.client.request('vget /camera/0/rotation').split(' ')] + loc = [float(v) for v in ue4c...
d3c373ee886c78fe80494efdc088a099aa949655
account/management/commands/create_signups.py
account/management/commands/create_signups.py
# coding=utf8 from __future__ import print_function from django.core.management.base import BaseCommand, CommandError from django.contrib.sites.models import Site from django.core import urlresolvers from account.models import SignupCode class Command(BaseCommand): args = '<count> <filename> [<expiry_in_days_fr...
Add create signups management command that will create a batch of signup codes and output to a file
Add create signups management command that will create a batch of signup codes and output to a file
Python
mit
ntucker/django-user-accounts,ntucker/django-user-accounts
--- +++ @@ -0,0 +1,24 @@ +# coding=utf8 +from __future__ import print_function + +from django.core.management.base import BaseCommand, CommandError +from django.contrib.sites.models import Site +from django.core import urlresolvers + +from account.models import SignupCode + +class Command(BaseCommand): + args = '...
a60f858598a5b74ffa0238966249bbde612c2f70
HackerRank/ProjectEuler_plus/euler_021.py
HackerRank/ProjectEuler_plus/euler_021.py
#!/usr/bin/env python3 from math import sqrt def factors(n): results = set() for i in range(1, int(sqrt(n)) + 1): if n % i == 0: results.add(i) results.add(int(n / i)) return sum(results) amicables = [220, 1184, 2620, 5020, 6232, 10744, 12285, 17296, 63020, 66928, 67095, 69...
Add project euler plus 21
Add project euler plus 21
Python
mit
byung-u/ProjectEuler
--- +++ @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +from math import sqrt + +def factors(n): + results = set() + for i in range(1, int(sqrt(n)) + 1): + if n % i == 0: + results.add(i) + results.add(int(n / i)) + return sum(results) + +amicables = [220, 1184, 2620, 5020, 6232, 10744...
90a43f24beae71c6c10b47e8a62f40a572f42d9c
scripts/rostype.py
scripts/rostype.py
''' @returns(type) def function_to_modify(): ... This will return the value from the function if it is an instance of the type passed into the returns. Otherwise it will throw a TypeError The function modified with the decorator will also have a property return_type that gives the class that is guarunteed (neglectin...
Create decorator that forces a return type
Create decorator that forces a return type This will either return the value for the given function, or throw an error if it tries to return a value that is not the proper type I am using this to enforce a return type on service proxies being used as callables, which, at least in Python, don't have a definite return ...
Python
mit
buckbaskin/drive_stack,buckbaskin/drive_stack,buckbaskin/drive_stack
--- +++ @@ -0,0 +1,42 @@ +''' +@returns(type) +def function_to_modify(): + ... + +This will return the value from the function if it is an instance +of the type passed into the returns. Otherwise it will +throw a TypeError + +The function modified with the decorator will also have a property +return_type that gives t...
299a4356d49e9b694c1fb6340cda2669e8e30377
api/check_examples.py
api/check_examples.py
#! /usr/bin/env python import sys def import_error(module, package, debian, error): sys.stderr.write(( "Error importing %(module)s: %(error)r\n" "To install %(module)s run:\n" " pip install %(package)s\n" "or on Debian run:\n" " sudo apt-get install python-%(debian)s\n" ...
Add script to check that the example responses in the swagger matches the examples.
Add script to check that the example responses in the swagger matches the examples.
Python
apache-2.0
matrix-org/matrix-doc,matrix-org/matrix-doc,matrix-org/matrix-doc,matrix-org/matrix-doc
--- +++ @@ -0,0 +1,75 @@ +#! /usr/bin/env python + +import sys + +def import_error(module, package, debian, error): + sys.stderr.write(( + "Error importing %(module)s: %(error)r\n" + "To install %(module)s run:\n" + " pip install %(package)s\n" + "or on Debian run:\n" + " sudo ...
d8d6c37293fc2a4963c83c6c34ff92a103c40334
tests/test_decompiler.py
tests/test_decompiler.py
import os import angr test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')) def test_decompiling_all_x86_64(): bin_path = os.path.join(test_location, "x86_64", "all") p = angr.Project(bin_path, auto_load_libs=False) cfg = p.analyses.CFG(collect...
Add a test for the decompiler analysis.
Add a test for the decompiler analysis.
Python
bsd-2-clause
iamahuman/angr,iamahuman/angr,schieb/angr,angr/angr,angr/angr,iamahuman/angr,schieb/angr,angr/angr,schieb/angr
--- +++ @@ -0,0 +1,23 @@ + +import os + +import angr + +test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')) + + +def test_decompiling_all_x86_64(): + bin_path = os.path.join(test_location, "x86_64", "all") + p = angr.Project(bin_path, auto_load_libs=Fa...
c5b335500ab326b225626927ebadf5c584f58ac4
tests/unit/test_files.py
tests/unit/test_files.py
from isort import files from isort.settings import DEFAULT_CONFIG def test_find(tmpdir): tmp_file = tmpdir.join("file.py") tmp_file.write("import os, sys\n") assert tuple(files.find((tmp_file,), DEFAULT_CONFIG, [], [])) == (tmp_file,)
Add test for new files module
Add test for new files module
Python
mit
PyCQA/isort,PyCQA/isort
--- +++ @@ -0,0 +1,8 @@ +from isort import files +from isort.settings import DEFAULT_CONFIG + + +def test_find(tmpdir): + tmp_file = tmpdir.join("file.py") + tmp_file.write("import os, sys\n") + assert tuple(files.find((tmp_file,), DEFAULT_CONFIG, [], [])) == (tmp_file,)
3dad0c186250f1ceb01be0a9dcae0831ef44d874
test/test_password.py
test/test_password.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2015-2017: # Matthieu Estrada, ttamalfor@gmail.com # # This file is part of (AlignakApp). # # (AlignakApp) 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 Sof...
Add Unit Tests for PasswordDialog
Add Unit Tests for PasswordDialog
Python
agpl-3.0
Alignak-monitoring-contrib/alignak-app,Alignak-monitoring-contrib/alignak-app
--- +++ @@ -0,0 +1,82 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright (c) 2015-2017: +# Matthieu Estrada, ttamalfor@gmail.com +# +# This file is part of (AlignakApp). +# +# (AlignakApp) is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public L...
fe5a0508f97326e0be4fddca5db65a655607c2f9
examples/rate_limit_handling.py
examples/rate_limit_handling.py
import tweepy consumer_key = "" consumer_secret = "" access_token = "" access_token_secret = "" auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) # Setting wait_on_rate_limit to True when initializing API will initialize an # instance, called api here...
Add rate limit handling example
Add rate limit handling example
Python
mit
svven/tweepy,tweepy/tweepy
--- +++ @@ -0,0 +1,24 @@ +import tweepy + + +consumer_key = "" +consumer_secret = "" +access_token = "" +access_token_secret = "" + +auth = tweepy.OAuthHandler(consumer_key, consumer_secret) +auth.set_access_token(access_token, access_token_secret) + +# Setting wait_on_rate_limit to True when initializing API will in...
afadff60dfe8479196b77a86e058e412f42ef5ba
kubernetes/examples/kubeclient_simple.py
kubernetes/examples/kubeclient_simple.py
#!/usr/bin/env python from kubernetes import client, config, watch config.load_kube_config() v1 = client.CoreV1Api() # watch on pods in all namespaces. w = watch.Watch() for event in w.stream(v1.list_pod_for_all_namespaces): print("Event: %s %s %s" % (event['type'], event['object'].kind, event...
Add a simple example of a python kubernetes client
Add a simple example of a python kubernetes client
Python
apache-2.0
bdastur/notes,bdastur/notes,bdastur/notes,bdastur/notes,bdastur/notes,bdastur/notes
--- +++ @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +from kubernetes import client, config, watch + +config.load_kube_config() + +v1 = client.CoreV1Api() + +# watch on pods in all namespaces. +w = watch.Watch() +for event in w.stream(v1.list_pod_for_all_namespaces): + print("Event: %s %s %s" % (event['type'], + ...
db02ae80c04023cb4d984f5df6932aaca7948588
examples/image_fromarray.py
examples/image_fromarray.py
"""Create a nifti image from a numpy array and an affine transform.""" from os import path import numpy as np from neuroimaging.core.api import fromarray, save_image, load_image, \ Affine, CoordinateMap # Imports used just for development and testing. User's typically # would not uses these when creating an im...
Add example for creating an image from an array and an affine.
Add example for creating an image from an array and an affine.
Python
bsd-3-clause
arokem/nipy,alexis-roche/nireg,arokem/nipy,alexis-roche/register,bthirion/nipy,alexis-roche/nireg,alexis-roche/nipy,alexis-roche/niseg,nipy/nireg,nipy/nipy-labs,bthirion/nipy,nipy/nipy-labs,alexis-roche/nipy,alexis-roche/register,bthirion/nipy,arokem/nipy,arokem/nipy,alexis-roche/register,alexis-roche/niseg,alexis-roch...
--- +++ @@ -0,0 +1,63 @@ +"""Create a nifti image from a numpy array and an affine transform.""" + +from os import path + +import numpy as np + +from neuroimaging.core.api import fromarray, save_image, load_image, \ + Affine, CoordinateMap + +# Imports used just for development and testing. User's typically +# wo...
49af609f3fe3440cfff8ec00b42934530bbea3f9
bankinate.py
bankinate.py
import requests from bs4 import BeautifulSoup username = raw_input('Enter your username: ') print username payload = {'UserName': username, 'input': 'Go'} r = requests.post("https://online.bbt.com/auth/pwd.tb", data = payload) print (r.text)
Send request for bbt username
Send request for bbt username
Python
mit
GTmmiller/bankinator
--- +++ @@ -0,0 +1,10 @@ +import requests +from bs4 import BeautifulSoup + +username = raw_input('Enter your username: ') +print username +payload = {'UserName': username, 'input': 'Go'} +r = requests.post("https://online.bbt.com/auth/pwd.tb", data = payload) + +print (r.text) +
99ca3372ceaaa28e9e925b86a9b8de3a3735b1df
notifications/district_points_updated.py
notifications/district_points_updated.py
from consts.district_type import DistrictType from consts.notification_type import NotificationType from notifications.base_notification import BaseNotification class DistrictPointsUpdatedNotification(BaseNotification): # disrict_key is like <year><enum> # Example: 2014ne def __init__(self, district_key)...
Add notification for district points being updated
Add notification for district points being updated
Python
mit
the-blue-alliance/the-blue-alliance,bvisness/the-blue-alliance,the-blue-alliance/the-blue-alliance,bvisness/the-blue-alliance,the-blue-alliance/the-blue-alliance,bdaroz/the-blue-alliance,fangeugene/the-blue-alliance,1fish2/the-blue-alliance,jaredhasenklein/the-blue-alliance,verycumbersome/the-blue-alliance,tsteward/the...
--- +++ @@ -0,0 +1,20 @@ +from consts.district_type import DistrictType +from consts.notification_type import NotificationType +from notifications.base_notification import BaseNotification + + +class DistrictPointsUpdatedNotification(BaseNotification): + + # disrict_key is like <year><enum> + # Example: 2014ne ...
7bddc0bc8cd9d5f9a4024b45aaae81b6aa840606
data/management/commands/approve_facilities.py
data/management/commands/approve_facilities.py
""" Bulk creation does not call a model's save method Thus, some side effects such as approvals, regulation that are supposed to take place in the save method are not effected. This command is a work around for ensuring those side effects are performed on the facilities. """ from django.core.management import BaseComm...
Add helper command for approving facilities
Add helper command for approving facilities
Python
mit
MasterFacilityList/mfl_api,MasterFacilityList/mfl_api,MasterFacilityList/mfl_api,MasterFacilityList/mfl_api,MasterFacilityList/mfl_api
--- +++ @@ -0,0 +1,21 @@ +""" +Bulk creation does not call a model's save method + +Thus, some side effects such as approvals, regulation that are supposed +to take place in the save method are not effected. +This command is a work around for ensuring those side effects are +performed on the facilities. +""" +from dj...
e4e3d9eb5a29b8917053cd506ec025b28363d27b
cltk/tokenize/utils.py
cltk/tokenize/utils.py
""" Tokenization utilities """ __author__ = ['Patrick J. Burns <patrick@diyclassics.org>'] __license__ = 'MIT License.' import pickle from abc import abstractmethod from nltk.tokenize.punkt import PunktSentenceTokenizer, PunktTrainer from nltk.tokenize.punkt import PunktLanguageVars from cltk.corpus.latin.readers i...
Add utilities file for tokenize
Add utilities file for tokenize
Python
mit
cltk/cltk,kylepjohnson/cltk,TylerKirby/cltk,diyclassics/cltk,D-K-E/cltk,TylerKirby/cltk
--- +++ @@ -0,0 +1,70 @@ +""" Tokenization utilities +""" + +__author__ = ['Patrick J. Burns <patrick@diyclassics.org>'] +__license__ = 'MIT License.' + +import pickle +from abc import abstractmethod + +from nltk.tokenize.punkt import PunktSentenceTokenizer, PunktTrainer +from nltk.tokenize.punkt import PunktLanguage...
34fe8eb97ccbdcc703293d6241c68bac03d3f531
db/migrations/migration2.py
db/migrations/migration2.py
#!/usr/bin/env python # # This library is free software, distributed under the terms of # the GNU Lesser General Public License Version 3, or any later version. # See the COPYING file included in this archive # # The docstrings in this module contain epytext markup; API documentation # may be created by processing this...
Add deleted column to products table migration
Add deleted column to products table migration
Python
mit
mirrax/OpenBazaar,STRML/OpenBazaar,akhavr/OpenBazaar,matiasbastos/OpenBazaar,bglassy/OpenBazaar,saltduck/OpenBazaar,bankonme/OpenBazaar,akhavr/OpenBazaar,blakejakopovic/OpenBazaar,im0rtel/OpenBazaar,dlcorporation/openbazaar,must-/OpenBazaar,bglassy/OpenBazaar,atsuyim/OpenBazaar,dionyziz/OpenBazaar,STRML/OpenBazaar,tort...
--- +++ @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# +# This library is free software, distributed under the terms of +# the GNU Lesser General Public License Version 3, or any later version. +# See the COPYING file included in this archive +# +# The docstrings in this module contain epytext markup; API documentation +...
8c280ce30db32b6c8fc6f6b551b5c8fc72990b09
pyQuantuccia/tests/test_get_holiday_date.py
pyQuantuccia/tests/test_get_holiday_date.py
from pyQuantuccia import quantuccia def test_get_holiday_date(): """ At the moment the only thing this function can do is return NULL. """ assert(quantuccia.get_holiday_date() is None)
Add a very simple test.
Add a very simple test.
Python
bsd-3-clause
jwg4/pyQuantuccia,jwg4/pyQuantuccia
--- +++ @@ -0,0 +1,7 @@ +from pyQuantuccia import quantuccia + +def test_get_holiday_date(): + """ At the moment the only thing this function + can do is return NULL. + """ + assert(quantuccia.get_holiday_date() is None)
598911ebd93085926602a26e9bbf835df0bea0b6
test/test_rcsparse.py
test/test_rcsparse.py
import unittest from rcsparse import rcsfile from os.path import dirname, join REV_NUMBER = 0 REV_STATE = 3 class Test(unittest.TestCase): def test_rcsfile(self): f = rcsfile(join(dirname(__file__), 'data', 'patch-copyin_c,v')) self.assertEquals(f.head, '1.1') self.assertEquals(f.revs[f.h...
Add a test case for Simon Schubert's rcsparse library
Add a test case for Simon Schubert's rcsparse library
Python
isc
ustuehler/git-cvs,ustuehler/git-cvs
--- +++ @@ -0,0 +1,17 @@ +import unittest +from rcsparse import rcsfile +from os.path import dirname, join + +REV_NUMBER = 0 +REV_STATE = 3 + +class Test(unittest.TestCase): + + def test_rcsfile(self): + f = rcsfile(join(dirname(__file__), 'data', 'patch-copyin_c,v')) + self.assertEquals(f.head, '1.1...
e81d5778ed5f81d5d479bf828de1a854c24af75e
tests/test_domains.py
tests/test_domains.py
import unittest import subprocess import random class DomainsTest(unittest.TestCase): def _cmd(self, cmd, *args): pargs = ('scripts/cli53', cmd) + args return subprocess.check_output(pargs, stderr=subprocess.STDOUT) def _unique_name(self): return 'temp%d.com' % random.randint(0...
import unittest import subprocess import random # copied from python 2.7 for python 2.6 def check_output(*popenargs, **kwargs): if 'stdout' in kwargs: raise ValueError('stdout argument not allowed, it will be overridden.') process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs) out...
Fix tests on python 2.6
Fix tests on python 2.6
Python
mit
branall1/cli53,ftahmed/cli53,branall1/cli53,Collaborne/cli53,branall1/cli53,ftahmed/cli53,jefflaplante/cli53,Collaborne/cli53,jefflaplante/cli53
--- +++ @@ -2,10 +2,24 @@ import subprocess import random +# copied from python 2.7 for python 2.6 +def check_output(*popenargs, **kwargs): + if 'stdout' in kwargs: + raise ValueError('stdout argument not allowed, it will be overridden.') + process = subprocess.Popen(stdout=subprocess.PIPE, *popenarg...
5c047b97f2e41b51f8314f6ee06788b1d9246dbf
tests/float/math_fun_special.py
tests/float/math_fun_special.py
# test the special functions imported from math try: from math import * except ImportError: print("SKIP") import sys sys.exit() test_values = [-8., -2.5, -1, -0.5, 0.0, 0.5, 2.5, 8.,] pos_test_values = [0.001, 0.1, 0.5, 1.0, 1.5, 10.,] functions = [ ('erf', erf, test_values), ('erfc', erfc, t...
Add test for math special functions.
tests: Add test for math special functions.
Python
mit
redbear/micropython,cnoviello/micropython,kostyll/micropython,adafruit/circuitpython,ericsnowcurrently/micropython,feilongfl/micropython,chrisdearman/micropython,noahchense/micropython,puuu/micropython,feilongfl/micropython,trezor/micropython,praemdonck/micropython,KISSMonX/micropython,cwyark/micropython,tralamazza/mic...
--- +++ @@ -0,0 +1,23 @@ +# test the special functions imported from math + +try: + from math import * +except ImportError: + print("SKIP") + import sys + sys.exit() + +test_values = [-8., -2.5, -1, -0.5, 0.0, 0.5, 2.5, 8.,] +pos_test_values = [0.001, 0.1, 0.5, 1.0, 1.5, 10.,] + +functions = [ + ('erf'...
96dce6296c238eaab42798c0b8a99fae3c30958f
test/test_Datac.py
test/test_Datac.py
# -*- coding: utf-8 -*- import unittest import datac class Instantiation(unittest.TestCase): """ Test instantiation works according to spec """ def test_params_non_dict(self): """ Datac instantiation should fail is params is not a dict """ params = None abscissae...
Add some tests of instantiation
Add some tests of instantiation
Python
mit
jrsmith3/datac,jrsmith3/datac
--- +++ @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +import unittest +import datac + +class Instantiation(unittest.TestCase): + """ + Test instantiation works according to spec + """ + def test_params_non_dict(self): + """ + Datac instantiation should fail is params is not a dict + """ ...
81ae4a91b2dddaf64f7d722971224acb5682de67
examples/flowy_workflows/not_found_act.py
examples/flowy_workflows/not_found_act.py
from flowy import Workflow, ActivityProxy, WorkflowProxy from flowy import make_config, workflow_config @workflow_config('SimpleWorkflow', 2, 'constant_list', 60, 60) class SimpleWorkflow(Workflow): """ Does nothing """ div = ActivityProxy( name='InexistentActivity', version=1, ...
Add wf for inexistent activity
Add wf for inexistent activity
Python
mit
severb/flowy
--- +++ @@ -0,0 +1,37 @@ +from flowy import Workflow, ActivityProxy, WorkflowProxy +from flowy import make_config, workflow_config + + +@workflow_config('SimpleWorkflow', 2, 'constant_list', 60, 60) +class SimpleWorkflow(Workflow): + """ + Does nothing + + """ + div = ActivityProxy( + name='Inexist...
b1e7846b77a8260079632804d4628352e532bd42
src/data_set_builder/get_demographics.py
src/data_set_builder/get_demographics.py
from sqlalchemy.orm import sessionmaker # scraping modules from scrapy.crawler import CrawlerProcess, Crawler from demographic_scraper.demographic_scraper.spiders.alexa_spider import AlexaSpider from scrapy.utils.project import get_project_settings from models import db_connect, WebsitesContent def main(): """I...
Add script to fetch demographics.
Add script to fetch demographics.
Python
mit
piatra/ssl-project
--- +++ @@ -0,0 +1,39 @@ +from sqlalchemy.orm import sessionmaker + +# scraping modules +from scrapy.crawler import CrawlerProcess, Crawler +from demographic_scraper.demographic_scraper.spiders.alexa_spider import AlexaSpider +from scrapy.utils.project import get_project_settings + +from models import db_connect, Web...
03e494dda74ca6bd7efb43e77b2b0de80e7cba4e
osf/migrations/0097_auto_20180503_0947.py
osf/migrations/0097_auto_20180503_0947.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.11 on 2018-05-03 14:47 from __future__ import unicode_literals from django.db import migrations from django.contrib.auth.models import Permission from osf.models import OSFUser # Old permission groups add_preprintservice = Permission.objects.get(codename='add_preprin...
Add a data migration for adding the users from the old preprintservice permissions to the newly named preprint permissions.
Add a data migration for adding the users from the old preprintservice permissions to the newly named preprint permissions.
Python
apache-2.0
felliott/osf.io,adlius/osf.io,felliott/osf.io,baylee-d/osf.io,mattclark/osf.io,CenterForOpenScience/osf.io,saradbowman/osf.io,mfraezz/osf.io,cslzchen/osf.io,brianjgeiger/osf.io,Johnetordoff/osf.io,CenterForOpenScience/osf.io,baylee-d/osf.io,Johnetordoff/osf.io,baylee-d/osf.io,mfraezz/osf.io,aaxelb/osf.io,felliott/osf.i...
--- +++ @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.11 on 2018-05-03 14:47 +from __future__ import unicode_literals + +from django.db import migrations +from django.contrib.auth.models import Permission +from osf.models import OSFUser + +# Old permission groups +add_preprintservice = Permiss...
5d773799784ab945bb4cd9ae66042d13890be3b6
ocradmin/core/templatetags/formatattr.py
ocradmin/core/templatetags/formatattr.py
import re from django.template import Library from django.conf import settings register = Library() @register.filter def formatattr(value): """Formats an object's nested attribute for display""" value = value.split(".")[-1] return " ".join([p.capitalize() for p in value.split("_")])
Add a template tag for pretty printing nested attr names
Add a template tag for pretty printing nested attr names
Python
apache-2.0
vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium
--- +++ @@ -0,0 +1,12 @@ +import re +from django.template import Library +from django.conf import settings + +register = Library() + +@register.filter +def formatattr(value): + """Formats an object's nested attribute for display""" + value = value.split(".")[-1] + return " ".join([p.capitalize() for p in val...
effc09edd607d7975a01b3652b4932e40fb0f7f9
bin/combine-examples.py
bin/combine-examples.py
#!/usr/bin/python import re import sys def main(argv): examples = {} requires = set() for filename in argv[1:]: lines = open(filename).readlines() if len(lines) > 0 and lines[0].startswith('// NOCOMPILE'): continue requires.update(line for line in lines if line.startsw...
Add script to combine examples
Add script to combine examples
Python
bsd-2-clause
kkuunnddaannkk/ol3,landonb/ol3,pmlrsg/ol3,tamarmot/ol3,elemoine/ol3,alexbrault/ol3,Distem/ol3,t27/ol3,Andrey-Pavlov/ol3,bogdanvaduva/ol3,fblackburn/ol3,jacmendt/ol3,bogdanvaduva/ol3,ahocevar/ol3,Distem/ol3,thhomas/ol3,jmiller-boundless/ol3,klokantech/ol3raster,geekdenz/openlayers,stweil/openlayers,antonio83moura/ol3,al...
--- +++ @@ -0,0 +1,27 @@ +#!/usr/bin/python + +import re +import sys + + +def main(argv): + examples = {} + requires = set() + for filename in argv[1:]: + lines = open(filename).readlines() + if len(lines) > 0 and lines[0].startswith('// NOCOMPILE'): + continue + requires.upda...
f2bf31385f9a2969ed7a1f1f082ade54c4d3a72b
dataactcore/migrations/versions/c3a3389bda57_merge_9dded_5c594.py
dataactcore/migrations/versions/c3a3389bda57_merge_9dded_5c594.py
"""Merge 9dded 5c594 Revision ID: c3a3389bda57 Revises: 9dded6e6bf79, 5c594d23709b Create Date: 2016-11-04 15:10:00.221900 """ # revision identifiers, used by Alembic. revision = 'c3a3389bda57' down_revision = ('9dded6e6bf79', '5c594d23709b') branch_labels = None depends_on = None from alembic import op import sqla...
Add merge commit for migrations
Add merge commit for migrations
Python
cc0-1.0
fedspendingtransparency/data-act-broker-backend,fedspendingtransparency/data-act-broker-backend
--- +++ @@ -0,0 +1,36 @@ +"""Merge 9dded 5c594 + +Revision ID: c3a3389bda57 +Revises: 9dded6e6bf79, 5c594d23709b +Create Date: 2016-11-04 15:10:00.221900 + +""" + +# revision identifiers, used by Alembic. +revision = 'c3a3389bda57' +down_revision = ('9dded6e6bf79', '5c594d23709b') +branch_labels = None +depends_on = ...
0cbf03210468e07ba425ff80a48a1786607b2ce6
updatorr/tracker_handlers/handler_rutor.py
updatorr/tracker_handlers/handler_rutor.py
# -*- coding: utf-8 -*- """ Created on Sat Feb 16 14:17:04 2013 @author: lucky """ from updatorr.handler_base import BaseTrackerHandler from updatorr.utils import register_tracker_handler class RutorHandler(BaseTrackerHandler): """This class implements .torrent files downloads for http://rutor.org tracker."...
Add rutor.org torrent tracker support
Add rutor.org torrent tracker support
Python
bsd-3-clause
idlesign/deluge-updatorr,idlesign/deluge-updatorr
--- +++ @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +""" +Created on Sat Feb 16 14:17:04 2013 + +@author: lucky +""" + +from updatorr.handler_base import BaseTrackerHandler +from updatorr.utils import register_tracker_handler + + +class RutorHandler(BaseTrackerHandler): + """This class implements .torrent files down...
bed4f189cd6bf9534ef152b780de0fca9e9c546a
tests/util.py
tests/util.py
from unittest import TestCase from evesrp import create_app, db class TestApp(TestCase): def setUp(self): self.app = create_app() self.app.testing = True self.app.config['SECRET_KEY'] = 'testing' self.app.config['USER_AGENT_EMAIL'] = 'testing@example.com' db.create_all(app...
from unittest import TestCase from evesrp import create_app, db class TestApp(TestCase): def setUp(self): self.app = create_app() self.app.testing = True self.app.config['SECRET_KEY'] = 'testing' self.app.config['USER_AGENT_EMAIL'] = 'testing@example.com' self.app.config['...
Disable all CSRF protection while testing
Disable all CSRF protection while testing
Python
bsd-2-clause
eskwire/evesrp,eskwire/evesrp,paxswill/evesrp,eskwire/evesrp,eskwire/evesrp,paxswill/evesrp,paxswill/evesrp
--- +++ @@ -9,4 +9,5 @@ self.app.testing = True self.app.config['SECRET_KEY'] = 'testing' self.app.config['USER_AGENT_EMAIL'] = 'testing@example.com' + self.app.config['WTF_CSRF_ENABLED'] = False db.create_all(app=self.app)
199943deb4da7c68f08f578b404dbc6208cc41ac
spacy/tests/regression/util_add_marker.py
spacy/tests/regression/util_add_marker.py
import re from pathlib import Path from typing import Optional import typer def main( filename: Path, out_file: Optional[Path] = typer.Option(None), dry_run: bool = False ): """Add pytest issue markers on regression tests If --out-file is not used, it will overwrite the original file. You can set th...
Add simple script to add pytest marks
Add simple script to add pytest marks
Python
mit
explosion/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy,honnibal/spaCy,explosion/spaCy,honnibal/spaCy,honnibal/spaCy
--- +++ @@ -0,0 +1,41 @@ +import re +from pathlib import Path +from typing import Optional + +import typer + + +def main( + filename: Path, out_file: Optional[Path] = typer.Option(None), dry_run: bool = False +): + """Add pytest issue markers on regression tests + + If --out-file is not used, it will overwri...
1342a1a6bf37018092ec949eb7476b3d8b75971c
tests/mock_api/test_mock_api_columns.py
tests/mock_api/test_mock_api_columns.py
# pylint: disable=C0103,W0232 from parameterized import parameterized, param from smartsheet.models import Column from mock_api_test_helper import MockApiTestHelper, clean_api_error class TestMockApiColumns(MockApiTestHelper): @parameterized([ param( scenario='Update Column - Change Type - Pic...
Add tests for updating column types.
Add tests for updating column types.
Python
apache-2.0
smartsheet-platform/smartsheet-python-sdk,smartsheet-platform/smartsheet-python-sdk
--- +++ @@ -0,0 +1,68 @@ +# pylint: disable=C0103,W0232 + +from parameterized import parameterized, param +from smartsheet.models import Column +from mock_api_test_helper import MockApiTestHelper, clean_api_error + +class TestMockApiColumns(MockApiTestHelper): + @parameterized([ + param( + scenar...
4223233a301657afb16536e4e589fd6ab0bec464
sparqllib/querycomponent/tests/test_triple.py
sparqllib/querycomponent/tests/test_triple.py
import unittest import sparqllib from rdflib import BNode, Literal class TestTriple(unittest.TestCase): def setUp(self): self.subject = BNode("subject") self.relation = BNode("relation") self.object = Literal("Cats") self.triple = sparqllib.Triple(self.subject, ...
Test for Triple query component
Test for Triple query component
Python
mit
ALSchwalm/sparqllib
--- +++ @@ -0,0 +1,35 @@ + +import unittest +import sparqllib +from rdflib import BNode, Literal + +class TestTriple(unittest.TestCase): + def setUp(self): + self.subject = BNode("subject") + self.relation = BNode("relation") + self.object = Literal("Cats") + self.triple = sparqllib.Tri...
fbd7da82e8231c025eaaf9dd60f94d104583c02c
crmapp/accounts/urls.py
crmapp/accounts/urls.py
from django.conf.urls import patterns, url account_urls = patterns('', url(r'^$', 'crmapp.accounts.views.account_detail', name='account_detail' ), )
from django.conf.urls import patterns, url account_urls = patterns('', url(r'^$', 'crmapp.accounts.views.account_detail', name='account_detail' ), url(r'^edit/$', 'crmapp.accounts.views.account_cru', name='account_update' ), )
Create the Account Detail Page - Part II > Edit Account - Create URL Conf
Create the Account Detail Page - Part II > Edit Account - Create URL Conf
Python
mit
tabdon/crmeasyapp,tabdon/crmeasyapp,deenaariff/Django
--- +++ @@ -5,4 +5,7 @@ url(r'^$', 'crmapp.accounts.views.account_detail', name='account_detail' ), + url(r'^edit/$', + 'crmapp.accounts.views.account_cru', name='account_update' + ), )
76afa26f17de1d10dc3f81b08182aa5febca8e8d
core/migrations/0010_auto_20210311_1521.py
core/migrations/0010_auto_20210311_1521.py
# Generated by Django 2.2.14 on 2021-03-11 15:21 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0009_auto_20200825_0800'), ] operations = [ migrations.AlterField( model_name='pin', name='referer', ...
Add migrations for url and referer length chagne
Feature: Add migrations for url and referer length chagne
Python
bsd-2-clause
pinry/pinry,pinry/pinry,pinry/pinry,pinry/pinry
--- +++ @@ -0,0 +1,23 @@ +# Generated by Django 2.2.14 on 2021-03-11 15:21 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0009_auto_20200825_0800'), + ] + + operations = [ + migrations.AlterField( + model_name=...
a7908b4f6369f5a29e72fa828aff12285e3f3d25
app/applications.py
app/applications.py
from . import data_structures # 1. Stack application def balanced_parentheses_checker(symbol_string): """Verify that a set of parentheses is balanced.""" opening_symbols = '{[(' closing_symbols = '}])' opening_symbols_stack = data_structures.Stack() symbol_count = len(symbol_string) counter =...
Apply stack in providing an efficient balanced parentheses-checker
Apply stack in providing an efficient balanced parentheses-checker
Python
mit
andela-kerinoso/data_structures_algo
--- +++ @@ -0,0 +1,32 @@ +from . import data_structures + +# 1. Stack application +def balanced_parentheses_checker(symbol_string): + """Verify that a set of parentheses is balanced.""" + + opening_symbols = '{[(' + closing_symbols = '}])' + + opening_symbols_stack = data_structures.Stack() + symbol_co...
7e2c9a4f890cdb7446b2ef892d57008c7a0eee12
django_ajax/response.py
django_ajax/response.py
# -*- coding: utf-8 -*- """ Responses """ from django.conf import settings from django.http import HttpResponse from django_ajax.utils import serialize_to_json class JSONResponse(HttpResponse): """ Return a JSON serialized HTTP response """ def __init__(self, data): """ This returns ...
# -*- coding: utf-8 -*- """ Responses """ from django.conf import settings from django.http import HttpResponse from django_ajax.utils import serialize_to_json class JSONResponse(HttpResponse): """ Return a JSON serialized HTTP response """ def __init__(self, data, *args, **kwargs): """ ...
Add parameters support for json serialize
Add parameters support for json serialize
Python
mit
furious-luke/django-ajax,furious-luke/django-ajax,yceruto/django-ajax,furious-luke/django-ajax,yceruto/django-ajax
--- +++ @@ -13,7 +13,7 @@ Return a JSON serialized HTTP response """ - def __init__(self, data): + def __init__(self, data, *args, **kwargs): """ This returns a object that we send as json content using utils.serialize_to_json, that is a wrapper to json.dumps @@ -21,7 +21,...
ab656c2101f8b8e8a9c63892a3a4d266556d2e73
pyfire/logger.py
pyfire/logger.py
# -*- coding: utf-8 -*- """ pyfire.logger ~~~~~~~~~~~~~ Use pocoo's logbook or a simple no-op fallback :copyright: (c) 2011 by the pyfire Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ try: from logbook import Logger except ImportError: class Logger(o...
Add logbook wrapper and no-op fallback
Add logbook wrapper and no-op fallback
Python
bsd-3-clause
IgnitedAndExploded/pyfire,IgnitedAndExploded/pyfire
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +""" + pyfire.logger + ~~~~~~~~~~~~~ + + Use pocoo's logbook or a simple no-op fallback + + :copyright: (c) 2011 by the pyfire Team, see AUTHORS for more details. + :license: BSD, see LICENSE for more details. +""" + +try: + from logbook import Logge...
e17e76d9576213cd6261e9781f6398ce53b8e694
uoftscrapers/scrapers/layers/__init__.py
uoftscrapers/scrapers/layers/__init__.py
import requests import json from ..scraper import Scraper class LayersScraper(Scraper): """A superclass for scraping Layers of the UofT Map. Map is located at http://map.utoronto.ca """ def __init__(self, name, output_location='.'): super().__init__(name, output_location) self.host ...
import requests import json from ..scraper import Scraper class LayersScraper(Scraper): """A superclass for scraping Layers of the UofT Map. Map is located at http://map.utoronto.ca """ def __init__(self, name, output_location='.'): super().__init__(name, output_location) self.host ...
Remove unnecessary self parameter from static method
Remove unnecessary self parameter from static method
Python
mit
kshvmdn/uoft-scrapers,g3wanghc/uoft-scrapers,cobalt-uoft/uoft-scrapers,arkon/uoft-scrapers
--- +++ @@ -29,7 +29,7 @@ return data['layers'] @staticmethod - def get_value(self, entry, val, number=False): + def get_value(entry, val, number=False): """Retrieve the desired value from the parsed response dictionary.""" if val in entry.keys():
2d9e61993bdcfb94124f7fbc4a9d76c6d85042e9
networkx_benchmark.py
networkx_benchmark.py
from __future__ import division import numpy as np import networkx as nx import sys import time import graph_util if len(sys.argv) != 2: print 'usage: ' + sys.argv[0] + ' <num vertices>' exit(1) n = int(sys.argv[1]) print 'max-flow on %d-complete graph\n' % (n) g = graph_util.complete_graph(n).to_undirected() p...
Add benchmark for networkx ford-fulkerson max-flow
Add benchmark for networkx ford-fulkerson max-flow
Python
mit
weinstein/FastMaxFlow
--- +++ @@ -0,0 +1,26 @@ +from __future__ import division +import numpy as np +import networkx as nx +import sys +import time +import graph_util + + +if len(sys.argv) != 2: + print 'usage: ' + sys.argv[0] + ' <num vertices>' + exit(1) + +n = int(sys.argv[1]) +print 'max-flow on %d-complete graph\n' % (n) + +g = gra...
ec4895d7a36a269c7be0c58899df933f2522d07f
zou/migrations/versions/fee7c696166e_.py
zou/migrations/versions/fee7c696166e_.py
"""empty message Revision ID: fee7c696166e Revises: 6bd3b102d61b Create Date: 2018-06-22 15:14:44.303391 """ from alembic import op import sqlalchemy as sa import sqlalchemy_utils from sqlalchemy.dialects import postgresql import sqlalchemy_utils import uuid # revision identifiers, used by Alembic. revision = 'fee7c...
Add migration file for event table
Add migration file for event table
Python
agpl-3.0
cgwire/zou
--- +++ @@ -0,0 +1,44 @@ +"""empty message + +Revision ID: fee7c696166e +Revises: 6bd3b102d61b +Create Date: 2018-06-22 15:14:44.303391 + +""" +from alembic import op +import sqlalchemy as sa +import sqlalchemy_utils +from sqlalchemy.dialects import postgresql +import sqlalchemy_utils +import uuid + +# revision ident...
d1b0b663ce77cae1f79c2825e9aefd9b2f61a139
_check_player_stats.py
_check_player_stats.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from operator import attrgetter from sqlalchemy import and_, String, cast from db.common import session_scope from db.player import Player from db.player_game import PlayerGame from db.player_season import PlayerSeason # TODO: command line arguments, comparison of all a...
Add initial version of checking player stats
Add initial version of checking player stats
Python
mit
leaffan/pynhldb
--- +++ @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from operator import attrgetter + +from sqlalchemy import and_, String, cast + +from db.common import session_scope +from db.player import Player +from db.player_game import PlayerGame +from db.player_season import PlayerSeason + +# TODO: com...
4e2e8d486eb58d6efd66535ce101d8f58748c851
tests/chainer_tests/functions_tests/array_tests/test_crop.py
tests/chainer_tests/functions_tests/array_tests/test_crop.py
import unittest import numpy import chainer from chainer import cuda from chainer import functions from chainer import gradient_check from chainer import testing from chainer.testing import attr class TestCrop(unittest.TestCase): axes = [1, 2] def setUp(self): self.x0_data = numpy.random.uniform(-1...
Add test for crop function
Add test for crop function
Python
mit
okuta/chainer,benob/chainer,anaruse/chainer,ktnyt/chainer,keisuke-umezawa/chainer,okuta/chainer,jnishi/chainer,delta2323/chainer,kashif/chainer,ronekko/chainer,wkentaro/chainer,chainer/chainer,ktnyt/chainer,niboshi/chainer,kikusu/chainer,jnishi/chainer,niboshi/chainer,niboshi/chainer,hvy/chainer,jnishi/chainer,jnishi/c...
--- +++ @@ -0,0 +1,63 @@ +import unittest + +import numpy + +import chainer +from chainer import cuda +from chainer import functions +from chainer import gradient_check +from chainer import testing +from chainer.testing import attr + + +class TestCrop(unittest.TestCase): + axes = [1, 2] + + def setUp(self): + ...
adcfe3e87559c5822df8d5f19f306ae320495058
example_server_login.py
example_server_login.py
from nintendo.nex import backend from nintendo.games import Friends import logging logging.basicConfig(level=logging.INFO) backend = backend.BackEndClient( Friends.ACCESS_KEY, Friends.NEX_VERSION, backend.Settings("friends.cfg") ) backend.connect("127.0.0.1", 1223) backend.login_guest() backend.close()
Add example script that logs in on custom server
Add example script that logs in on custom server
Python
mit
Kinnay/NintendoClients
--- +++ @@ -0,0 +1,14 @@ + +from nintendo.nex import backend +from nintendo.games import Friends + +import logging +logging.basicConfig(level=logging.INFO) + +backend = backend.BackEndClient( + Friends.ACCESS_KEY, Friends.NEX_VERSION, + backend.Settings("friends.cfg") +) +backend.connect("127.0.0.1", 1223) +backend.l...
72fcefaa55251d7107d4e70679094966c23a36a9
babel_util/scripts/arxivmd_to_leveldb.py
babel_util/scripts/arxivmd_to_leveldb.py
#!/usr/bin/env python3 import leveldb import msgpack import csv from util.misc import Benchmark, open_file REQUIRED_KEYS = {'title', 'paper_id', 'date'} if __name__ == "__main__": import argparse parser = argparse.ArgumentParser(description="Creates a LevelDB of TSV metadata in infile") parser.add_argumen...
Transform SQL TSV dump of arXiv MD to LevelDB
Transform SQL TSV dump of arXiv MD to LevelDB
Python
agpl-3.0
jevinw/rec_utilities,jevinw/rec_utilities
--- +++ @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +import leveldb +import msgpack +import csv +from util.misc import Benchmark, open_file + +REQUIRED_KEYS = {'title', 'paper_id', 'date'} + +if __name__ == "__main__": + import argparse + parser = argparse.ArgumentParser(description="Creates a LevelDB of TSV metad...
fedef82434f12a006e22705d1d010b31c616520c
scripts/test_generator_insert.py
scripts/test_generator_insert.py
import random n = 100 count = 0 difference = 0 keys = [] output = "" for i in xrange(n): if (random.random() < 0.4): random.shuffle(keys) for j in xrange(random.randint(0,len(keys))): key = keys.pop() output += "remove %d %d\n" % (key, len(keys)) else: chosen_key = random.randint(1, n) ...
Add a test generator python script
Add a test generator python script
Python
mit
potay/FreeTables,potay/FreeTables
--- +++ @@ -0,0 +1,21 @@ +import random + +n = 100 +count = 0 +difference = 0 +keys = [] +output = "" +for i in xrange(n): + if (random.random() < 0.4): + random.shuffle(keys) + for j in xrange(random.randint(0,len(keys))): + key = keys.pop() + output += "remove %d %d\n" % (key, len(keys)) + else: +...
ed0df2948b7d93d9c141889cc466ac0d5794f462
smarkets/hal_messenger_client.py
smarkets/hal_messenger_client.py
from __future__ import absolute_import, division, print_function, unicode_literals import logging import socket import simplejson as json log = logging.getLogger(__name__) def resolve_address_host(address): assert len(address) == 2, address return (socket.gethostbyname(address[0]), address[1]) class HalM...
Create Hal messenger UDP client
Create Hal messenger UDP client
Python
mit
smarkets/smk_python_sdk
--- +++ @@ -0,0 +1,35 @@ +from __future__ import absolute_import, division, print_function, unicode_literals + +import logging +import socket + +import simplejson as json + +log = logging.getLogger(__name__) + + +def resolve_address_host(address): + assert len(address) == 2, address + return (socket.gethostbyna...
45984e716354e2824a5199498dabefa723a6769a
neutron/tests/unit/ml2/test_type_local.py
neutron/tests/unit/ml2/test_type_local.py
# Copyright (c) 2014 Thales Services SAS # 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 r...
Add local type driver unittests
Add local type driver unittests Partial-Bug: #1269127 Change-Id: I5b34dc09128bcb879ea46be64cc5104eeefd4ab4
Python
apache-2.0
blueboxgroup/neutron,yanheven/neutron,JianyuWang/neutron,jerryz1982/neutron,projectcalico/calico-neutron,antonioUnina/neutron,gkotton/neutron,javaos74/neutron,silenci/neutron,leeseulstack/openstack,suneeth51/neutron,CiscoSystems/neutron,JianyuWang/neutron,CiscoSystems/neutron,sasukeh/neutron,vivekanand1101/neutron,yuew...
--- +++ @@ -0,0 +1,56 @@ +# Copyright (c) 2014 Thales Services SAS +# 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/l...
65cd9f228432a22e54b07f456d5c619f24a487be
erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py
erpnext/patches/v8_11/set_schedule_date_for_purchase_order.py
# Copyright (c) 2017, Frappe and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe def execute(): frappe.reload_doctype("Purchase Order") frappe.reload_doctype("Purchase Order Item") if not frappe.db.has_column("Purchase Order", "schedule_...
Add patch to update schedule date of submitted Purchase Orders
Add patch to update schedule date of submitted Purchase Orders
Python
agpl-3.0
gsnbng/erpnext,geekroot/erpnext,gsnbng/erpnext,indictranstech/erpnext,geekroot/erpnext,geekroot/erpnext,indictranstech/erpnext,gsnbng/erpnext,gsnbng/erpnext,indictranstech/erpnext,geekroot/erpnext,indictranstech/erpnext
--- +++ @@ -0,0 +1,20 @@ +# Copyright (c) 2017, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.reload_doctype("Purchase Order") + frappe.reload_doctype("Purchase Order Item") + + if not frappe.db.h...
77d155cdea473873b8e179eefa180901f12c1623
beetsplug/kodiupdate.py
beetsplug/kodiupdate.py
# -*- coding: utf-8 -*- """Updates a Kodi library whenever the beets library is changed. This is based on the Plex Update plugin. Put something like the following in your config.yaml to configure: kodi: host: localhost port: 8080 user: user pwd: secret """ from __future__ import di...
Add a plugin to update a Kodi music library
Add a plugin to update a Kodi music library I created one for an older version before, but it didn't work since the change to Python 3. So I created a new one that works.
Python
mit
beetbox/beets,beetbox/beets,ibmibmibm/beets,ibmibmibm/beets,Kraymer/beets,jackwilsdon/beets,beetbox/beets,sampsyo/beets,pkess/beets,beetbox/beets,jackwilsdon/beets,sampsyo/beets,jackwilsdon/beets,jackwilsdon/beets,SusannaMaria/beets,pkess/beets,shamangeorge/beets,SusannaMaria/beets,sampsyo/beets,shamangeorge/beets,sham...
--- +++ @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- + +"""Updates a Kodi library whenever the beets library is changed. This is based on the Plex Update plugin. + +Put something like the following in your config.yaml to configure: + kodi: + host: localhost + port: 8080 + user: user + pwd:...
b715b0def9eefa0cde9ac57564fee6ea54d7d92c
py/add-one-row-to-tree.py
py/add-one-row-to-tree.py
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def addOneRow(self, root, v, d): """ :type root: TreeNode :type v: int :type d: int ...
Add py solution for 623. Add One Row to Tree
Add py solution for 623. Add One Row to Tree 623. Add One Row to Tree: https://leetcode.com/problems/add-one-row-to-tree/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,33 @@ +# Definition for a binary tree node. +# class TreeNode(object): +# def __init__(self, x): +# self.val = x +# self.left = None +# self.right = None + +class Solution(object): + def addOneRow(self, root, v, d): + """ + :type root: TreeNode + ...
a6237c18f0a2f152b8d138dcc802bd824734b70d
catalog/predictions.py
catalog/predictions.py
from users.models import User from catalog.models import Course import collections from django.contrib.contenttypes.models import ContentType from actstream.models import Follow def distance(v1, v2): absolute_difference = [abs(c1 - c2) for c1, c2 in zip(v1, v2)] distance = sum(absolute_difference) return ...
Add a course following predictor
Add a course following predictor
Python
agpl-3.0
UrLab/beta402,UrLab/DocHub,UrLab/beta402,UrLab/beta402,UrLab/DocHub,UrLab/DocHub,UrLab/DocHub
--- +++ @@ -0,0 +1,53 @@ +from users.models import User +from catalog.models import Course +import collections +from django.contrib.contenttypes.models import ContentType +from actstream.models import Follow + + +def distance(v1, v2): + absolute_difference = [abs(c1 - c2) for c1, c2 in zip(v1, v2)] + distance =...
543eda041b4cde015d7150d0416c6e18dde8af9a
test/build/test_builder.py
test/build/test_builder.py
import unittest import sys import re import saliweb.build class BuilderTest(unittest.TestCase): """Check builder functions""" def test_builder_python_tests(self): """Test builder_python_tests function""" class DummyEnv(object): def __init__(self, exit_val): self.exi...
Test build system builder functions.
Test build system builder functions.
Python
lgpl-2.1
salilab/saliweb,salilab/saliweb,salilab/saliweb,salilab/saliweb,salilab/saliweb
--- +++ @@ -0,0 +1,40 @@ +import unittest +import sys +import re +import saliweb.build + +class BuilderTest(unittest.TestCase): + """Check builder functions""" + + def test_builder_python_tests(self): + """Test builder_python_tests function""" + class DummyEnv(object): + def __init__(se...
cea3e26e4c8a1c078251bc184d93c59530ab7044
tests/unit/route53/test_zone.py
tests/unit/route53/test_zone.py
#!/usr/bin/env python # 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 ...
Add test for iteraton break of Route53 records
Add test for iteraton break of Route53 records
Python
mit
alfredodeza/boto,TiVoMaker/boto,vishnugonela/boto,shaunbrady/boto,garnaat/boto,janslow/boto,felix-d/boto,nishigori/boto,yangchaogit/boto,disruptek/boto,disruptek/boto,ocadotechnology/boto,ramitsurana/boto,nikhilraog/boto,drbild/boto,zzzirk/boto,rosmo/boto,khagler/boto,j-carl/boto,serviceagility/boto,revmischa/boto,alex...
--- +++ @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# 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 ...
2a9bcc7360faabbaf0988687edad945fea454b3d
IPython/testing/plugin/test_ipdoctest.py
IPython/testing/plugin/test_ipdoctest.py
"""Tests for the ipdoctest machinery itself. Note: in a file named test_X, functions whose only test is their docstring (as a doctest) and which have no test functionality of their own, should be called 'doctest_foo' instead of 'test_foo', otherwise they get double-counted (the empty function call is counted as a test...
Add a few tests for ipdoctest itself. Not very complete yet, but a start.
Add a few tests for ipdoctest itself. Not very complete yet, but a start.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
--- +++ @@ -0,0 +1,75 @@ +"""Tests for the ipdoctest machinery itself. + +Note: in a file named test_X, functions whose only test is their docstring (as +a doctest) and which have no test functionality of their own, should be called +'doctest_foo' instead of 'test_foo', otherwise they get double-counted (the +empty f...
0eb648a58dc59a36b83537a6de9bc4635035b0a4
raiden/tests/unit/storage/test_storage.py
raiden/tests/unit/storage/test_storage.py
from unittest.mock import patch import pytest from raiden.storage.sqlite import RAIDEN_DB_VERSION, SQLiteStorage def test_transaction_commit(tmp_path): filename = f'v{RAIDEN_DB_VERSION}_db.log' storage = SQLiteStorage(f'{tmp_path}/{filename}') with storage.transaction(): with patch('raiden.stor...
Add small storage transaction tests
Add small storage transaction tests
Python
mit
hackaugusto/raiden,hackaugusto/raiden
--- +++ @@ -0,0 +1,31 @@ +from unittest.mock import patch + +import pytest + +from raiden.storage.sqlite import RAIDEN_DB_VERSION, SQLiteStorage + + +def test_transaction_commit(tmp_path): + filename = f'v{RAIDEN_DB_VERSION}_db.log' + storage = SQLiteStorage(f'{tmp_path}/{filename}') + + with storage.transac...
d7f5da9cce78cec57720bff37e0c21604d0b93d1
pft/tests/test_users.py
pft/tests/test_users.py
"""User Model Tests.""" import unittest from .. import create_app, db from ..database import User class UserModelTestCase(unittest.TestCase): """User model tests.""" def setUp(self): """Set up tests.""" self.app = create_app('testing') self.app_context = self.app.app_context() ...
Add unit tests for User
Add unit tests for User
Python
unknown
gregcowell/PFT,gregcowell/BAM,gregcowell/PFT,gregcowell/BAM
--- +++ @@ -0,0 +1,44 @@ +"""User Model Tests.""" +import unittest +from .. import create_app, db +from ..database import User + + +class UserModelTestCase(unittest.TestCase): + """User model tests.""" + + def setUp(self): + """Set up tests.""" + self.app = create_app('testing') + self.app_...
6bb921082a168cf31b7499bc62f2a26c223e9686
tests/test_autoreconnect.py
tests/test_autoreconnect.py
#!/usr/bin/env python from graphitesend import graphitesend import unittest import socket class TestAutoreconnect(unittest.TestCase): def setUp(self): """ reset graphitesend """ self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.server.setsockopt(socket.SOL_SOCKET, sock...
Add tests for autoreconnect feature
Add tests for autoreconnect feature
Python
apache-2.0
numberly/graphitesend,daniellawrence/graphitesend,PabloLefort/graphitesend
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/env python + +from graphitesend import graphitesend +import unittest +import socket + + +class TestAutoreconnect(unittest.TestCase): + + def setUp(self): + """ reset graphitesend """ + self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.s...
f9724b7a3eea113b897e2109bd5fc9942314ffe1
helios/migrations/0004_auto_20160509_1804.py
helios/migrations/0004_auto_20160509_1804.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('helios', '0003_castvote_cast_from'), ] operations = [ migrations.RenameField( model_name='castvote', ...
Update migrations for cast_ip implemented in official Helios
Update migrations for cast_ip implemented in official Helios
Python
agpl-3.0
RunasSudo/helios-server-mixnet,RunasSudo/helios-server-mixnet,RunasSudo/helios-server-mixnet,RunasSudo/helios-server-mixnet,RunasSudo/helios-server-mixnet
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('helios', '0003_castvote_cast_from'), + ] + + operations = [ + migrations.RenameField( + ...
b0cded39e3d318103f7a6bbd36a9a78a5b7c2e5a
cli-create-dataset-table.py
cli-create-dataset-table.py
#!/usr/bin/env python ''' Create dataset table (w/ sample schema) ''' import httplib2 from apiclient.discovery import build from oauth2client.client import SignedJwtAssertionCredentials from apiclient.errors import HttpError from config import Credential as gc dataset_id = 'DATASET-ID-HERE' new_table_id = 'NEW-TABL...
Add create (dataset) table sample script
Add create (dataset) table sample script
Python
mit
rawswift/google-bigquery-python-cli
--- +++ @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +''' Create dataset table (w/ sample schema) ''' + +import httplib2 + +from apiclient.discovery import build +from oauth2client.client import SignedJwtAssertionCredentials +from apiclient.errors import HttpError +from config import Credential as gc + +dataset_id = 'DA...
fea181bf41c478042df00cee5dc33864751a4ed2
oidc_provider/migrations/0002_userconsent.py
oidc_provider/migrations/0002_userconsent.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('oidc_provider', '0001_initial'), ] ...
Add migrations for user consent.
Add migrations for user consent.
Python
mit
torreco/django-oidc-provider,ByteInternet/django-oidc-provider,Sjord/django-oidc-provider,wayward710/django-oidc-provider,bunnyinc/django-oidc-provider,juanifioren/django-oidc-provider,Sjord/django-oidc-provider,bunnyinc/django-oidc-provider,wojtek-fliposports/django-oidc-provider,wojtek-fliposports/django-oidc-provide...
--- +++ @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('oi...
9b5a6e0da2afbfc021c7aefd1b31aed9a0cd9c85
osf/migrations/0121_auto_20180723_0816.py
osf/migrations/0121_auto_20180723_0816.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-07-23 13:16 from __future__ import unicode_literals from waffle.models import Flag from django.db import migrations EMBER_WAFFLE_PAGES = [ 'dashboard', 'home', ] def format_ember_waffle_flag_name(page): return '{}{}{}'.format('ember_', page, '...
Add data migration to remove dashboard and home waffle flags from the db.
Add data migration to remove dashboard and home waffle flags from the db.
Python
apache-2.0
pattisdr/osf.io,brianjgeiger/osf.io,saradbowman/osf.io,felliott/osf.io,adlius/osf.io,mattclark/osf.io,Johnetordoff/osf.io,aaxelb/osf.io,caseyrollins/osf.io,erinspace/osf.io,erinspace/osf.io,brianjgeiger/osf.io,cslzchen/osf.io,cslzchen/osf.io,HalcyonChimera/osf.io,mattclark/osf.io,aaxelb/osf.io,aaxelb/osf.io,adlius/osf....
--- +++ @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.13 on 2018-07-23 13:16 +from __future__ import unicode_literals +from waffle.models import Flag +from django.db import migrations + + +EMBER_WAFFLE_PAGES = [ + 'dashboard', + 'home', +] + +def format_ember_waffle_flag_name(page): + ...
06062f40987c1b95213825fc6851676daa78de9f
faker/providers/internet/pl_PL/__init__.py
faker/providers/internet/pl_PL/__init__.py
# coding=utf-8 from __future__ import unicode_literals from .. import Provider as InternetProvider class Provider(InternetProvider): free_email_domains = ( 'onet.pl', 'interia.pl', 'gmail.com', 'o2.pl', 'yahoo.com', 'hotmail.com', ) tlds = ('com', 'com', ...
Add pl_PL internet data provider
Add pl_PL internet data provider
Python
mit
joke2k/faker,danhuss/faker,joke2k/faker
--- +++ @@ -0,0 +1,30 @@ +# coding=utf-8 +from __future__ import unicode_literals + +from .. import Provider as InternetProvider + + +class Provider(InternetProvider): + + free_email_domains = ( + 'onet.pl', + 'interia.pl', + 'gmail.com', + 'o2.pl', + 'yahoo.com', + 'hotma...
c3e88d59492469f1eea89d9a1d63565439ac1611
daguerre/migrations/0004_hash_upload_to_dir.py
daguerre/migrations/0004_hash_upload_to_dir.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import daguerre.models class Migration(migrations.Migration): dependencies = [ ('daguerre', '0003_auto_20160301_2342'), ] operations = [ migrations.AlterField( model_name...
Apply the upload_to migration on the AdjustedImage model
Apply the upload_to migration on the AdjustedImage model
Python
bsd-3-clause
littleweaver/django-daguerre,littleweaver/django-daguerre
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import daguerre.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('daguerre', '0003_auto_20160301_2342'), + ] + + operations = [ + mig...
458031c375a3003237cfa216841aa44d5909a6a2
migrations/versions/d1a1a428aae0_remade_articles_to_be_better.py
migrations/versions/d1a1a428aae0_remade_articles_to_be_better.py
"""Remade article to be better Revision ID: d1a1a428aae0 Revises: 4e7b4c69111b Create Date: 2018-10-23 22:18:11.271098 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = 'd1a1a428aae0' down_revision = '4e7b4c69111b' branch...
Add in the migration for the previous commit
Add in the migration for the previous commit
Python
mit
dougmiller/theMetaCity,dougmiller/theMetaCity,dougmiller/theMetaCity,dougmiller/theMetaCity
--- +++ @@ -0,0 +1,62 @@ +"""Remade article to be better + +Revision ID: d1a1a428aae0 +Revises: 4e7b4c69111b +Create Date: 2018-10-23 22:18:11.271098 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = 'd1a1a428aae...
e7f58ea998bb345796da94bfab6f1c9db50822a6
testing/test_urlslash.py
testing/test_urlslash.py
from __future__ import absolute_import, print_function from ..pyautoupdate.launcher import Launcher import os def test_check_vers_update(): launch = Launcher('',r'http://rlee287.github.io/pyautoupdate/testing/') launch2 = Launcher('',r'http://rlee287.github.io/pyautoupdate/testing') assert launch.url == ...
Test url slash add behaivior
Test url slash add behaivior
Python
lgpl-2.1
rlee287/pyautoupdate,rlee287/pyautoupdate
--- +++ @@ -0,0 +1,10 @@ +from __future__ import absolute_import, print_function + +from ..pyautoupdate.launcher import Launcher + +import os + +def test_check_vers_update(): + launch = Launcher('',r'http://rlee287.github.io/pyautoupdate/testing/') + launch2 = Launcher('',r'http://rlee287.github.io/pyautoupdate...
2d88cb51291091fd65c218a1d7373828bac874ec
preparation/selection/match_amendments.py
preparation/selection/match_amendments.py
import os __author__ = 'moskupols' from hb_res.storage import list_storages, get_storage, FileExplanationStorage from pprint import pprint from diff_match_patch import diff_match_patch CUR_DIR = os.path.dirname(os.path.abspath(__file__)) SEL_PATH = os.path.join(CUR_DIR, 'SelectedAfterMissedModifiers.asset') all_ex...
Add script matching most of manual explanations
Add script matching most of manual explanations with those in autogenerated assets
Python
mit
hatbot-team/hatbot_resources
--- +++ @@ -0,0 +1,55 @@ +import os + +__author__ = 'moskupols' + +from hb_res.storage import list_storages, get_storage, FileExplanationStorage +from pprint import pprint +from diff_match_patch import diff_match_patch + +CUR_DIR = os.path.dirname(os.path.abspath(__file__)) +SEL_PATH = os.path.join(CUR_DIR, 'Selected...
d52920d1efee179271bdf6497b384110c404fa97
aleph/tests/test_search_query.py
aleph/tests/test_search_query.py
from unittest import TestCase from aleph.search.parser import SearchQueryParser from aleph.search.query import Query def query(args): return Query(SearchQueryParser(args, None)) class QueryTestCase(TestCase): def setUp(self): # Allow list elements to be in any order self.addTypeEqualityFunc(li...
Add tests for Query class
Add tests for Query class
Python
mit
alephdata/aleph,alephdata/aleph,pudo/aleph,alephdata/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph,pudo/aleph
--- +++ @@ -0,0 +1,59 @@ +from unittest import TestCase +from aleph.search.parser import SearchQueryParser +from aleph.search.query import Query + +def query(args): + return Query(SearchQueryParser(args, None)) + +class QueryTestCase(TestCase): + def setUp(self): + # Allow list elements to be in any orde...
4e293daad5af96ee16d93058dda45bae733be9ad
nanpy/examples/lcd_autoscroll.py
nanpy/examples/lcd_autoscroll.py
#!/usr/bin/env python import time from nanpy import SerialManager from nanpy.lcd import Lcd if __name__ == '__main__': connection = SerialManager(sleep_after_connect=2) cols, rows = 16, 2 pins = [7, 8, 9, 10, 11, 12] lcd = Lcd(pins, [cols, rows], connection=connection) while True: l...
Add example for lcd autoscroll
Add example for lcd autoscroll
Python
mit
joppi/nanpy,nanpy/nanpy
--- +++ @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +import time + +from nanpy import SerialManager +from nanpy.lcd import Lcd + + +if __name__ == '__main__': + + connection = SerialManager(sleep_after_connect=2) + + cols, rows = 16, 2 + + pins = [7, 8, 9, 10, 11, 12] + lcd = Lcd(pins, [cols, rows], connect...
d6805fc64245e667d83141aeea6b6c2e017e8f3c
two-sums/two-sum-2.py
two-sums/two-sum-2.py
class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ length = len(nums) map = {} for i in range(length): map[nums[i]] = i i = i + 1 print map f...
Use maps, which gives up the space but get less execution time
Use maps, which gives up the space but get less execution time
Python
mit
tonylixu/leetcode
--- +++ @@ -0,0 +1,24 @@ +class Solution(object): + def twoSum(self, nums, target): + """ + :type nums: List[int] + :type target: int + :rtype: List[int] + """ + length = len(nums) + map = {} + for i in range(length): + map[nums[i]] = i + ...
af2c75a4a99f93e3cae1a1d2d0485a88cce833b7
features/environment.py
features/environment.py
import os import os.path as pt from scripttest import TestFileEnvironment def before_scenario(context, _): root_dir = pt.abspath(pt.join(pt.dirname(__file__), '..')) path = ":" + pt.join(root_dir, 'bin') tmp = pt.join(root_dir, "tmp") python_path = pt.join(root_dir, 'vendor', 'python', ...
import os import os.path as pt from scripttest import TestFileEnvironment def before_scenario(context, _): root_dir = pt.abspath(pt.join(pt.dirname(__file__), '..')) path = ":" + pt.join(root_dir, 'bin') tmp = pt.join(root_dir, "tmp", "feature") python_path = pt.join(root_dir, 'vendor',...
Update location of feature tests are run in
Update location of feature tests are run in
Python
mit
michaelbarton/command-line-interface,bioboxes/command-line-interface,bioboxes/command-line-interface,michaelbarton/command-line-interface
--- +++ @@ -6,10 +6,9 @@ root_dir = pt.abspath(pt.join(pt.dirname(__file__), '..')) path = ":" + pt.join(root_dir, 'bin') - tmp = pt.join(root_dir, "tmp") + tmp = pt.join(root_dir, "tmp", "feature") python_path = pt.join(root_dir, 'vendor', 'python', 'lib', 'python2.7', '...
5c2f862390a269ea7c245de269a4359d574ee5ca
nose2/tests/unit/test_functions_loader.py
nose2/tests/unit/test_functions_loader.py
from nose2.compat import unittest from nose2 import events, loader, session from nose2.plugins.loader import functions from nose2.tests._common import TestCase class TestFunctionLoader(TestCase): def setUp(self): self.session = session.Session() self.loader = loader.PluggableTestLoader(self.sessio...
Add unit tests for function loader plugin
Add unit tests for function loader plugin
Python
bsd-2-clause
little-dude/nose2,leth/nose2,ojengwa/nose2,ezigman/nose2,leth/nose2,ojengwa/nose2,ptthiem/nose2,ezigman/nose2,ptthiem/nose2,little-dude/nose2
--- +++ @@ -0,0 +1,34 @@ +from nose2.compat import unittest +from nose2 import events, loader, session +from nose2.plugins.loader import functions +from nose2.tests._common import TestCase + +class TestFunctionLoader(TestCase): + + def setUp(self): + self.session = session.Session() + self.loader = l...
37650e6d9c792006ce86317e8b5b7945d4b4aa42
mv-annotated-to-main.py
mv-annotated-to-main.py
#!/usr/bin/env python import argparse import os import os.path import re REGEX = re.compile(r'^(.*)_\d{4}-\d{1,2}-\d{1,2}_\d{1,2}-\d{1,2}-\d{1,2}.pdf$') def process(filename): match = REGEX.match(filename) if match is not None: new_filename = match.group(1) + '.pdf' os.rename(filename, new_f...
Add rename script for PDFs merged with annotations
Add rename script for PDFs merged with annotations
Python
mit
jgosmann/boox-tools
--- +++ @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +import argparse +import os +import os.path +import re + + +REGEX = re.compile(r'^(.*)_\d{4}-\d{1,2}-\d{1,2}_\d{1,2}-\d{1,2}-\d{1,2}.pdf$') + +def process(filename): + match = REGEX.match(filename) + if match is not None: + new_filename = match.group(1) +...
2d9c2dc78bb2741d943e9f9af771938d17a57ae7
Source/bindings/PRESUBMIT.py
Source/bindings/PRESUBMIT.py
# Copyright (C) 2013 Google Inc. 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 and the ...
Add presubmit check for run-bindings-tests
Add presubmit check for run-bindings-tests run-bindings-tests should be run (and succeed) for any changes to Source/bindings. This is particularly important to make sure tests are rebaselined when changes are made to the code generator. This adds a PRESUBMIT.py script to do just that! Checked that this worked by chan...
Python
bsd-3-clause
primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs,primiano/blink-gitcs
--- +++ @@ -0,0 +1,65 @@ +# Copyright (C) 2013 Google Inc. 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 +# notic...
d29c3c1ca4085149f1442ca5ec46b77bbaef4028
mezzanine/bin/make_filebrowser_safe.py
mezzanine/bin/make_filebrowser_safe.py
#!/usr/bin/env python """ Converts the last backward-compatible filebrowser branch into a newly named package ``filebrowser_safe``. """ import os branch_url = "http://django-filebrowser.googlecode.com/svn/branches/filebrowser_3" package_name_from = branch_url.split("/")[-1] package_name_to = "filebrowser_safe" if ...
Add script for generating fork of filebrowser.
Add script for generating fork of filebrowser.
Python
bsd-2-clause
douglaskastle/mezzanine,industrydive/mezzanine,wyzex/mezzanine,dustinrb/mezzanine,vladir/mezzanine,industrydive/mezzanine,Kniyl/mezzanine,promil23/mezzanine,adrian-the-git/mezzanine,sjdines/mezzanine,dustinrb/mezzanine,orlenko/sfpirg,viaregio/mezzanine,batpad/mezzanine,wbtuomela/mezzanine,frankier/mezzanine,vladir/mezz...
--- +++ @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +""" +Converts the last backward-compatible filebrowser branch into a newly named +package ``filebrowser_safe``. +""" + +import os + +branch_url = "http://django-filebrowser.googlecode.com/svn/branches/filebrowser_3" +package_name_from = branch_url.split("/")[-1] +pa...
cf362d57dbc3a08fb2fd8b60577e8383adeae432
stdnum/fi/veronumero.py
stdnum/fi/veronumero.py
# vat.py - functions for handling Finnish VAT numbers # coding: utf-8 # # Copyright (C) 2012-2015 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of ...
Implement Finnish tax number validator
Implement Finnish tax number validator
Python
lgpl-2.1
holvi/python-stdnum,holvi/python-stdnum,holvi/python-stdnum
--- +++ @@ -0,0 +1,59 @@ +# vat.py - functions for handling Finnish VAT numbers +# coding: utf-8 +# +# Copyright (C) 2012-2015 Arthur de Jong +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software F...
931c6b2809de22b7c74206256ecfd1c5beaee149
app/main/views/two_factor.py
app/main/views/two_factor.py
from flask import render_template, redirect, jsonify, session from flask_login import login_user from app.main import main from app.main.dao import users_dao, verify_codes_dao from app.main.forms import TwoFactorForm @main.route("/two-factor", methods=['GET']) def render_two_factor(): return render_template('vie...
import traceback from flask import render_template, redirect, jsonify, session from flask_login import login_user from app.main import main from app.main.dao import users_dao, verify_codes_dao from app.main.forms import TwoFactorForm @main.route("/two-factor", methods=['GET']) def render_two_factor(): return re...
Add debugging to find issue.
Add debugging to find issue.
Python
mit
alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin
--- +++ @@ -1,3 +1,5 @@ +import traceback + from flask import render_template, redirect, jsonify, session from flask_login import login_user @@ -13,12 +15,15 @@ @main.route('/two-factor', methods=['POST']) def process_two_factor(): - form = TwoFactorForm() + try: + form = TwoFactorForm() - i...
587b8b82de1bf407101b39fd18ef6626c3556547
test/helperfuncstest.py
test/helperfuncstest.py
#!/usr/bin/python2.4 # # Copyright (c) 2004-2005 rPath, Inc. # import testsuite testsuite.setup() from mint_rephelp import MintRepositoryHelper from mint.userlevels import myProjectCompare class ProjectTest(MintRepositoryHelper): def testMyProjectCompare(self): if not isinstance(myProjectCompare(('not te...
Test case to ensure MySQL doesn't break My Projects speedbox.
Test case to ensure MySQL doesn't break My Projects speedbox.
Python
apache-2.0
sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint
--- +++ @@ -0,0 +1,20 @@ +#!/usr/bin/python2.4 +# +# Copyright (c) 2004-2005 rPath, Inc. +# + +import testsuite +testsuite.setup() + +from mint_rephelp import MintRepositoryHelper +from mint.userlevels import myProjectCompare + +class ProjectTest(MintRepositoryHelper): + def testMyProjectCompare(self): + if...
ad08acee184a899943e15e8c6e08385c68c158a7
tests/_test_m18nkeys.py
tests/_test_m18nkeys.py
# -*- coding: utf-8 -*- import re import glob import json import yaml ############################################################################### # Find used keys in python code # ############################################################################### # This ...
Add a script to test m18n keys usage
Add a script to test m18n keys usage
Python
agpl-3.0
YunoHost/yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/yunohost
--- +++ @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +import re +import glob +import json +import yaml + +############################################################################### +# Find used keys in python code # +###################################################...
318e9b311fff8c5d66f1d043e3784fb81b8d4eda
tests/test_browseimage.py
tests/test_browseimage.py
# coding=utf-8 from __future__ import absolute_import from eodatasets import browseimage, drivers, type as ptype from tests import write_files, assert_same def test_create_typical_browse_metadata(): class TestDriver(drivers.DatasetDriver): def browse_image_bands(self, d): return '5', '1', '3'...
Add browse image setup test.
Add browse image setup test.
Python
apache-2.0
GeoscienceAustralia/eo-datasets,jeremyh/eo-datasets,GeoscienceAustralia/eo-datasets,jeremyh/eo-datasets
--- +++ @@ -0,0 +1,78 @@ +# coding=utf-8 + +from __future__ import absolute_import +from eodatasets import browseimage, drivers, type as ptype +from tests import write_files, assert_same + + +def test_create_typical_browse_metadata(): + class TestDriver(drivers.DatasetDriver): + def browse_image_bands(self,...
c34f6bf526049be86e6cff713986bf25645f5223
vagrant/tournament/generate_tournament.py
vagrant/tournament/generate_tournament.py
import random from tournament import connect from tournament import reportMatch from tournament_test import testDelete the_players = [ (1, 'Jeff'), (2, 'Adarsh'), (3, 'Amanda'), (4, 'Eduardo'), (5, 'Philip'), (6, 'Jee') ] def registerPlayerUpdated(name): """Add a player to the tourname...
Add random tournament generator script
Feat: Add random tournament generator script
Python
mit
gsbullmer/tournament-results,gsbullmer/tournament-results,gsbullmer/tournament-results
--- +++ @@ -0,0 +1,65 @@ +import random + +from tournament import connect +from tournament import reportMatch + +from tournament_test import testDelete + + +the_players = [ + (1, 'Jeff'), + (2, 'Adarsh'), + (3, 'Amanda'), + (4, 'Eduardo'), + (5, 'Philip'), + (6, 'Jee') +] + + +def registerPlayerUpda...
c00f02045a5e081f1df5cd62993491ef7dc9af52
remap.py
remap.py
import sys def parseMaps(goodMapFile, badMapFile): with open(goodMapFile) as gmf: goodMap = gmf.readlines() del goodMap[0] with open(badMapFile) as bmf: badMap = bmf.readlines() del badMap[0] bcMap = {} # create a map from the sample ID to the good barcode for line in goodMap: line = line.split('\...
Create a new QIIME mapping file by replacing incorrect barcodes
Create a new QIIME mapping file by replacing incorrect barcodes
Python
mit
smdabdoub/phylotoast,akshayparopkari/phylotoast
--- +++ @@ -0,0 +1,50 @@ +import sys + +def parseMaps(goodMapFile, badMapFile): + with open(goodMapFile) as gmf: + goodMap = gmf.readlines() + del goodMap[0] + + with open(badMapFile) as bmf: + badMap = bmf.readlines() + del badMap[0] + + bcMap = {} + + # create a map from the sample ID to the good barcode + f...
8ea0a6b9986996e40fea906a855fba5547b27c89
recalculate_gene_ranks.py
recalculate_gene_ranks.py
import django_rq import logging import os import time os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'varify.conf.settings') from django.core import management log = logging.getLogger(__name__) # We don't want this job to run forever so limit to this many attempts and # if the queue is still not empty just give up...
Add script to call gene-ranks command after samples load
Add script to call gene-ranks command after samples load This will need to be added as a cron job like the recalculate_allele_frequencies script is used now.
Python
bsd-2-clause
chop-dbhi/varify,chop-dbhi/varify,chop-dbhi/varify,chop-dbhi/varify
--- +++ @@ -0,0 +1,33 @@ +import django_rq +import logging +import os +import time + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'varify.conf.settings') + +from django.core import management + +log = logging.getLogger(__name__) + +# We don't want this job to run forever so limit to this many attempts and +# if t...
c058818cf29d154a1899ccedc326302506bed85f
tb_website/settings/orchestra.py
tb_website/settings/orchestra.py
""" This module graps a configured database from """ import os from collections import defaultdict DB_ENGINES = { 'SQLITE': 'django.db.backends.sqlite3', 'MYSQL': 'django.db.backends.mysql', 'PSQL': 'django.db.backends.postgresql', 'ORACLE': None, } def infinatedict(): """An infinately deep def...
Add new settings support for apache
Add new settings support for apache
Python
agpl-3.0
IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site
--- +++ @@ -0,0 +1,72 @@ +""" +This module graps a configured database from +""" + +import os + +from collections import defaultdict + +DB_ENGINES = { + 'SQLITE': 'django.db.backends.sqlite3', + 'MYSQL': 'django.db.backends.mysql', + 'PSQL': 'django.db.backends.postgresql', + 'ORACLE': None, +} + +def in...
485c7d862740c2547c7ffc5d3ace8c10243a1718
InvsByDayCalculator.py
InvsByDayCalculator.py
import datetime,time; year=2015 month=6 day=22 invsDays=64 invsRatio=0.096 invsFund = 2000 arrInvsPayBack = [] #array arrInvsPayPlan={} invsDate = datetime.date(year,month,day) finiDate = invsDate + datetime.timedelta(invsDays) firstPayDate = datetime.date(year,month+1,20) print 'Ͷʿʼʱ:', invsDate, ';Ͷʽʱ:', finiDat...
Add the Simple InveCalculator Alog for Earnning by days!
Add the Simple InveCalculator Alog for Earnning by days!
Python
mit
DivadOEC/HInvestMgr
--- +++ @@ -0,0 +1,62 @@ +import datetime,time; + +year=2015 +month=6 +day=22 +invsDays=64 +invsRatio=0.096 +invsFund = 2000 + +arrInvsPayBack = [] + +#array arrInvsPayPlan={} + +invsDate = datetime.date(year,month,day) +finiDate = invsDate + datetime.timedelta(invsDays) +firstPayDate = datetime.date(year,month+1,20)...
938e9f822cded00f37befb70ebe33b3b98283b93
test/test_jobs/test_send_mail.py
test/test_jobs/test_send_mail.py
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2014 SF Isle of Man Limited # # PyBossa is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at...
Add tests for send_mail job
Add tests for send_mail job
Python
agpl-3.0
PyBossa/pybossa,inteligencia-coletiva-lsd/pybossa,OpenNewsLabs/pybossa,stefanhahmann/pybossa,jean/pybossa,PyBossa/pybossa,Scifabric/pybossa,geotagx/pybossa,stefanhahmann/pybossa,jean/pybossa,geotagx/pybossa,inteligencia-coletiva-lsd/pybossa,OpenNewsLabs/pybossa,Scifabric/pybossa
--- +++ @@ -0,0 +1,39 @@ +# -*- coding: utf8 -*- +# This file is part of PyBossa. +# +# Copyright (C) 2014 SF Isle of Man Limited +# +# PyBossa 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...