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
7e68ec932cb43fc5a98828a367a51593b419bee0
Add batch normalization
thinc/neural/_classes/batchnorm.py
thinc/neural/_classes/batchnorm.py
from .model import Model class BatchNormalization(Model): def predict_batch(self, X): N, mu, var = _get_moments(self.ops, X) return _forward(self.ops, X, mu, var) def begin_update(self, X, dropout=0.0): N, mu, var = _get_moments(self.ops, X) Xhat = _forward(self.ops, X, mu,...
Python
0.000001
c99a476b396422c0a673a78eb795df1cf94b8bb5
Define base Frame object.
hyper/http20/frame.py
hyper/http20/frame.py
# -*- coding: utf-8 -*- """ hyper/http20/frame ~~~~~~~~~~~~~~~~~~ Defines framing logic for HTTP/2.0. Provides both classes to represent framed data and logic for aiding the connection when it comes to reading from the socket. """ class Frame(object): def __init__(self): self.stream = None def seriali...
Python
0
ffa67682628e0140e43ae3e886cd022aedfb9750
Fix lint warnings in api_helper.py
src/tests/ggrc/api_helper.py
src/tests/ggrc/api_helper.py
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com from ggrc.app import app from ggrc.services.common import Resource from ggrc imp...
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com from ggrc.app import app from ggrc.services.common import Resource from ggrc imp...
Python
0.00013
1696d6b1f240f8403819e3d817ae8e387ab5d08c
Add FFT checkers.
numscons/checkers/fft_checkers.py
numscons/checkers/fft_checkers.py
#! /usr/bin/env python # Last Change: Tue Dec 04 03:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys import os.path from copy import deepcopy from distutils.util import get_platform # from numpy.distutils.scons.core.libinfo import get_config_from_section, get_config # from numpy.dist...
Python
0
9b0f4062729d70ec5236ec244d5eaca7e4653b47
Test for functions in utils added
openVulnQuery/tests/test_utils.py
openVulnQuery/tests/test_utils.py
import unittest from openVulnQuery import utils from openVulnQuery import advisory mock_advisory_title = "Mock Advisory Title" mock_advisory = advisory.CVRF(advisory_id="Cisco-SA-20111107-CVE-2011-0941", sir="Medium", first_published="2011-11-07T21:36:55+0000...
Python
0
88e87392204884102b17a92581c5d5b29a258bb7
add ftpsync
openprocurement/search/ftpsync.py
openprocurement/search/ftpsync.py
# -*- coding: utf-8 -*- import os import sys import signal import os.path import logging import logging.config from ftplib import FTP from ConfigParser import ConfigParser logger = logging.getLogger(__name__) class FTPSyncApp(object): config = { 'host': '127.0.0.1', 'port': 21, 'timeout'...
Python
0
eb4294f95cb05337ef432840d9538de1275b22b4
Add routes.
web2py/routes.py
web2py/routes.py
routes_in = [ ('/', '/addrest/default/index'), ]
Python
0
e3757b20ca74e070e57dd251bf60f691922999fe
add new test file
test/test_collection.py
test/test_collection.py
import unittest from solr_instance import SolrInstance from solrcloudpy import Connection class TestCollection(unittest.TestCase): def setUp(self): self.solrprocess = SolrInstance("solr2") self.solrprocess.start() self.solrprocess.wait_ready() self.conn = Connection() d...
Python
0.000001
40dd078b5e176ae5039bf20dcb50350e8f065808
Create python script to scroll error messages
recognition/scrollError.py
recognition/scrollError.py
from sense_hat import SenseHat import sys sense = SenseHat() sense.show_message(sys.stdin.read(), scroll_speed=.08, text_colour=[255, 0, 0])
Python
0.000001
d6a53b1b8acbddc16006c0c8752b44f176aecb12
add ntuple analyser
PyAnalysisTools/AnalysisTools/NTupleAnalyser.py
PyAnalysisTools/AnalysisTools/NTupleAnalyser.py
import os from PyAnalysisTools.base import InvalidInputError from PyAnalysisTools.base.YAMLHandle import YAMLLoader from PyAnalysisTools.ROOTUtils.FileHandle import FileHandle import pathos.multiprocessing as mp try: import pyAMI.client except Exception as e: _logger.error("pyAMI not loaded") sys.exit(1) c...
Python
0
67d1382c5c36e4476c56a9cd5c2e841131b07e6c
add classMulInherit.py
classMulInherit.py
classMulInherit.py
class A(object): def __init__(self): self.a = 1 def x(self): print "A.x" def y(self): print "A.y" def z(self): print "A.z" class B(A): def __init__(self): A.__init__(self) self.a = 2 self.b = 3 def y(self): print "B.y" def z(se...
Python
0.000001
555dc74ad29b99fd4cf4c3ba97b7edfdaf8e485f
Create next-greater-element-i.py
Python/next-greater-element-i.py
Python/next-greater-element-i.py
# Time: O(m + n) # Space: O(m + n) # You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. # Find all the next greater numbers for nums1's elements in the corresponding places of nums2. # # The Next Greater Number of a number x in nums1 is the first greater number t...
Python
0.999265
b0c03b86d606c85dd1cab1ad9e9678e1057d0ae1
Add pen which draws to TrueType glyphs.
Lib/fontTools/pens/ttGlyphPen.py
Lib/fontTools/pens/ttGlyphPen.py
from __future__ import print_function, division, absolute_import from array import array from fontTools.misc.py23 import * from fontTools.pens.basePen import AbstractPen from fontTools.ttLib.tables import ttProgram from fontTools.ttLib.tables._g_l_y_f import Glyph from fontTools.ttLib.tables._g_l_y_f import GlyphCompo...
Python
0
8f7ea548c49d2ea9a8ac9e0935460dfc43ecbb75
Add stark shift related utility sequences.
QGL/BasicSequences/StarkShift.py
QGL/BasicSequences/StarkShift.py
from ..PulsePrimitives import * from ..Compiler import compile_to_hardware from ..ChannelLibraries import EdgeFactory from ..PulseSequencePlotter import plot_pulse_files from .helpers import create_cal_seqs, delay_descriptor, cal_descriptor import numpy as np from collections.abc import Iterable def StarkShiftSpectros...
Python
0
95e2e9af124595aae4801fc9813ee1c294d404cd
Change invalidtxrequest to use BitcoinTestFramework
test/functional/p2p_invalid_tx.py
test/functional/p2p_invalid_tx.py
#!/usr/bin/env python3 # Copyright (c) 2015-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test node responses to invalid transactions. In this test we connect to one node over p2p, and test tx...
#!/usr/bin/env python3 # Copyright (c) 2015-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test node responses to invalid transactions. In this test we connect to one node over p2p, and test tx...
Python
0
08447fa344e21d6d704c6f195ad2b7405fa8f916
Add test for total property
saleor/order/test_order.py
saleor/order/test_order.py
from .models import Order def test_total_property(): order = Order(total_net=20, total_tax=5) assert order.total.gross == 25 assert order.total.tax == 5 assert order.total.net == 20
Python
0
2b09a8d75e0d59bba41467210b7d0588eb4a09d5
add migration for junebug channel type
temba/channels/migrations/0050_add_junebug_channel_type.py
temba/channels/migrations/0050_add_junebug_channel_type.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.12 on 2017-01-26 15:56 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('channels', '0049_auto_20170106_0910'), ] operations = [ migrations.AlterFie...
Python
0
ace26ab5e713fabd02f4f481956c47640f50b166
Add unit test for volume limits client
tempest/tests/lib/services/volume/v2/test_limits_client.py
tempest/tests/lib/services/volume/v2/test_limits_client.py
# Copyright 2017 FiberHome Telecommunication Technologies CO.,LTD # 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/LI...
Python
0
29c268db2cbb3b4787d3e925f925a49f0df68c46
add cache UT
test/test_cache.py
test/test_cache.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Logger Class Simple encapsulation on logging functions. - Console printing - File handler and the mapping for multithreading file handlers are under design yet. .. moduleauthor:: Max Wu <http://maxwu.me> .. References:: **ReadtheDocs**: https://pythonguidecn.re...
Python
0.000001
e4b9c43d53121d2b21c4b864fcc74674b0b6dfc1
Create class to interpolate values between indexes
scratchpad/Interpolator.py
scratchpad/Interpolator.py
class Interpolator: def __init__(self): self.data = [] def addIndexValue(self, index, value): self.data.append((index, value)) def valueAtIndex(self, target_index): if target_index < self.data[0][0]: return None elif self.data[-1][0] < target_index: ...
Python
0
c3de9ebfa84fd93572d0a4ac991272609a593328
Create af_renameSG.py
scripts/af_renameSG.py
scripts/af_renameSG.py
# rename shading group name to material name but with SG ended import pymel.core as pm import re selSG = pm.ls(sl=True,fl=True) for SG in selSG: curMat = pm.listConnections(SG,d=1) for mat in curMat: if pm.nodeType(mat) == 'blinn' or pm.nodeType(mat) == 'lambert': sgNM = re.split("_mat",str(...
Python
0.000002
b8777453cf03b212f2b06ca0afeef6c780e39f51
add face_classifier.py
scripts/face_classifier.py
scripts/face_classifier.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # face_classifier.py # author: Kentaro Wada <www.kentaro.wada@gmail.com> import os import sys import collections from sklearn import svm import cv2 class FaceClassifier(object): def __init__(self, data_dir): self.data_dir = data_dir self.img_dict = c...
Python
0.000009
ef7abdab7681e496cebd1e4655a63cafcb9163db
add gafton's migration script to scripts/
scripts/migrate-dbstore.py
scripts/migrate-dbstore.py
#!/usr/bin/python import sys import os if 'CONARY_PATH' in os.environ: sys.path.insert(0, os.environ['CONARY_PATH']) from conary import dbstore from conary.dbstore import sqlerrors from conary.repository.netrepos import schema if len(sys.argv) != 3: print "Usage: migrate <sqlite_path> <mysql_spec>" sqlite =...
Python
0
36781fb1b04a3d2fd3162ea88969244faab22a60
Convert GML to EWKT, via PostGIS
open511/utils/postgis.py
open511/utils/postgis.py
from django.db import connection def gml_to_ewkt(gml_string, force_2D=False): cursor = connection.cursor() if force_2D: sql = 'SELECT ST_AsEWKT(ST_Force_2D(ST_GeomFromGML(%s)))' else: sql = 'SELECT ST_AsEWKT(ST_GeomFromGML(%s))' cursor.execute(sql, [gml_string]) return cursor.fetcho...
Python
0.002223
aa320244cc03fe299aa33057c8b92a6c2352a5fd
Add tracer for sqlalchemy
osprofiler/sqlalchemy.py
osprofiler/sqlalchemy.py
# Copyright 2013 OpenStack Foundation. # 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 req...
Python
0.000063
eefef8a5917243b75065441d46db19cbd65a7f1d
Create debounce decorator
mopidy_headless/decorator.py
mopidy_headless/decorator.py
import time def debounce(wait): """ Wait before calling a function again, discarding any calls in between """ def decorator(fn): def wrapped(*args, **kwargs): now = time.time() if wrapped.last is not None: delta = now - wrapped.last if del...
Python
0
b2e059ce247de4b083c059d1ffe925983c262183
add test cases
tests/test_fast.py
tests/test_fast.py
from unittest import TestCase import numpy as np class TestFast(TestCase): def test_clip_grad(self): from vlgp import fast np.random.seed(0) n = 100 x = np.random.randn(n) x_clipped = fast.clip_grad(x, bound=1.0) self.assertTrue(np.all(np.logical_and(x_clipped >= ...
Python
0.003542
3fc118da6cdc29f4867dc33319ca56f4f3731346
add leetcode 121
leetcode/121.py
leetcode/121.py
#!/usr/bin/env python """ Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit. """ class Solution(object): def maxProfit...
Python
0.000137
16ad7991c22b4d9834a5db57912789d825a0cefb
Add unit tests
tests/test_util.py
tests/test_util.py
import util from nose.tools import assert_equal class TestPick(): def check(self, filenames, expected, k, randomized): result = util.pick(filenames, k, randomized) assert_equal(result, expected) def test_all_sequential(self): filenames = ['a-4.txt', 'b-2.txt', 'c-3.txt', 'd-1.txt', '...
Python
0.000001
fcc92760db0d1dc56aca70aff69b34a29c9e8e6c
Add unit tests for the methods in util
tests/test_util.py
tests/test_util.py
from lib import util def test_cachedproperty(): class Target: def __init__(self): self.call_count = 0 @util.cachedproperty def prop(self): self.call_count += 1 return self.call_count t = Target() assert t.prop == t.prop == 1 def test_deep_get...
Python
0
a1fc7311ddc50eb43f43fc51d3290f2c91fd4fa1
Update cheapest-flights-within-k-stops.py
Python/cheapest-flights-within-k-stops.py
Python/cheapest-flights-within-k-stops.py
# Time: O((|E| + |V|) * log|V|) = O(|E| * log|V|) # Space: O(|E| + |V|) = O(|E|) # There are n cities connected by m flights. Each fight starts from city u and arrives at v with a price w. # # Now given all the cities and fights, together with starting city src and the destination dst, # your task is to find the chea...
# Time: O((|E| + |V|) * log|V|) = O(|E| * log|V|) # Space: O(|E| + |V|) # There are n cities connected by m flights. Each fight starts from city u and arrives at v with a price w. # # Now given all the cities and fights, together with starting city src and the destination dst, # your task is to find the cheapest pric...
Python
0
33bcc472fdc780154403eb1616114957ce9e2b21
refactor app creation/run so tests can spin up an instance
dataactbroker/app.py
dataactbroker/app.py
import os import sys import inspect import traceback import json from flask.ext.cors import CORS from flask.ext.bcrypt import Bcrypt from flask import Flask from dataactcore.utils.cloudLogger import CloudLogger from dataactcore.utils.jsonResponse import JsonResponse from dataactbroker.handlers.aws.sesEmail import sesEm...
import os import sys import inspect import traceback import json from flask.ext.cors import CORS from flask.ext.bcrypt import Bcrypt from flask import Flask from dataactcore.utils.cloudLogger import CloudLogger from dataactcore.utils.jsonResponse import JsonResponse from dataactbroker.handlers.aws.sesEmail import sesEm...
Python
0.000001
1c41bc4d06ad2209ddd6fe79621cabd210b94589
Add __init__
demcoreg/__init__.py
demcoreg/__init__.py
#! /usr/bin/env python
Python
0.000917
97671650987d74c6281e56f3f4e1950f2d996d5b
upgrade version...
setup.py
setup.py
#!/usr/bin/python # Copyright (c) 2010 OpenStack, LLC. # # 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 ...
#!/usr/bin/python # Copyright (c) 2010 OpenStack, LLC. # # 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 ...
Python
0
e123f31a2a863491bb6353336038e7d324475bc9
Add setuptools for install
setup.py
setup.py
from setuptools import setup setup( name='netbyte', version='0.4', url='http://www.sc0tfree.com', license='MIT License', author='sc0tfree', author_email='henry@sc0tfree.com', description='Netbyte is a Netcat-style tool that facilitates probing proprietary TCP and UDP services. It is lightwe...
Python
0
6e805995a165f923c1c4f71c163c64a245f9a3d5
Add simple distutils script for modules
setup.py
setup.py
from distutils.core import setup setup(name='dimreducer', version='1.0', description='Dimension reduction methods', py_modules=['dimreducer'], ) setup(name='multiphenotype_utils', version='1.0', description='Utility functions for all methods', py_modules=['multiphenotype_utils...
Python
0
914b7cd2c94bddd1a68eb2293364633a9325506f
add a unit test
_unittests/ut_td_1a/test_diff.py
_unittests/ut_td_1a/test_diff.py
""" @brief test log(time=1s) You should indicate a time in seconds. The program ``run_unittests.py`` will sort all test files by increasing time and run them. """ import sys import os import unittest from difflib import SequenceMatcher try: import src import pyquickhelper as skip_ except ImportError: ...
Python
0.000001
c03411020db80b703260314236d96cc409398545
Create variable.py
introduction/variable.py
introduction/variable.py
a = 10 A = 10 print(a) print(A)
Python
0.000008
3314f5d6ffb843a58e61856e726bd47e426538aa
Add spec_cleaner/__main__.py to allow running spec-cleaner without installing it.
spec_cleaner/__main__.py
spec_cleaner/__main__.py
from __future__ import absolute_import import os import sys # If we are running from a wheel, add the wheel to sys.path. if __package__ == '': # __file__ is spec-cleaner-*.whl/spec_cleaner/__main__.py. # First dirname call strips of '/__main__.py', second strips off '/spec_cleaner'. # Resulting path is th...
Python
0
c54623d673d03d841d330e80d414a687770cc2a1
Add setup.py
setup.py
setup.py
import setuptools with open("README", "r", encoding="utf-8") as fh: long_description = fh.read() setuptools.setup( name="zvm", # Replace with your own username version="1.0.0", author="Ben Collins-Sussman", author_email="sussman@gmail.com", description="A pure-python implementation of a Z-mach...
Python
0.000001
ce5883c6a7a0c8c8f79c941f66288ce748b1b405
Add setup.py
setup.py
setup.py
from setuptools import setup setup( name = 'brunnhilde', version = '1.4.0', url = 'https://github.com/timothyryanwalsh/brunnhilde', author = 'Tim Walsh', author_email = 'timothyryanwalsh@gmail.com', py_modules = ['brunnhilde'], scripts = ['brunnhilde.py'], description = 'A Siegfried-bas...
Python
0.000001
73e0bd62ac7a2d8b8322e21130ee7ec0659dc3cc
add setup.py
setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from distutils.core import setup setup( name = "jsroot", version = "0.0.0", description = "VISPA ROOT Browser - Inspect contents of root files.", author = "VISPA Project", author_email = "vispa@lists.rwth-aachen...
Python
0.000001
8e8678c2bc915e671f50bb6ea91288662053c280
add setup file
setup.py
setup.py
#!/usr/bin/env python # encoding: utf-8 from setuptools import setup, find_packages setup( name = 'yard', version = '0.1.0', author = "Diogo Laginha", url = 'https://github.com/laginha/yard', description = "Yet Another Resftul Django-app", packa...
Python
0.000001
dd1810ddf1f85312c7a8b5ec23d4844b5ca63a13
add data_filtering.py
code/data_filtering.py
code/data_filtering.py
import numpy as np import matplotlib.pyplot as plt import os import sys import nitime # Import the time-series objects: from nitime.timeseries import TimeSeries # Import the analysis objects: from nitime.analysis import SpectralAnalyzer, FilterAnalyzer, NormalizationAnalyzer os.getcwd() os.chdir('..') os.chdir('data...
Python
0.000003
e0fbd1d0e5e9b845ebfa6aa1739937a9974cbc87
Add setup.py
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup( name='iroha-ya-cli', version='0.7', description='Cli for hyperledger/iroha', author='Sonoko Mizuki', author_email='mizuki.sonoko@gmail.com', packages=['src'], entry_points={ 'console_scripts': 'ir...
Python
0.000001
2484c0f9415694c99e5b1ac15ee4b64f12e839b6
add migration to reflect schema updates to wagtailforms
demo/migrations/0005_auto_20160531_1736.py
demo/migrations/0005_auto_20160531_1736.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('demo', '0004_auto_20151019_1351'), ] operations = [ migrations.AlterField( model_name='formfield', n...
Python
0
97d96097122ca50e84fcadd3a5c21ae51ccc8bf7
Create Polarity_classifier.py
src/Polarity_classifier.py
src/Polarity_classifier.py
import pickle import itertools from nltk.collocations import BigramCollocationFinder from nltk.metrics import BigramAssocMeasures from nltk.corpus import stopwords class Polarity_classifier: def __init__(self): pass def bigram_word_feats(self, words, score_fn=BigramAssocMeasures.chi_sq, n=200): ...
Python
0.000008
2c39bc6e1586dcacc1d23d9be643d1f27f035eac
Add wsgi file
agendadulibre/agendadulibre.wsgi
agendadulibre/agendadulibre.wsgi
import sys sys.path.insert(0, '/var/www/agendadulibre/agendadulibre') #sys.path.insert(0, os.curdir) activate_this = '/home/numahell/.virtualenvs/flask/local/bin/activate_this.py' execfile(activate_this, dict(__file__=activate_this)) from app import app as application
Python
0.000001
f9c68d3c250e3a83ab1d0ed9e0760c0631dca869
add setup.py
setup.py
setup.py
#!/usr/bin/env python from setuptools import find_packages, setup from fabliip import __version__ setup( name='fabliip', version=__version__, packages=find_packages(), description='Set of Fabric functions to help deploying websites.', author='Sylvain Fankhauser', author_email='sylvain.fankhause...
Python
0.000001
054be2f9a06c0da3b7fcf5d40985ce8055f3f447
add setup.py
setup.py
setup.py
from setuptools import setup, find_packages setup( name='bark', version='1.0', url='https://github.com/battleroid/bark', description='Single file static site generator.', license='MIT License', keywords='bark static site generator jinja blog python markdown', aut...
Python
0.000001
c6c6594cda35aaa15f1efb9f336548671b0028c5
Add generic serializer tool for plugins to use
rmake/lib/twisted_extras/tools.py
rmake/lib/twisted_extras/tools.py
# # Copyright (c) rPath, Inc. # # This program 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 later version. # # This program is distributed in the h...
Python
0
b4f5b5da5e7a7266e7f908b6ffc975ea3f1f0657
Add setup.py
setup.py
setup.py
from distutils.core import setup setup(name='MathLibPy', version='0.0.0', description='Math library for Python', author='Jack Romo', author_email='sharrackor@gmail.com', packages=['mathlibpy'], )
Python
0.000001
49178742953cc63b066d2142d9e2b3f0f2e20e17
Tweak setup.py so that it may run even when fired from different locations, as suggested by Maarten Damen.
setup.py
setup.py
#!/usr/bin/python from os.path import isfile, join import glob import os import re from setuptools import setup if isfile("MANIFEST"): os.unlink("MANIFEST") TOPDIR = os.path.dirname(__file__) or "." VERSION = re.search('__version__ = "([^"]+)"', open(TOPDIR + "/dateutil/__init__.py").read()...
#!/usr/bin/python from os.path import isfile, join import glob import os import re from setuptools import setup if isfile("MANIFEST"): os.unlink("MANIFEST") VERSION = re.search('__version__ = "([^"]+)"', open("dateutil/__init__.py").read()).group(1) setup(name="python-dateutil", ver...
Python
0
ba9235b758fe44279e3bd55bfb785308febb8685
Add padding between layout and children (#1980)
kivy/uix/anchorlayout.py
kivy/uix/anchorlayout.py
''' Anchor Layout ============= .. only:: html .. image:: images/anchorlayout.gif :align: right .. only:: latex .. image:: images/anchorlayout.png :align: right The :class:`AnchorLayout` aligns children to a border (top, bottom, left, right) or center. To draw a button in the lower-right ...
''' Anchor Layout ============= .. only:: html .. image:: images/anchorlayout.gif :align: right .. only:: latex .. image:: images/anchorlayout.png :align: right The :class:`AnchorLayout` aligns children to a border (top, bottom, left, right) or center. To draw a button in the lower-right ...
Python
0
65c9335775688a15b344be4762ee7c75bd66bdb2
Add a setup.py file
setup.py
setup.py
import os import codecs from setuptools import setup, find_packages def read(fname): file_path = os.path.join(os.path.dirname(__file__), fname) return codecs.open(file_path, encoding='utf-8').read() setup( name='cities', version='0.0.1', description='Load data from cities and countries all over ...
Python
0.000002
f57605c4f37fb29a93f06d165b9eb69fee2771b9
Add fake setup.py (#1620)
setup.py
setup.py
import sys from setuptools import setup sys.stderr.write( """ =============================== Unsupported installation method =============================== httpx no longer supports installation with `python setup.py install`. Please use `python -m pip install .` instead. """ ) sys.exit(1) # The below code wil...
Python
0
7c863017bd687a06c63a5c60c53c6efca80d6b0e
Add setup script
setup.py
setup.py
from setuptools import setup setup( name='discord-toastlogger', version='0.1.0', scripts=['toastbot'], url='https://github.com/mdegreg/discord-toastlogger', license='MIT', install_requires=[ 'discord' ] )
Python
0.000001
1b0b91e9445e080e790571a00e767f31f5035fd1
Add setup.py
setup.py
setup.py
#!/usr/bin/env python3 # # The MIT License (MIT) # # Copyright (c) 2014 Philippe Proulx <eepp.ca> # # 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 limi...
Python
0.000001
c40a65c46b075881222f5c9ccebccfb0c627aa51
Create setup.py
setup.py
setup.py
Python
0.000001
e87d736c83d89129f4a152163993cb5c173dddd4
Add setup
setup.py
setup.py
from setuptools import setup setup(name='Kamanian', version='1.00', packages=['dzdy'], install_requires=['pandas', 'numpy', 'scipy', 'pcore', 'matplotlib', 'networkx'])
Python
0.000001
05477b14e19d1e2d0483405bf3558f7d80fb9b60
Switch to setuptools.
setup.py
setup.py
# setup.py - distutils configuration for esm and esmre modules # Copyright (C) 2007 Tideway Systems Limited. # # 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 the...
# setup.py - distutils configuration for esm and esmre modules # Copyright (C) 2007 Tideway Systems Limited. # # 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 the...
Python
0.000007
a896d7f6b3886a73789f8aff079ab983af38e29f
Add lava server extension loader
lava_server/extension.py
lava_server/extension.py
# Copyright (C) 2010, 2011 Linaro Limited # # Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org> # # This file is part of LAVA Server. # # LAVA Server is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License version 3 # as published by the Free Software F...
Python
0
44bdeb2d5bf8c7877eb1e92cda65f6c844a93642
add models.
contentpacks/models.py
contentpacks/models.py
from peewee import Model, SqliteDatabase, CharField, TextField, BooleanField,\ ForeignKeyField, PrimaryKeyField, Using, IntegerField, \ OperationalError class Item(Model): title = CharField() description = TextField() available = BooleanField() files_complete = IntegerField(default=0) tota...
Python
0
d72f9f06afcf5d1c177afa418a7c4bf60af8fb75
Support mm:ss.
since.py
since.py
#!/usr/bin/env python3 import datetime import re import sys def main(strTime): now = datetime.datetime.now() pattern = r'(\d\d):(\d\d)' match = re.match(pattern, strTime) time = datetime.datetime( now.year, now.month, now.day, int(match.group(1)), int(match.gro...
Python
0
38a5b5a74ec68027b30560c5a8c1087e5b49d5e6
criada query tira_lote para deendereçar lote
src/cd/queries/lote.py
src/cd/queries/lote.py
from pprint import pprint from utils.functions.queries import debug_cursor_execute def tira_lote(cursor, lote): sql = f""" DELETE FROM SYSTEXTIL.ENDR_014 WHERE ORDEM_CONFECCAO = '{lote}' """ try: debug_cursor_execute(cursor, sql) except Exception as e: return repr(e)
Python
0.999826
1d25676049994db266129b1a1c98cec3acbba0ca
Add missing file on last merge
goodtablesio/models/subscription.py
goodtablesio/models/subscription.py
import logging import datetime from sqlalchemy import ( Column, Unicode, DateTime, Boolean, ForeignKey) from sqlalchemy.orm import relationship from goodtablesio.models.base import Base, BaseModelMixin, make_uuid log = logging.getLogger(__name__) class Subscription(Base, BaseModelMixin): __tablename__ = ...
Python
0.000001
9b0278530c2c4f32dd2a751fb4f8b93c8c34a3ea
add arch tool for waf backend.
bento/backends/waf_tools/arch.py
bento/backends/waf_tools/arch.py
import re from waflib.Tools.c_config import SNIP_EMPTY_PROGRAM from waflib.Configure import conf ARCHS = ["i386", "x86_64", "ppc", "ppc64"] FILE_MACHO_RE = re.compile("Mach-O.*object ([a-zA-Z_0-9]+)") @conf def check_cc_arch(conf): env = conf.env archs = [] for arch in ARCHS: env.stash() ...
Python
0
5a8a6d9ac58a8aada0b6fd51ba3b898fa34db340
generate X86 dispatch code
src/mesa/glapi/glx86asm.py
src/mesa/glapi/glx86asm.py
#!/usr/bin/env python # $Id: glx86asm.py,v 1.1 2000/05/11 23:14:57 brianp Exp $ # Mesa 3-D graphics library # Version: 3.3 # # Copyright (C) 1999-2000 Brian Paul All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation ...
Python
0.999671
856f855e10588ddbe2ad5053cc5d7366c76459a8
Implement basic perception
percept/perceptron.py
percept/perceptron.py
import random def rand_w(): ''' Generate a random weight. ''' return round(random.uniform(-1, 1), 3) class Perceptron: def __init__( self, w0=rand_w(), w1=rand_w(), w2=rand_w(), learning_rate=0.1): self.w0, self.w1, self.w2 = w0, w1, w2 self.learning_rate = learning_rate ...
Python
0.000149
e5f82b794ee2e6054deb15433c7dc7261146f181
Add merge migration
osf/migrations/0112_merge_20180614_1454.py
osf/migrations/0112_merge_20180614_1454.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-06-14 19:54 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('osf', '0107_merge_20180604_1232'), ('osf', '0111_auto_20180605_1240'), ] operation...
Python
0.000001
5f051f2ae1b105d6cc58d1cac760cb5d20908c3b
Support rudimentary translation service from IIT Bombay via web API.
valai/translate.py
valai/translate.py
# * coding: utf8 * # # (C) 2020 Muthiah Annamalai <ezhillang@gmail.com> # # Uses the IIT-Bombay service on the web. # import json import requests from urllib.parse import quote from functools import lru_cache @lru_cache(1024,str) def en2ta(text): """translate from English to Tamil""" return IITB_translator(...
Python
0.000607
25056e74093f01d68af14277da6089903b617ee6
Create Career.py
Career.py
Career.py
class Career: def __init__(career_name, advances, skills_to_take, talents_to_take, career_trappings, race_dependent) self.career_name = career_name self.advances = advances self.skills_to_take = skills_to_take self.talents_to_take = talents_to_take self.career_trappings = car...
Python
0
64ab32daba1ddbe7e8b56850188dab3f8ca42286
Add TCP check
sauna/plugins/ext/tcp.py
sauna/plugins/ext/tcp.py
import socket from sauna.plugins import (Plugin, PluginRegister) my_plugin = PluginRegister('TCP') @my_plugin.plugin() class Tcp(Plugin): @my_plugin.check() def request(self, check_config): try: with socket.create_connection((check_config['host'], ...
Python
0.000001
d95ce2570989e1b18c313efb1f95f611a9a2cc80
add color_histogram_matcher for objects
jsk_2015_05_baxter_apc/node_scripts/color_histogram_matcher.py
jsk_2015_05_baxter_apc/node_scripts/color_histogram_matcher.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import division import rospy import cv2 import numpy as np from sensor_msgs.msg import Image from jsk_2014_picking_challenge.srv import ObjectMatch, ObjectMatchResponse from jsk_recognition_msgs.msg import ColorHistogram query_features = None target_feat...
Python
0.000009
74197adab35815bc1168f661d6f5cf5c829afc99
Add example
example/serialize.py
example/serialize.py
from pykt import KyotoTycoon, set_serializer, set_deserializer from cPickle import dumps, loads set_serializer(dumps) set_deserializer(loads) key = "A" * 12 val = "B" * 1024 d = dict(name="John", no=1) db = KyotoTycoon() db.open() print db.set(key, d) ret = db.get(key) assert(d == ret) db.close()
Python
0.000003
9c0a74194e6546eac6dbaec000599a623d525909
Create drivers.py
chips/digital/pca9698/drivers.py
chips/digital/pca9698/drivers.py
DRIVERS["pca9698" ] = ["PCA9698"]
Python
0.000001
d6492629e3c837374082cac71034a7bad36291bc
Test of commit
Parser.py
Parser.py
if __name__ == '__main__': main()
Python
0
1f838e5f8b8ac66fde19bfaa3713395bf52f650a
initial commit. tested py2/3
ansible/modules/hashivault/hashivault_azure_secret_engine_role.py
ansible/modules/hashivault/hashivault_azure_secret_engine_role.py
#!/usr/bin/env python from ansible.module_utils.hashivault import hashivault_argspec from ansible.module_utils.hashivault import hashivault_auth_client from ansible.module_utils.hashivault import hashivault_init from ansible.module_utils.hashivault import hashiwrapper import json from ast import literal_eval ANSIBLE_M...
Python
0.999543
bef69c38103e8ef937fea41a0a58c934b34f4281
add yaml syntax checker script
bosi/rhosp_resources/yamls/yaml_syntax_check.py
bosi/rhosp_resources/yamls/yaml_syntax_check.py
#!/usr/bin/env python import os import sys import yaml EXIT_ERROR = -1 YAML_FILE_EXT = ".yaml" def help(): """ Print how to use the script """ print "Usage: %s <directory>" % sys.argv[0] def check_yaml_syntax(f): """ Check the syntax of the given YAML file. return: True if valid, False otherwi...
Python
0.000003
f09c45cde66dd8da07511e1105af14ffd41799b0
add a command to trigger a bulk sync
crate_project/apps/crate/management/commands/trigger_bulk_sync.py
crate_project/apps/crate/management/commands/trigger_bulk_sync.py
from django.core.management.base import BaseCommand from pypi.tasks import bulk_synchronize class Command(BaseCommand): def handle(self, *args, **options): bulk_synchronize.delay() print "Bulk Synchronize Triggered"
Python
0.000001
27ed68923579c5afff0c70b025deb8b73d448aa8
Set calculation type of all indicators to Number
indicators/migrations/0013_set_all_calculation_type_to_numeric.py
indicators/migrations/0013_set_all_calculation_type_to_numeric.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2018-07-04 09:56 from __future__ import unicode_literals from django.db import migrations from ..models import Indicator def set_calculation_type(apps, schema_editor): Indicator.objects.all().update( calculation_type=Indicator.CALC_TYPE_NUMERIC) c...
Python
0.000003
834516acf7b5cfbbb0f728f8b725bea120b5f5b3
Add python version of the post-receive hook
post_receive.py
post_receive.py
import re import os import sys import os import json from subprocess import Popen, PIPE from httplib2 import Http postURL = "http://localhost:2069/json" pwd = os.getcwd() if len(sys.argv) <= 3: print("Usage: post-receive [old] [new] [ref]") exit() old, new, ref = sys.argv[1:4] m = re.match(r"^.*/([^/]+)$", p...
Python
0.000001
6e28da4e1a1d8ad794f12d9782b0e2dd54119dc4
add mysql module
db_mysql_module.py
db_mysql_module.py
__author__ = 'root' import pymysql; import sqlalchemy; import threading; from time import clock; class SQLiteWraper(object): def __init__(self): # self.lock = threading.RLock() self.engine = sqlalchemy.create_engine('mysql+pymysql://developer:developer@172.28.217.66/xixiche?charset=utf8') def g...
Python
0.000001
11d0d641adf32a7e976bf9df8c4dc9ba19bba3b4
Binary graph algorithms to find height of binary tree and to check whether the given binary tree is full binary or not
binary_tree/basic_binary_tree.py
binary_tree/basic_binary_tree.py
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def depth_of_tree(tree): if tree is None: return 0 else: depth_l_tree = depth_of_tree(tree.left) depth_r_tree = depth_of_tree(tree.right) if depth_l_tree > dept...
Python
0.996305
35748678aaea24355d5207ae26d10dd455a47820
implement HostTestsSuite
src/test/hosttestssuite.py
src/test/hosttestssuite.py
from src.test.abstractovirttestssuite import AbstractOvirtTestsSuite from ovirtsdk.xml import params from src.infrastructure.annotations import conflicts from src.resource.hostresourcemanager import HostResourceManager class HostTestsSuite(AbstractOvirtTestsSuite): __hostResourceManager = HostResourceManager() ...
Python
0
cef6f559f20d8aace00cbed8621b16339aa6e0c6
hello world, first problem in python
problems/1/1.py
problems/1/1.py
# coding: utf-8 """ To run: python2.7 1.py Problem: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ import time def oneliner(): return sum( i for...
Python
0.999367
5f22ca2b9d6c9f0e55e208c25d410fe196ef619d
add closure report tool
build_time/src/closure_report.py
build_time/src/closure_report.py
#!/usr/bin/python # -*- coding: UTF-8 -*- """ Copyright 2015 Google Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2....
Python
0
e20c403ff196f18dd1416eaf811b427c37b113ba
Add a table editor demo featuring a checkbox column.
enthought/traits/ui/demo/Advanced/Table_editor_with_checkbox_column.py
enthought/traits/ui/demo/Advanced/Table_editor_with_checkbox_column.py
""" This shows a table editor which has a checkbox column in addition to normal data columns. """ # Imports: from random \ import randint from enthought.traits.api \ import HasStrictTraits, Str, Int, Float, List, Bool, Property from enthought.traits.ui.api \ import View, Item, Table...
Python
0
d0ebf20c9f6bbcfbb55649092b7a35ed82b05dac
Add module show_source.py in gallery (used to show source code of examples)
www/gallery/show_source.py
www/gallery/show_source.py
from browser import ajax, document, html, bind, window, highlight btn = html.BUTTON("Show source code", Class="nice") height = window.innerHeight width = window.innerWidth css = """ /* colors for highlighted Python code */ span.python-string{ color: #27d; } span.python-comment{ color: #019; } span.python-ke...
Python
0
0c24d31e08fe7e72745b3273eec0b5bfe7e9a07a
Add script to manage availability annotations
Utilities/expand-availability.py
Utilities/expand-availability.py
#!/usr/bin/env python3 # This script uses the file `availability-macros.def` to automatically # add/remove `@available` attributes to declarations in Swift sources # in this package. # # In order for this to work, ABI-impacting declarations need to be annotated # with special comments in the following format: # # ...
Python
0.000441
aad264f065bb07c5c811db7372f1ca981308ad45
Create start_azure_vm.py
Utility/Python/start_azure_vm.py
Utility/Python/start_azure_vm.py
#!/usr/bin/env python2 """ Starts Azure resource manager virtual machines in a subscription. This Azure Automation runbook runs on Azure to start Azure vms in a subscription. If no arguments are specified, then all VMs that are currently stopped are started. If a resource group is specified, then all VMs in the resour...
Python
0.000003
264f4a827e39d55259aaa53bde967dae6befc606
Complete Programming Experience: polysum
pset2/grader.py
pset2/grader.py
# Grader # 10.0 points possible (ungraded) # A regular polygon has n number of sides. Each side has length s. # The area of a regular polygon is: 0.25∗n∗s2tan(π/n) # The perimeter of a polygon is: length of the boundary of the polygon # Write a function called polysum that takes 2 arguments, n and s. This function sho...
Python
0
e8170b2f446f23771bd746747493bebbd0dc9288
add velocity filter
nodes/velocity_filter.py
nodes/velocity_filter.py
#! /usr/bin/env python import rospy import roslib roslib.load_manifest("otl_diff_drive") from otl_diff_drive import twist_velocities from geometry_msgs.msg import Twist def isStopVelocity(twist): VERY_SMALL = 0.0001 return abs(twist.linear.x) < VERY_SMALL and abs(twist.angular.z) < VERY_SMALL class Velocit...
Python
0.000001
18ed0900c22fa2ed646f08adf66e1917a6a04b43
add collect_impression
amimoto_alexa/collect_message.py
amimoto_alexa/collect_message.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ for amimoto_alexa """ import lamvery from helpers import * from debugger import * def collect_impression(intent, session): """Collect impression and finalize session """ session_attributes = build_session_attributes(session) card_title = "Impression...
Python
0.000002
aec48fe807e4589344a9f04e13b8f0b651110917
add package installer.
python/setup.py
python/setup.py
from setuptools import setup import epidb_client version = epidb_client.__version__ setup( name = "epidb-client", version = version, url = 'http://www.epiwork.eu/', description = 'EPIWork Database - Client Code', author = 'Fajran Iman Rusadi', packages = ['epidb_client'], install_requires ...
Python
0
437431289b25418c5acd9890b86350aa62ae0668
add updated script with changes from @fransua
transposon_annotation/transposon_annotation_ecolopy_scripts/ecolopy.py
transposon_annotation/transposon_annotation_ecolopy_scripts/ecolopy.py
import matplotlib matplotlib.use('Agg') from ecolopy_dev import Community from ecolopy_dev.utils import draw_shannon_distrib com = Community('test_log_abund.txt') print com com.fit_model('ewens') com.set_current_model('ewens') ewens_model = com.get_model('ewens') print ewens_model com.fit_model('lognormal') co...
Python
0
c7c3ab0a4013df99b928351040f1156b07ba6767
Add some tests for the tokens
tests/unit/utils/test_tokens.py
tests/unit/utils/test_tokens.py
from flask import current_app from itsdangerous import TimedJSONWebSignatureSerializer from flaskbb.utils.tokens import make_token, get_token_status def test_make_token(user): token = make_token(user, "test") s = TimedJSONWebSignatureSerializer(current_app.config['SECRET_KEY']) unpacked_token = s.loads(to...
Python
0.000001
0848197b3c9ff8d09575b85b5e3a2ca1aac6f6c5
Put split and merge in own module too
app/drivers/pycolator/splitmerge.py
app/drivers/pycolator/splitmerge.py
from app.drivers.basedrivers import PycolatorDriver from app.preparation import pycolator as preparation from app.readers import pycolator as readers class SplitDriver(PycolatorDriver): def __init__(self, **kwargs): super(SplitDriver, self).__init__(**kwargs) self.targetsuffix = kwargs.get('target...
Python
0
aef0b6fad46b76e6040ad92bfc59396d3bd4b71e
Add migration to create system groups for internal realms.
zerver/migrations/0403_create_role_based_groups_for_internal_realms.py
zerver/migrations/0403_create_role_based_groups_for_internal_realms.py
# Generated by Django 3.2.13 on 2022-06-28 17:36 from django.conf import settings from django.db import migrations, transaction from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.utils.timezone import now as timezone_now # This migrat...
Python
0
4bf5d21402d5394f36eec006fd3ba03354bb8523
Add dashboard url route
dashboard/urls.py
dashboard/urls.py
from django.conf.urls import patterns, url from dashboard import views urlpatterns = patterns('dashboard.views', url(r'^$', views.dashboard, name = 'dashboard'), url(r'^login/$', views.enter_gate, name = 'login'), url(r'^logout/$', views.exit_gate, name = 'logout'), )
Python
0.000001