commit
stringlengths
40
40
subject
stringlengths
1
1.49k
old_file
stringlengths
4
311
new_file
stringlengths
4
311
new_contents
stringlengths
1
29.8k
old_contents
stringlengths
0
9.9k
lang
stringclasses
3 values
proba
float64
0
1
462cdfaf93f23e227b8da44e143a5ff9e8c047be
test futil for files
tests/test_futil.py
tests/test_futil.py
"""Run doctests in pug.nlp.futil.""" from __future__ import print_function, absolute_import import doctest import pug.nlp.futil from unittest import TestCase class DoNothingTest(TestCase): """A useless TestCase to encourage Django unittests to find this module and run `load_tests()`.""" def test_example(se...
Python
0
a1039c2e38243b64d2027621aa87ee020636f23b
Add initial test for routes.
tests/test_views.py
tests/test_views.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys sys.path.insert(0, os.path.abspath('..')) import website import unittest import tempfile class FPOTestCase(unittest.TestCase): def test_homepage(self): self.app = website.app.test_client() resp = self.app.get('/') self.as...
Python
0
6cebbd302556469dd4231d6252ec29c5d7c1165c
add script to convert data from Rime/luna-pinyin
data/convertdict.py
data/convertdict.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys def uniq(seq): # Dave Kirby # Order preserving seen = set() return [x for x in seq if x not in seen and not seen.add(x)] def pinyin(word): N = len(word) pos = 0 result = [] while pos < N: for i in range(N, pos, -1): ...
Python
0
7553a438672ab68206f30204d572f89bd088e744
Add files via upload
pylab.py
pylab.py
import numpy as np import matplotlib.pyplot as plt import sympy as sympy import csv masterDataList = [] with open('candata.csv', 'r') as f: reader = csv.reader(f) for row in reader: commitList = list(reader) masterDataList.append(commitList) print(masterDataList[0][1][0]) """number of lines of data from csv ...
Python
0
41e3d696967b523d0d031a0a17d18c9804f455ee
Change G+ default type
djangocms_blog/settings.py
djangocms_blog/settings.py
# -*- coding: utf-8 -*- from django.conf import settings from meta_mixin import settings as meta_settings BLOG_IMAGE_THUMBNAIL_SIZE = getattr(settings, 'BLOG_IMAGE_THUMBNAIL_SIZE', { 'size': '120x120', 'crop': True, 'upscale': False }) BLOG_IMAGE_FULL_SIZE = getattr(settings, 'BLOG_IMAGE_FULL_SIZE', { ...
# -*- coding: utf-8 -*- from django.conf import settings from meta_mixin import settings as meta_settings BLOG_IMAGE_THUMBNAIL_SIZE = getattr(settings, 'BLOG_IMAGE_THUMBNAIL_SIZE', { 'size': '120x120', 'crop': True, 'upscale': False }) BLOG_IMAGE_FULL_SIZE = getattr(settings, 'BLOG_IMAGE_FULL_SIZE', { ...
Python
0
ab2b2c6f12e2e5ec53ac6d140919a343a74b7e3c
Update migration
django_afip/migrations/0017_receipt_issued_date.py
django_afip/migrations/0017_receipt_issued_date.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-06-10 13:33 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('afip', '0016_auto_20170529_2012'), ] operations = [ migrations.AlterField( ...
Python
0
a52dd9d66ff7d9a29f6d635e5ca1a2a0584c267b
Add rosetta utils
rosetta_utils.py
rosetta_utils.py
# From: https://github.com/mbi/django-rosetta/issues/50 # Gunicorn may work with --reload option but it needs # https://pypi.python.org/pypi/inotify package for performances from django.dispatch import receiver from rosetta.signals import post_save import time import os @receiver(post_save) def restart_server(sender...
Python
0.0015
4de410b1ea93665f22874826ceebcea68737dde7
Add permissions list
tlbot/permission.py
tlbot/permission.py
############################################################################### # TransportLayerBot: Permission List - All-in-one modular bot for Discord # # Copyright (C) 2017 TransportLayer # # # ...
Python
0.000001
8410b027987f088b86989898b4fade5b0960886a
Solve problem 2
problem002.py
problem002.py
#!/usr/bin/env python3 def fibs(maxnumber): fib1, fib2 = 1, 2 while fib1 < maxnumber: yield fib1 fib1, fib2 = fib2, fib1 + fib2 print(sum(f for f in fibs(4000000) if f % 2 == 0))
Python
0.999999
278920272efd7ab959d7cad5b5f7d6c17935c7e6
Add problem 35, circular primes
problem_35.py
problem_35.py
from math import sqrt from time import time PRIME_STATUS = {} def is_prime(n): if n == 2: return True if n % 2 == 0 or n <= 1: return False for i in range(3, int(sqrt(n))+1, 2): if n % i == 0: return False return True def check_prime_circles(num): circles = [...
Python
0.000126
dad430fd56b8be22bd1a3b9773f9948c3e305883
Add unit tests for lazy strings
stringlike/test/lazy_tests.py
stringlike/test/lazy_tests.py
import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) from stringlike.lazy import LazyString, CachedLazyString from unittest import main, TestCase class TestLazyString(TestCase): def test_equality(self): self.assertEqual(LazyString(lambda: 'abc'), ...
Python
0.000001
458d2e55de4db6c9f72758b745245301ebd02f48
Add solution 100
100_to_199/euler_100.py
100_to_199/euler_100.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Problem 100 If a box contains twenty-one coloured discs, composed of fifteen blue discs and six red discs, and two discs were taken at random, it can be seen that the probability of taking two blue discs, P(BB) = (15/21)ร—(14/20) = 1/2. The next such arrangement, for w...
Python
0.998911
c421024bfd1660685bb6ec6cb84a0369244627c5
add celery module
service_mapper/celery.py
service_mapper/celery.py
from __future__ import absolute_import import os from celery import Celery from django.conf import settings # set the default Django settings module for the 'celery' program. os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'service_mapper.settings') app = Celery('service_mapper') # Using a string here means the w...
Python
0.000001
2eb05eb7d42f1b14191cccba2563c2105fabaed1
Add processing module
processing.py
processing.py
#!/usr/bin/env python """ Processing routines for the waveFlapper case. """ import foampy import numpy as np import matplotlib.pyplot as plt width_2d = 0.1 width_3d = 3.66 def plot_force(): """Plots the streamwise force on the paddle over time.""" def plot_moment(): data = foampy.load_forces_moments() ...
Python
0.000001
df0e285b6f8465eb273af50c242299c5601fa09f
Add a new example
examples/sanic_aiomysql_with_global_pool.py
examples/sanic_aiomysql_with_global_pool.py
# encoding: utf-8 """ You need the aiomysql """ import asyncio import os import aiomysql import uvloop from sanic import Sanic from sanic.response import json database_name = os.environ['DATABASE_NAME'] database_host = os.environ['DATABASE_HOST'] database_user = os.environ['DATABASE_USER'] database_password = os.envi...
Python
0.000102
e7b6aef4db85c777463d2335107145b60b678ae2
Create a new tour example
examples/tour_examples/maps_introjs_tour.py
examples/tour_examples/maps_introjs_tour.py
from seleniumbase import BaseCase class MyTourClass(BaseCase): def test_google_maps_tour(self): self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z") self.wait_for_element("#searchboxinput") self.wait_for_element("#minimap") self.wait_for_element("#zoom") s...
Python
0.000012
8ddc9333513a2e900ff61b6d2904db3e58635bb9
add initial self_publish version
elm_self_publish.py
elm_self_publish.py
#! /usr/bin/env python from __future__ import print_function import sys import json import shutil import argparse def copy_package(location, destination): shutil.copytree(location, destination) def package_name(url): """ get the package name from a github url """ project = url.split('/')[-1].split('.')[...
Python
0
a004611ceb3402c95675a749eb9a3db764c97e51
Move cython_build_ext command to utils.distutils and put it to setup.cfg
edgedb/lang/common/distutils.py
edgedb/lang/common/distutils.py
## # Copyright (c) 2014 Sprymix Inc. # All rights reserved. # # See LICENSE for details. ## from distutils.command import build_ext as _build_ext class cython_build_ext(_build_ext.build_ext): def __init__(self, *args, **kwargs): self._ctor_args = args self._ctor_kwargs = kwargs self._cyt...
Python
0
d05de03f258c215ce0a23023e5c15b057fbf7283
add missing import
s2plib/fusion.py
s2plib/fusion.py
# Copyright (C) 2015, Carlo de Franchis <carlo.de-franchis@cmla.ens-cachan.fr> # Copyright (C) 2015, Gabriele Facciolo <facciolo@cmla.ens-cachan.fr> # Copyright (C) 2015, Enric Meinhardt <enric.meinhardt@cmla.ens-cachan.fr> # Copyright (C) 2015, Julien Michel <julien.michel@cnes.fr> from __future__ import print_functi...
# Copyright (C) 2015, Carlo de Franchis <carlo.de-franchis@cmla.ens-cachan.fr> # Copyright (C) 2015, Gabriele Facciolo <facciolo@cmla.ens-cachan.fr> # Copyright (C) 2015, Enric Meinhardt <enric.meinhardt@cmla.ens-cachan.fr> # Copyright (C) 2015, Julien Michel <julien.michel@cnes.fr> from __future__ import print_functi...
Python
0.000001
bc235b15bbeacf7fee7e1d23a5d94b6271e33e41
Add initial code
rpsls.py
rpsls.py
#!/usr/bin/python from collections import OrderedDict from random import choice, seed from sys import exit WEAPONS = OrderedDict([ ('rock', 1), ('paper', 2), ('scissors', 3), ('lizard', 5), ('spock', 4) ]) EXPLANATIONS = { 'lizardlizard': 'Lizard equals lizard', 'lizardpaper': 'Lizard e...
Python
0.000003
43c74dc2dbe82a30f7a9b6c0403db39eb159fc96
add control panel test for fetch
paystackapi/tests/test_cpanel.py
paystackapi/tests/test_cpanel.py
import httpretty from paystackapi.tests.base_test_case import BaseTestCase from paystackapi.cpanel import ControlPanel class TestPage(BaseTestCase): @httpretty.activate def test_fetch_payment_session_timeout(self): """Method defined to test fetch payment session timeout.""" httpretty.registe...
Python
0
233db6d2decad39c98bf5cbe8b974f93308bea16
Create re.py
python2.7/re.py
python2.7/re.py
#/usr/bin/python import re #Shows how to test if a string matches a regular expression (yes/no) and uses more than one modifier expression = re.compile(r"^\w+.+string", re.I | re.S) #compile the expression if expression.match("A Simple String To Test"): #See if a string matches it print "Matched" else: print "Did N...
Python
0.000001
d93916b1927f0ae099cee3cf93619d3113db147b
Add small example of basic anomaly detection w/peewee.
examples/anomaly_detection.py
examples/anomaly_detection.py
import math from peewee import * db = SqliteDatabase(':memory:') class Reg(Model): key = TextField() value = IntegerField() class Meta: database = db db.create_tables([Reg]) # Create a user-defined aggregate function suitable for computing the standard # deviation of a series. @db.aggregate('...
Python
0
12b334983be4caf0ba97534b52f928180e31e564
add quick script to release lock
release-lock.py
release-lock.py
from batch import Lock lock = Lock(key="charge-cards-lock") lock.release()
Python
0
687a186bd29eb1bef7a134fa5499c9b4c56abaa6
Create setup.py
setup.py
setup.py
from distutils.core import setup import py2exe, os, pygame origIsSystemDLL = py2exe.build_exe.isSystemDLL def isSystemDLL(pathname): if os.path.basename(pathname).lower() in ["sdl_ttf.dll"]: return 0 return origIsSystemDLL(pathname) py2exe.build_exe.isSystemDLL = isSystemDLL pygamedir = os.path.split(py...
Python
0.000001
77ca6d5e6ef7e07ede92fa2b4566a90c31fd7845
Bump grappelli and filebrowser versions.
setup.py
setup.py
from __future__ import with_statement import os exclude = ["mezzanine/project_template/dev.db", "mezzanine/project_template/local_settings.py"] exclude = dict([(e, None) for e in exclude]) for e in exclude: if e.endswith(".py"): try: os.remove("%sc" % e) except: ...
from __future__ import with_statement import os exclude = ["mezzanine/project_template/dev.db", "mezzanine/project_template/local_settings.py"] exclude = dict([(e, None) for e in exclude]) for e in exclude: if e.endswith(".py"): try: os.remove("%sc" % e) except: ...
Python
0
8dfdcfa0f1d13e810a6e56e0a031f15dbaba3656
Use environment metadata for conditional dependencies
setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import djangocms_blog try: from setuptools import setup except ImportError: from distutils.core import setup version = djangocms_blog.__version__ if sys.argv[-1] == 'publish': os.system('python setup.py sdist upload') print("You pro...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import djangocms_blog try: from setuptools import setup except ImportError: from distutils.core import setup version = djangocms_blog.__version__ if sys.argv[-1] == 'publish': os.system('python setup.py sdist upload') print("You pro...
Python
0
2e57e929db19ebd864680d4616eb1bba595f1e57
Create setup.py
setup.py
setup.py
from distutils.core import setup setup( name = 'fram3w0rk-python', packages = ['fram3w0rk-python'], version = '0.5', description = '"Class" effort to unify functions across 30 languages.', author = 'Jonathan Lawton', author_email = 'jlawton@lawtonsoft.com', url = 'https://github.com/LawtonSoft/Fram3w0rk-P...
Python
0.000001
b0184d74d0f186662df8596f511f95e1130bcf20
Add libffi package
rules/libffi.py
rules/libffi.py
import xyz import os import shutil class Libffi(xyz.BuildProtocol): pkg_name = 'libffi' def configure(self, builder, config): builder.host_lib_configure(config=config) rules = Libffi()
Python
0
e846a9c77f98e61287a37953fdbee570208dd2d5
add setup.py for python packaging
setup.py
setup.py
"""A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.absp...
Python
0.000001
b1d08df29b02c107bbb2f2edc9add0c6f486c530
Add app
app.py
app.py
# coding: utf-8 import json import flask from flask import request import telegram __name__ = u'eth0_bot' __author__ = u'Joker_Qyou' __config__ = u'config.json' app = flask.Flask(__name__) app.debug = False with open(__config__, 'r') as cfr: config = json.loads(cfr.read()) bot = telegram.Bot(token=token_info) ...
Python
0.000002
69f787a69e400b69fa4aef2e49f6f03781304dae
Update setup.py.
setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from astm.version import __version__ try: from setuptools import setup, find_...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from astm.version import __version__ try: from setuptools import setup, find_...
Python
0
19b6d71e17f616bed3566d5615b5938bbfe3a497
Add setup.py
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name='hydrus', version='0.0.1', description='A space-based application for W3C HYDRA Draft', author='W3C HYDRA development group', author_email='public-hydra@w3.org', url='https://github.com/HTTP-APIs/hydrus', packages=['...
Python
0.000001
e2ae0798424d4aa0577e22d563646856866fbd1f
add setup.py file for pypi
setup.py
setup.py
import os from setuptools import setup, find_packages import versioncheck def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='django-versioncheck', version=versioncheck.__version__, description='A small django app which tries to be annoying if your django...
Python
0
d43bcc978b1d79a20820ab1df73bd69d5d3c100d
Add setup.py
setup.py
setup.py
from setuptools import find_packages from setuptools import setup VERSION = '0.0.1' setup_args = dict( name='BigQuery-Python', description='Simple Python client for interacting with Google BigQuery.', url='https://github.com/tylertreat/BigQuery-Python', version=VERSION, license='Apache', packa...
Python
0.000001
840e178a85da246d8357481a8e6ea5a8d87deef7
Create setup.py
setup.py
setup.py
""" KonF'00' ~~~~~~~~ KonFoo is a Python Package for creating byte stream mappers in a declarative way with as little code as necessary to help fighting the confusion with the foo of the all too well-known memory dumps or binary data. Setup ----- .. code:: bash $ pip install KonFoo Links ----- * `website <http:...
Python
0.000001
10ccc510deab5c97ce8a6c5ee57232c5e399986e
Add decision tree classifier attempt.
decision_tree.py
decision_tree.py
import pandas as pd from sklearn import tree # X = [[0, 1], [1, 1]] # Y = [0, 1] #clf = tree.DecisionTreeClassifier() #clf = clf.fit(X, Y) data = pd.read_excel('/home/andre/sandbox/jhu-immuno/journal.pcbi.1003266.s001-2.XLS') resp_cols = [ 'MHC' ] data['y'] = data.Immunogenicity.map({'non-immunogenic': 0, 'immunoge...
Python
0.000004
efe596e3f935fe31af5bcbd8ef1afbb6750be123
add a setup.py
setup.py
setup.py
"""Set up the kd project""" from setuptools import setup import kd setup( name='kd', version=kd.__version__, url='https://github.com/jalanb/kd', license='MIT License', author='J Alan Brogan', author_email='kd@al-got-rhythm.net', description='kd is a smarter cd', platforms='any', ...
Python
0.000001
9220523e6bcac6b80410a099b2f2fd30d7cbb7d3
Add first draft of setup.py
setup.py
setup.py
from setuptools import setup setup( name = 'pyAPT', version = '0.1.0', author = 'Christoph Weinsheimer', author_email = 'christoph.weinsheimer@desy.de', packages = ['pyAPT'], scripts = [], description = 'Controller module for Thorlabs...
Python
0
49a7fdc78cd71b75b1fbcc0023e428479ce38f41
Implement a cryptographic hash function
sha_1.py
sha_1.py
#!/usr/local/bin/python """ sha_1.py @author Elliot and Erica """ from cryptography_utilities import (wrap_bits_left, decimal_to_binary, binary_to_decimal, pad_plaintext, block_split, bitwise_and, bitwise_or, bitwise_xor, bitwise_not, hex_to_binary) BLOCKSIZE = 512 SUB_BLOCKSIZE = 32 SHA_1_INTERVALS = 80 ...
Python
0.999999
d923548321961bad8dcbe15a31ceaeda79aae934
Create xr.py
xr.py
xr.py
#!/usr/bin/env python # -*- coding: utf8 -*- '''Element Manager xr class''' __author__ = "Arnis Civciss (arnis.civciss@lattelecom.lv)" __copyright__ = "Copyright (c) 2012 Arnis Civciss" #__version__ = "$Revision: 0.1 $" #__date__ = "$Date: 2012/01/08 $" #__license__ = "" import re from lib.telnet import Telnet clas...
Python
0.00001
31d018181c5183acadbe309a250aed17cbae5a28
Create Add_Binary.py
Array/Add_Binary.py
Array/Add_Binary.py
Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". class Solution: # @param a, a string # @param b, a string # @return a string def addBinary(self, a, b): A = len(a) B = len(b) i = 1 result = [] carry =...
Python
0.000002
12192eca146dc1974417bd4fd2cf3722e0049910
add arduino example
example/ard2rrd.py
example/ard2rrd.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Arduino UNO A0 value to RRD db # - read an integer from a serial port and store it on RRD redis database import serial from pyRRD_Redis import RRD_redis, StepAddFunc # some const TAG_NAME = 'arduino_a0' # init serial port and RRD db ser = serial.Serial(port='/dev/tt...
Python
0.000046
013ee19808dc86d29cb3aa86b38dc35fe98a5580
add to and remove from /etc/hosts some agent node info so condor can recognise its workers
conpaas-services/src/conpaas/services/htcondor/manager/node_info.py
conpaas-services/src/conpaas/services/htcondor/manager/node_info.py
""" Copyright (c) 2010-2013, Contrail consortium. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions ...
Python
0.000004
2f47284b44ceef3c12990a4f9621062040fe6fcb
Add day 4 solution
day4.py
day4.py
#!/usr/bin/env python from hashlib import md5 tests = ['abcdef', 'pqrstuv'] string = 'iwrupvqb' for idx in range(10000000): hash = md5((string + str(idx)).encode('ascii')) if hash.hexdigest().startswith('000000'): print(idx) break
Python
0.001388
e5008fdf481a80db3b5583d35e6fd369a28cd7ce
drop session_details for sessions
example/__init__.py
example/__init__.py
from pupa.scrape import Jurisdiction from .people import PersonScraper class Example(Jurisdiction): jurisdiction_id = 'ocd-jurisdiction/country:us/state:ex/place:example' name = 'Example Legislature' url = 'http://example.com' provides = ['people'] parties = [ {'name': 'Independent' }, ...
from pupa.scrape import Jurisdiction from .people import PersonScraper class Example(Jurisdiction): jurisdiction_id = 'ocd-jurisdiction/country:us/state:ex/place:example' name = 'Example Legislature' url = 'http://example.com' provides = ['people'] parties = [ {'name': 'Independent' }, ...
Python
0
863fbee6edc89b68412831677391bc51e41a1e03
add combine program
final-project/code/combine.py
final-project/code/combine.py
#!/usr/bin/env python import argparse import os import re import time import pandas as pd import numpy as np COORD_COLUMNS = [ "left_eye_center_x", "left_eye_center_y", "right_eye_center_x", "right_eye_center_y", "left_eye_inner_corner_x", "left_eye_inner_corner_y", "left_ey...
Python
0
04bc7c9bfe017f981a73a55b51587343725a2159
edit 2
Floris/dexter.py
Floris/dexter.py
serie = { 'seasons': [ { 'name': 'S01', 'year': 2006, 'director': "James Manos Jr.", 'episodes': [ {'name': 's01e01', 'title': "Pilot"}, {'name': 's01e01', 'title': "Crocodile"}, {'name': 's01e01', 'title': "Popping Cherry"}, {'name': 's01e01', 'title': "Let's give the boy a hand"} ]...
Python
0
cd9c9080a00cc7e05b5ae4574dd39ddfc86fef3b
Create enc.py
enc.py
enc.py
#!/usr/bin/python """ Generate encrypted messages wrapped in a self-decrypting python script usage: python enc.py password > out.py where password is the encryption password and out.py is the message/script file to decrypt use: python out.py password this will print the message to stdout. """ import sys, random def e...
Python
0.000001
8adfedd0c30fab796fccac6ec58c09e644a91b2f
Add script to shuffle paired fastq sequences.
shuffle_fastq.py
shuffle_fastq.py
# shuffles the sequences in a fastq file import os import random from Bio import SeqIO import fileinput from argparse import ArgumentParser if __name__ == "__main__": parser = ArgumentParser() parser.add_argument("--fq1", required="True") parser.add_argument("--fq2", required="True") args = parser.pars...
Python
0
f9e11b0e9eb5a69adaa2021499acf329023aca09
Add Python bindings
ini.py
ini.py
from ctypes import POINTER, Structure, cdll, c_char_p, c_int, c_uint, byref from sys import argv def _checkOpen(result, func, arguments): if result: return result else: raise IOError("Failed to open INI file: '%s'" % arguments[0]) def _checkRead(result, func, arguments): if result == -1: raise SyntaxError("E...
Python
0.000002
b7f9e5555481ba4e34bcc12beecf540d3204a15f
Fix pep8 issue
raven/contrib/celery/__init__.py
raven/contrib/celery/__init__.py
""" raven.contrib.celery ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ try: from celery.task import task except ImportError: from celery.decorators import task from celery.signals import task_failure from ra...
""" raven.contrib.celery ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ try: from celery.task import task except ImportError: from celery.decorators import task from celery.signals import task_failure from ra...
Python
0
dba14e6dfbaacf79d88f1be0b831488f45fc1bfc
Create coroutine.py
gateway/src/test/coroutine.py
gateway/src/test/coroutine.py
#!/usr/bin/python3.5 import asyncio import time now = lambda: time.time() async def func(x): print('Waiting for %d s' % x) await asyncio.sleep(x) return 'Done after {}s'.format(x) start = now() coro1 = func(1) coro2 = func(2) coro3 = func(4) tasks = [ asyncio.ensure_future(coro1), asyncio.ensure...
Python
0.000006
b9d47f54b76345f0c8f7d486282fc416ba540aee
Add specs for ArgumentParser
tests/test_argument_parser.py
tests/test_argument_parser.py
import pytest from codeclimate_test_reporter.components.argument_parser import ArgumentParser def test_parse_args_default(): parsed_args = ArgumentParser().parse_args([]) assert(parsed_args.file == "./.coverage") assert(parsed_args.token is None) assert(parsed_args.stdout is False) assert(parsed...
Python
0
614579c38bea10798d285ec2608650d36369020a
add test demonstrating duplicate stream handling
tests/test_invalid_streams.py
tests/test_invalid_streams.py
import fixtures import dnfile def test_duplicate_stream(): path = fixtures.DATA / "invalid-streams" / "duplicate-stream.exe" dn = dnfile.dnPE(path) assert "#US" in dn.net.metadata.streams assert dn.net.user_strings.get_us(1).value == "BBBBBBBB"
Python
0
ffb5caf83055e734baf711366b6779ecb24a013c
Add script to generate other adobe themes
addons/adobe/clone.py
addons/adobe/clone.py
#!/usr/bin/env python from PIL import Image, ImageEnhance import PIL.ImageOps import fnmatch import shutil import os def globPath(path, pattern): result = [] for root, subdirs, files in os.walk(path): for filename in files: if fnmatch.fnmatch(filename, pattern): result.appen...
Python
0
c5ecaef62d788b69446181c6ba495cb273bf98ef
Add rolling mean scatter plot example
altair/examples/scatter_with_rolling_mean.py
altair/examples/scatter_with_rolling_mean.py
""" Scatter Plot with Rolling Mean ------------------------------ A scatter plot with a rolling mean overlay. In this example a 30 day window is used to calculate the mean of the maximum temperature around each date. """ # category: scatter plots import altair as alt from vega_datasets import data source = data.seatt...
Python
0.000002
5ec793ffb8c260a02ab7da655b5f56ff3c3f5da7
add find_anagrams.py
algo/find_anagrams.py
algo/find_anagrams.py
words = "oolf folo oolf lfoo fool oofl fool loof oofl folo abr bra bar rab rba abr arb bar abr abr" words = [word.strip() for word in words.split(" ")] anagrams = {} for word in words: sorted_word = ''.join(sorted(word)) anagrams[sorted_word] = anagrams.get(sorted_word, []) + [word] print anagrams
Python
0.000321
f830c778fd06e1548da0b87aafa778834005c64e
Add fls simprocedures
angr/procedures/win32/fiber_local_storage.py
angr/procedures/win32/fiber_local_storage.py
import angr KEY = 'win32_fls' def mutate_dict(state): d = dict(state.globals.get(KEY, {})) state.globals[KEY] = d return d def has_index(state, idx): if KEY not in state.globals: return False return idx in state.globals[KEY] class FlsAlloc(angr.SimProcedure): def run(self, callback):...
Python
0
1bda23c9e6fee7815617a8ad7f64c80a32e223c5
Add script for jira story point report.
scripts/jira.py
scripts/jira.py
#!/usr/bin/python import sys import os import requests import urllib g_user = None g_pass = None g_sprint = None def usage(): print("") print("usage: " + g_script_name + " --user username --pass password --sprint sprintname") print("") sys.exit(1) def unknown_arg(s): print("") print("ERR...
Python
0
a24095964e32da33ea946b3c28bdc829a505585d
Add lidar example
lidar.py
lidar.py
""" Copyright 2021 CyberTech Labs Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wr...
Python
0.000001
ccf1fb5d5ef1e2b12bc49afd260b1d2d0a166a43
Prepare v2.20.7.dev
flexget/_version.py
flexget/_version.py
""" Current FlexGet version. This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by release scripts in continuous integration. Should (almost) never be set manually. The version should always be set to the <next release version>.dev The jenkins release job wi...
""" Current FlexGet version. This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by release scripts in continuous integration. Should (almost) never be set manually. The version should always be set to the <next release version>.dev The jenkins release job wi...
Python
0.000003
950e6b975323293ed8b73a5ffe8448072e0dac27
Fix downloader
support/download.py
support/download.py
# A file downloader. import contextlib, os, tempfile, timer, urllib2, urlparse class Downloader: def __init__(self, dir=None): self.dir = dir # Downloads a file and removes it when exiting a block. # Usage: # d = Downloader() # with d.download(url) as f: # use_file(f) def download(self, url, c...
# A file downloader. import contextlib, os, tempfile, timer, urllib2, urlparse class Downloader: def __init__(self, dir=None): self.dir = dir # Downloads a file and removes it when exiting a block. # Usage: # d = Downloader() # with d.download(url) as f: # use_file(f) def download(self, url, c...
Python
0.000001
7c84bfb5a37705cc824489b0c1c5aba415ccff6b
Split out of SWDCommon.py
DebugPort.py
DebugPort.py
class DebugPort: ID_CODES = ( 0x1BA01477, # EFM32 0x2BA01477, # STM32 0x0BB11477, # NUC1xx ) def __init__ (self, swd): self.swd = swd # read the IDCODE # Hugo: according to ARM DDI 0316D we should have 0x2B.. not 0x1B.., but # 0x1B.. is what upstr...
Python
0.000002
aaa3e5296f1e22bb5960c553f5e5b42f64d216db
Create HMM.py
HMM.py
HMM.py
#By Mohit Minhas import math import numpy #from sklearn.hmm import MultinomialHMM #from hmmn import * from hmmpy import * from sklearn.cluster import k_means #from scipy.cluster.vq import kmeans2 def get_xyz_data(path,name): xfl=path+'\\'+name+'_x.csv' xx = numpy.genfromtxt(xfl, delimiter=',') yfl=path+'...
Python
0.000001
bdd2fcfdc9444cdf2d74ac9397bd01bfe34f102a
Create a test for a quadtree-based gravity forward and inverse model. This ensures equivalent source modelling is accessible.
tests/pf/test_grav_inversion_linear_quadtree.py
tests/pf/test_grav_inversion_linear_quadtree.py
from __future__ import print_function import unittest import numpy as np from SimPEG import ( utils, maps, regularization, data_misfit, optimization, inverse_problem, directives, inversion, ) from discretize.utils import mkvc, mesh_builder_xyz, refine_tree_xyz from SimPEG.potential_field...
Python
0
570aaad3da93f9252efb787a58bbe5151eff93d4
Create run_ToolKit.py
0.0.5/run_ToolKit.py
0.0.5/run_ToolKit.py
# run_ToolKit.py from modulos import main if __name__ == "__main__": main.main()
Python
0.000002
857ccf7f6cfed4e8663d635c119f8683c9ee09e0
Add random choice plugin (with_random_choice)
lib/ansible/runner/lookup_plugins/random_choice.py
lib/ansible/runner/lookup_plugins/random_choice.py
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any lat...
Python
0
b3f91806b525ddef50d541f937bed539f9bae20a
Use cache backend for sessions in deployed settings.
mezzanine/project_template/deploy/live_settings.py
mezzanine/project_template/deploy/live_settings.py
DATABASES = { "default": { # Ends with "postgresql_psycopg2", "mysql", "sqlite3" or "oracle". "ENGINE": "django.db.backends.postgresql_psycopg2", # DB name or path to database file if using sqlite3. "NAME": "%(proj_name)s", # Not used with sqlite3. "USER": "%(proj_na...
DATABASES = { "default": { # Ends with "postgresql_psycopg2", "mysql", "sqlite3" or "oracle". "ENGINE": "django.db.backends.postgresql_psycopg2", # DB name or path to database file if using sqlite3. "NAME": "%(proj_name)s", # Not used with sqlite3. "USER": "%(proj_na...
Python
0
62545500553443863d61d9e5ecc80307c745a227
Add migration to remove non-{entity,classifier} dimensions from the database, and to recompute cubes if necessary
migrate/20110917T143029-remove-value-dimensions.py
migrate/20110917T143029-remove-value-dimensions.py
import logging from openspending.lib import cubes from openspending import migration, model, mongo log = logging.getLogger(__name__) def up(): group_args = ({'dataset':1}, {}, {'num': 0}, 'function (x, acc) { acc.num += 1 }') before = mongo.db.dimension.group(*group_args) dims = model....
Python
0.000001
87cbdd44ee17ecc5951b6f062a160c9fad465053
add BaiduMap
BaiduMap/__init__.py
BaiduMap/__init__.py
import png, numpy import matplotlib.pyplot as plt import json, urllib.request, collections.abc, os, sys from urllib.parse import quote_plus from collections import OrderedDict AK = None SERVER_URL = None __location__ = os.path.join(os.getcwd(), os.path.dirname(os.path.realpath(__file__))) with open(os.path.join(__l...
Python
0.000001
c599b5d470cf80b964af1b261a11540516e120df
Add Dehnen smoothing as a wrapper
galpy/potential_src/DehnenSmoothWrapperPotential.py
galpy/potential_src/DehnenSmoothWrapperPotential.py
############################################################################### # DehnenSmoothWrapperPotential.py: Wrapper to smoothly grow a potential ############################################################################### from galpy.potential_src.WrapperPotential import SimpleWrapperPotential class DehnenSm...
Python
0
ddc61e8158fb1dfb33b30a19f7e9cd3be8eaf3a2
add app.py
app.py
app.py
from flask import Flask app = Flask(__name__) if __name__ == "__main__": app.run(host='0.0.0.0', port=5000, debug=True)
Python
0.000003
cab4b903b986a7f8bfe4955bf80190bb7f33b012
Create bot.py
bot.py
bot.py
# -*- coding: utf-8 -*- import twitter_key import tweepy import markovtweet def auth(): auth = tweepy.OAuthHandler(twitter_key.CONSUMER_KEY, twitter_key.CONSUMER_SECRET) auth.set_access_token(twitter_key.ACCESS_TOKEN, twitter_key.ACCESS_SECRET) return tweepy.API(auth) if __name__ == "__main__": api = ...
Python
0.000001
f1b11d2b111ef0b70f0babe6e025056ff1a68acc
Create InMoov.LeapMotionHandTracking.py
home/Alessandruino/InMoov.LeapMotionHandTracking.py
home/Alessandruino/InMoov.LeapMotionHandTracking.py
i01 = Runtime.createAndStart("i01","InMoov") #Set here the port of your InMoov Left Hand Arduino , in this case COM5 leftHand = i01.startLeftHand("COM5") #============================== #Set the min/max values for fingers i01.leftHand.thumb.setMinMax( 0, 61) i01.leftHand.index.map(0 , 89) i01.leftHand.majeure.map(0 ...
Python
0
ddf940dc932c04ebd287085ec7d035a93ac5598f
add findmyiphone flask api
ios.py
ios.py
from pyicloud import PyiCloudService from flask import Flask, jsonify, request, abort api = PyiCloudService('nikisweeting@gmail.com') app = Flask(__name__) @app.route('/devices', methods=['GET']) def device_list(): devices = [] for id, device in api.devices.items(): location_info = device.location(...
Python
0.000001
81791b79fca6b23436518cf94b79175bd6ec06e7
Create lcd.py
lcd.py
lcd.py
#!/usr/bin/python #-------------------------------------- # ___ ___ _ ____ # / _ \/ _ \(_) __/__ __ __ # / , _/ ___/ /\ \/ _ \/ // / # /_/|_/_/ /_/___/ .__/\_, / # /_/ /___/ # # lcd_i2c.py # LCD test script using I2C backpack. # Supports 16x2 and 20x4 screens. # # Author : Matt Hawkins # D...
Python
0.000023
bb7bb2e12d3ccbb55f0b0e6db5d0cb79c3ea8079
Add missing migration for profile items.
km_api/know_me/migrations/0013_remove_profileitem_media_resource.py
km_api/know_me/migrations/0013_remove_profileitem_media_resource.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-08-01 14:16 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('know_me', '0012_emergencyitem'), ] operations = [ migrations.RemoveField( ...
Python
0
a0b9d1977b2aa2366a334231b4dd5dbe047d7122
Add testcase for Category.can_create_events
indico/modules/categories/models/categories_test.py
indico/modules/categories/models/categories_test.py
# This file is part of Indico. # Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). # # Indico is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (a...
Python
0.000021
eb54c75c0f5b7e909177777ce935358b7ac25def
Add zip and unzip to zip_file
py_sys/file/zip_file.py
py_sys/file/zip_file.py
# coding=utf-8 import os import zipfile class ZipFile(object): def __init__(self): pass def zip(self, dir_path, zip_file): file_list = [] def walk_dir(sub_dir): for root, dirs, files in os.walk(sub_dir): for _file in files: ...
Python
0.000001
e27b005e5dc797e2326ab175ef947021c5a85cb7
Add ptt.py
ptt.py
ptt.py
import telnetlib import re RN = '\r\n' C_L = '\x0C' C_Z = '\x1A' ESC = '\x1B' class PTT(): def __init__(self): self.ptt = telnetlib.Telnet('ptt.cc') self.where = 'login' def login(self, username, password, dup=False): self.__wait_til('่จปๅ†Š: ', encoding='big5') self.__send(userna...
Python
0.000122
eef2dff2855ef310dbdb6b864a92306cae724ed7
add missing the missing file exceptions.py
pyecharts/exceptions.py
pyecharts/exceptions.py
class NoJsExtension(Exception): pass
Python
0.000003
0d3255f8a69fe5192cb36ee42a731293cfd09715
Add VmCorTaxonPhenology Class
backend/geonature/core/gn_profiles/models.py
backend/geonature/core/gn_profiles/models.py
from geonature.utils.env import DB from utils_flask_sqla.serializers import serializable @serializable class VmCorTaxonPhenology(DB.Model): __tablename__ = "vm_cor_taxon_phenology" __table_args__ = {"schema": "gn_profiles"} cd_ref = DB.Column(DB.Integer) period = DB.Column(DB.Integer) id_nomenclatu...
Python
0
18d40200224d68b0ce93c2710516ed63566b1ad3
Add merge migration
osf/migrations/0127_merge_20180822_1927.py
osf/migrations/0127_merge_20180822_1927.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-08-22 19:27 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('osf', '0124_merge_20180816_1229'), ('osf', '0126_update_review_group_names'), ] op...
Python
0.000001
a55fee4515c9e6187198a8fc27ec15e7786d5782
Create utils.py
utils.py
utils.py
#!/usr/bin/env python '''Python script that must be kept with all of these plugins''' def color(color, message): '''color forground/background encoding IRC messages''' colors = {'white': '00', 'black': '01', 'blue': '02', 'navy': '02', 'green': '03', 'red': '04', 'brown': '05', 'maroon': '0...
Python
0.000001
36e6ff93b270672e0918e5ac0d7f9698834ad6ae
add Pathfinder skeleton
game/pathfinding.py
game/pathfinding.py
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. """pathfinding.py: """ class Pathfinder(object): def __init__(self, size_x, size_y): self._size_x = size_x...
Python
0
ca956d335ad6bf6e190869d98c7abb3b554dfa3d
Create TS3IdleBot.py
TS3IdleBot.py
TS3IdleBot.py
import telnetlib import time from config import config def getClients(): print "Getting a list of clients." telnet.write("clientlist -times\n") clients = telnet.read_until("msg=ok") clients = clients.replace(" ", "\n") clients = clients.replace("\r", "") clients = clients.split("|") cLen =...
Python
0
ae0ebdccfffffbad259842365712bd4b6e52fc8e
add test files for HDF5 class and read_feats function
sprocket/util/tests/test_hdf5.py
sprocket/util/tests/test_hdf5.py
from __future__ import division, print_function, absolute_import import os import unittest import numpy as np from sprocket.util.hdf5 import HDF5, read_feats dirpath = os.path.dirname(os.path.realpath(__file__)) listf = os.path.join(dirpath, '/data/test.h5') class hdf5FunctionsTest(unittest.TestCase): def test...
Python
0
26fcbefee171f8d56504a7eba121027f0c5be8b5
Add migration for new overrides table
lms/djangoapps/grades/migrations/0013_persistentsubsectiongradeoverride.py
lms/djangoapps/grades/migrations/0013_persistentsubsectiongradeoverride.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('grades', '0012_computegradessetting'), ] operations = [ migrations.CreateModel( name='PersistentSubsectionGradeO...
Python
0
e5d3fea99d58a1b02ebe84148d63330ea8d5c3a0
Create WordLadder.py
WordLadder.py
WordLadder.py
''' Given a source word, target word and an English dictionary, transform the source word to target by changing/adding/removing 1 character at a time, while all intermediate words being valid English words. Return the transformation chain which has the smallest number of intermediate words. '''
Python
0
4ba2f92a9712530d084823dae52f54167f2f3afb
fix test source to work with empty msgs
new_pmlib/TestSimpleSource.py
new_pmlib/TestSimpleSource.py
#========================================================================= # TestSimpleSource #========================================================================= # This class will output messages on a val/rdy interface from a # predefined list. # from new_pymtl import * from ValRdyBundle import OutValRdyBund...
#========================================================================= # TestSimpleSource #========================================================================= # This class will output messages on a val/rdy interface from a # predefined list. # from new_pymtl import * from ValRdyBundle import OutValRdyBund...
Python
0
75aabd425bd32a9467d7a06b250a0a5b1f5ba852
Add more comments
application/serializer.py
application/serializer.py
''' This module maps the data that will be used by the marshall when returning the data to the user ''' from flask_restful import fields bucket_list_item_serializer = { 'item_id': fields.Integer, 'name': fields.String, 'date_created': fields.DateTime, 'date_modified': fields.DateTime, 'done': fiel...
Python
0
da0f31d6ca5aa8f425c86b9c0caf965f062e1dba
test buying max clicks and gen clicks in the same test
functional-tests/suite6.py
functional-tests/suite6.py
from clickerft.cft import Cft from time import sleep class Suite4(Cft): def test_buy_target_max_and_gen(self): """ buy clicks until we have 50 max clicks of 50 and 10 clicks/sec """ targetGen = 4 while int(self.clicksPerGeneration.text) < targetGen: cl...
Python
0
78cbfc300a4623f4f5e3bd7726f43abdbb9ef0a3
Add mysql_connector
pythonfiles/mysql_connector.py
pythonfiles/mysql_connector.py
import mysql.connector from mysql.connector import errorcode from abc import ABCMeta, abstractmethod class connector(object): _config = { 'user': 'vda8888', 'password': '123456', 'host': '127.0.0.1', 'database': 'test', 'raise_on_warnings': True, } def __init__(self)...
Python
0.000024
158f04702b6c1dcda9981d8da05fe059e84c3f90
Add example with churches.
examples/churches.py
examples/churches.py
# -*- coding: utf-8 -*- ''' This script demonstrates using the AATProvider to get the concept of Churches. ''' from skosprovider_getty.providers import AATProvider aat = AATProvider(metadata={'id': 'AAT'}) churches = aat.get_by_id(300007466) lang = ['en', 'nl', 'es', 'de'] print('Labels') print('------') for l in ...
Python
0
7c82a2a8887d25ef86e5d0004cf0a0e0bc4b23ac
Create CodingContestTorontoParkingTickets2013.py
CodingContestTorontoParkingTickets2013.py
CodingContestTorontoParkingTickets2013.py
import re from collections import defaultdict processed_data = defaultdict(int) # dict to capture reduced dataset info, default value == 0 only_chars = re.compile('\D+').search # pre-compiled reg-exp, for fast run time, to get street name, ignoring numbers # import raw data file with parking information with open('Pa...
Python
0.000001
f8ee383cc3b3f1f9166627e81a64af4939e4de10
add amqp style routing for virtual channels, allows memory backend to behave like amqp
example/topic.py
example/topic.py
from kombu.connection import BrokerConnection from kombu.messaging import Exchange, Queue, Consumer, Producer # configuration, normally in an ini file exchange_name = "test.shane" exchange_type = "topic" exchange_durable = True message_serializer = "json" queue_name = "test.q" # 1. setup the connection to the exchang...
Python
0
aff827e9cc02bcee6cf8687e1dff65f39daaf6c6
Add a failing test to the landing page to check for upcoming events.
workshops/test/test_landing_page.py
workshops/test/test_landing_page.py
from django.core.urlresolvers import reverse from django.test import TestCase from mock import patch from datetime import date class FakeDate(date): "A fake replacement for date that can be mocked for testing." pass @classmethod def today(cls): return cls(2013, 12, 7) @patch('workshops.models...
Python
0
91918be596c83f468c6c940df7326896aa6082e7
Fix stringify on multichoice forms
adagios/forms.py
adagios/forms.py
# -*- coding: utf-8 -*- from django.utils.encoding import smart_str from django import forms class AdagiosForm(forms.Form): """ Base class for all forms in this module. Forms that use pynag in any way should inherit from this one. """ def clean(self): cleaned_data = {} tmp = super(AdagiosFo...
# -*- coding: utf-8 -*- from django.utils.encoding import smart_str from django import forms class AdagiosForm(forms.Form): """ Base class for all forms in this module. Forms that use pynag in any way should inherit from this one. """ def clean(self): cleaned_data = {} tmp = super(AdagiosFo...
Python
0.000004
cb7bb1d9f24706f3cce2e9841595ee80ce7e2c7f
Implement GetKeyboardType
angr/procedures/win_user32/keyboard.py
angr/procedures/win_user32/keyboard.py
import angr class GetKeyboardType(angr.SimProcedure): def run(self, param): # return the values present at time of author's testing if self.state.solver.is_true(param == 0): return 4 if self.state.solver.is_true(param == 1): return 0 if self.state.solver.is_t...
Python
0