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
8692557a3389403b7a3450065d99e3750d91b2ed
Create views.py
pagination_bootstrap/views.py
pagination_bootstrap/views.py
Python
0
060c6d2eeea2235cda955c873b50e0aa2a4accd0
use 20
farmer/models.py
farmer/models.py
#coding=utf8 import os import time import json from datetime import datetime from commands import getstatusoutput from django.db import models class Job(models.Model): # hosts, like web_servers:host1 . inventories = models.TextField(null = False, blank = False) # 0, do not use sudo; 1, use sudo . s...
#coding=utf8 import os import time import json from datetime import datetime from commands import getstatusoutput from django.db import models class Job(models.Model): # hosts, like web_servers:host1 . inventories = models.TextField(null = False, blank = False) # 0, do not use sudo; 1, use sudo . s...
Python
0.99981
799109759114d141d71bed777b9a1ac2ec26a264
add Red object detection
python/ObjectDetection/RedExtractObject.py
python/ObjectDetection/RedExtractObject.py
import cv2 import numpy as np video = cv2.VideoCapture(0) while (1): # Take each frame _, frame = video.read() # Convert BGR to HSV hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) # define range of blue color in HSV lower_red = np.array([150, 50, 50]) upper_red = np.array([255, 255, 150]) ...
Python
0.000002
21490bd6cd03d159a440b2c13a6b4641c789c954
Add example
examples/example.py
examples/example.py
import sys from tumblpy import Tumblpy key = raw_input('App Consumer Key: ') secret = raw_input('App Consumer Secret: ') if not 'skip-auth' in sys.argv: t = Tumblpy(key, secret) callback_url = raw_input('Callback URL: ') auth_props = t.get_authentication_tokens(callback_url=callback_url) auth_url =...
Python
0.000003
ece6fb4561e338e32e8527a068cd386f00886a67
Add example with reuters dataset.
examples/reuters.py
examples/reuters.py
"""shell !pip install -q -U pip !pip install -q -U autokeras==1.0.8 !pip install -q git+https://github.com/keras-team/keras-tuner.git@1.0.2rc1 """ """ Search for a good model for the [Reuters](https://keras.io/ja/datasets/#_5) dataset. """ import tensorflow as tf from tf.keras.datasets import reuters import numpy as ...
Python
0
315914bbec88e11bf5ed3bcab29218592549eccf
Create Kmeans.py
Kmeans.py
Kmeans.py
import collections from nltk import word_tokenize from nltk.corpus import stopwords from nltk.stem import PorterStemmer from sklearn.cluster import KMeans from sklearn.feature_extraction.text import TfidfVectorizer from pprint import pprint import csv import pandas def word_tokenizer(text): #tokenizes and stems th...
Python
0
b0377568c9b927db588b006b7312cbe8ed9d48b7
Add tremelo example
examples/tremelo.py
examples/tremelo.py
# Author: Martin McBride # Created: 2016-01-08 # Copyright (C) 2016, Martin McBride # License: MIT # Website sympl.org/pysound # # Square wave example try: import pysound except ImportError: # if pysound is not installed append parent dir of __file__ to sys.path import sys, os sys.path.insert(0, os.p...
Python
0.000358
ea26478495d5aec6925e32c9a87245bf2e1e4bc8
Add script demonstrating raising and catching Exceptions.
rps/errors.py
rps/errors.py
gestures = ["rock", "paper", "scissors"] def verify_move(player_move): if player_move not in gestures: raise Exception("Wrong input!") return player_move # let's catch an exception try: player_move = verify_move(input("[rock,paper,scissors]: ")) print("The move was correct.") except Exception:...
Python
0
fb95c75b7b43bcb1fa640e4de3181fd0431c5837
Add the unittest test_plot.py
ionic_liquids/test/test_plot.py
ionic_liquids/test/test_plot.py
import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import mean_squared_error FIG_SIZE = (4, 4) def test_parity_plot(): """ Test the parity plot Input ----- y_pred : predicted values from the model y_act : 'true' (actual) values Output ------...
Python
0.999191
ecb3bd6fd9b6496a751a2145909648ba1be8f908
add linear interpolation tests
isochrones/tests/test_interp.py
isochrones/tests/test_interp.py
import itertools import logging import numpy as np import pandas as pd from scipy.interpolate import RegularGridInterpolator from isochrones.interp import DFInterpolator def test_interp(): xx, yy, zz = [np.arange(10 + np.log10(n))*n for n in [1, 10, 100]] def func(x, y, z): return x**2*np.cos(y/10) ...
Python
0.000001
947c9ef100686fa1ec0acaa10bc49bf6c785665b
Use unified class for json output
ffflash/container.py
ffflash/container.py
from os import path from ffflash import RELEASE, log, now, timeout from ffflash.lib.clock import epoch_repr from ffflash.lib.data import merge_dicts from ffflash.lib.files import read_json_file, write_json_file class Container: def __init__(self, spec, filename): self._spec = spec self._location ...
Python
0.000011
6c5dad5d617892a3ea5cdd20cbaef89189307195
add simple content-based model for coldstart
polara/recommender/coldstart/models.py
polara/recommender/coldstart/models.py
import numpy as np from polara.recommender.models import RecommenderModel class ContentBasedColdStart(RecommenderModel): def __init__(self, *args, **kwargs): super(ContentBasedColdStart, self).__init__(*args, **kwargs) self.method = 'CB' self._key = '{}_cold'.format(self.data.fields.itemid...
Python
0
2ca6b22e645cbbe63737d4ac3929cb23700a2e06
Prepare v1.2.342.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.000002
edbc9f2c31f98e1447c352058aa05e6884a0927b
Create fold_eigenvalues.py
fold_eigenvalues.py
fold_eigenvalues.py
#Definition of inputs and outputs #================================== ##[Mes scripts GEOL]=group ##entree=vector ##dip_dir=field entree ##dip=field entree #Algorithm body #================================== from qgis.core import * from apsg import * layer = processing.getObject(entree) dipdir = layer.fieldNameIndex(...
Python
0.000002
f55771da6a617c71f2eb620c11fb54e033c64338
Migrate upload-orange-metadata process type
resolwe_bio/migrations/0002_metadata_table_type.py
resolwe_bio/migrations/0002_metadata_table_type.py
from django.db import migrations from resolwe.flow.migration_ops import ResolweProcessChangeType class Migration(migrations.Migration): """ Change the ``upload-orange-metadata`` process type. """ dependencies = [ ("resolwe_bio", "0001_squashed_0015_sample_indices"), ] operations = [...
Python
0
4170807e4a1c70eef6416fe3f1661c9c1c99a9da
Add pysal test
tests/test_pysal.py
tests/test_pysal.py
import unittest from pysal.weights import lat2W class TestPysal(unittest.TestCase): def test_distance_band(self): w = lat2W(4,4) self.assertEqual(16, w.n)
Python
0.000026
484a2bf0c28aa2bbc910ca20849840bf518d4329
Add utils.banners test case
tests/test_utils.py
tests/test_utils.py
# Foremast - Pipeline Tooling # # Copyright 2016 Gogo, 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...
Python
0.000001
45efbbdfd62cd0f9f8232bfd7ebd1aae0ac6cd17
Create humidity.py
abstractions/sensor/humidity/humidity.py
abstractions/sensor/humidity/humidity.py
# This code has to be added to __init__.py in folder .../devices/sensor class Humidity(): def __family__(self): return "Humidity" def __getHumidity__(self): raise NotImplementedError @api("Humidity", 0) @request("GET", "sensor/humidity/*") @response(contentType=M_JSON) def h...
Python
0.001003
c9bd5ba167284d79ae0cbe7aaaf9ec8536bef918
add hiprec.py
benchexec/tools/hiprec.py
benchexec/tools/hiprec.py
#!/usr/bin/env python """ BenchExec is a framework for reliable benchmarking. This file is part of BenchExec. Copyright (C) 2007-2015 Dirk Beyer 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 ...
Python
0.002017
d726fd9b05b846097ee877ad0897f8416dbceaf7
Add missing __init__
gallery/__init__.py
gallery/__init__.py
from .gallery import *
Python
0.998696
057317f9ffb49eae5d11799b6d4191a3fef421e0
Allow packages to use fake s3: URI's to specify that the package should be loaded from S3 with credentials
boto/pyami/startup.py
boto/pyami/startup.py
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
0.000001
76ea7119e075cf6eb86d64768e90cfda124cedf9
Add benchmarking script
serd_bench.py
serd_bench.py
#!/usr/bin/env python import optparse import os import subprocess import sys class WorkingDirectory: "Scoped context for changing working directory" def __init__(self, working_dir): self.original_dir = os.getcwd() self.working_dir = working_dir def __enter__(self): os.chdir(self....
Python
0.000001
c206969facfc0e46d7ec4d3f60ce2e6a07956dbd
Use filfinder to get the average radial width of features in the moment 0
14B-088/HI/analysis/run_filfinder.py
14B-088/HI/analysis/run_filfinder.py
from fil_finder import fil_finder_2D from basics import BubbleFinder2D from spectral_cube.lower_dimensional_structures import Projection from astropy.io import fits from radio_beam import Beam from astropy.wcs import WCS import astropy.units as u import matplotlib.pyplot as p ''' Filaments in M33? Why not? ''' mom0_...
Python
0
da2de3d9d4b36bf2068dbe5b80d785748f532292
Add __init__.py for the schedule package
pygotham/schedule/__init__.py
pygotham/schedule/__init__.py
"""Schedule package."""
Python
0
da5fed886d519b271a120820668d21518872f52c
Remove Duplicates from Sorted Array problem
remove_duplicates_from_sorted_array.py
remove_duplicates_from_sorted_array.py
''' Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place with constant memory. For example, Given input array A = [1,1,2], Your function should return length = 2, and A is now [...
Python
0
e6d247319e7959a6418f8e5b9db949acc93f7d9c
Add the support of EC2 Snapshot
kamboo/snapshot.py
kamboo/snapshot.py
# Copyright (c) 2014, Henry Huang # # 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 writ...
Python
0.000001
14302f83d755d2319a00db123dab14b300c8c93f
Add python patch script
patch.py
patch.py
import json import subprocess # This script will: # - read current version # - increment patch version # - update version in a few places # - insert new line in ripme.json with message message = raw_input('message: ') with open('ripme.json') as dataFile: ripmeJson = json.load(dataFile) currentVersion = ripmeJson...
Python
0.000001
048e6960d9e6408ef5dbfad2e32d2d1768ead1da
set P(A)
pb151.py
pb151.py
import math import time import random t1 = time.time() # A1:16 # A2:8 # A3:4 # A4:2 # A5:1 ''' def getRandom(n): return random.randint(1,n) def getbatch(env,l): i = getRandom(l)-1 t = env[i] env.pop(i) if t == 1: return env if t == 2: return env+[1] if t == 4: retu...
Python
0.999995
f0684a5bb5860c2b9caffefb47dc55781092819e
Add eTools engine
searx/engines/etools.py
searx/engines/etools.py
""" eTools (Web) @website https://www.etools.ch @provide-api no @using-api no @results HTML @stable no (HTML can change) @parse url, title, content """ from lxml import html from searx.engines.xpath import extract_text from searx.url_utils import quote from searx.utils import eval_xp...
Python
0.000001
4523621d2dd8913cb9c4156bf20e800652318a9d
add whileloop
whileloop.py
whileloop.py
a = 1 while a < 10: print (a) a = a+1
Python
0.000009
5213db56ab93551360a79d68fc8ecbe98b379b46
Add validplots.py
validplots.py
validplots.py
""" This script creates validation plots based on statistics collected by validstats.py module. Usage: python validplots.py statfile [outdir] """ import sys import os import pywikibot import matplotlib.pyplot as plt FILEDESC = """ == ะšั€ะฐั‚ะบะพะต ะพะฟะธัะฐะฝะธะต == {{ะ˜ะทะพะฑั€ะฐะถะตะฝะธะต | ะžะฟะธัะฐะฝะธะต = ะ”ะธะฝะฐะผะธะบะฐ ั‡ะธัะปะฐ ะฝะตะพั‚ะฟะฐั‚ั€ัƒะปะธ...
Python
0.000162
bd7a84353b298ad14634e5c9a7b442146e9bfeeb
Create __init__.py
kesh/__init__.py
kesh/__init__.py
# Empty __init__.py
Python
0.000429
66d7ebe5210669284a335f83e2b8af7392285baa
add holistic video-to-pose
pose_format/utils/holistic.py
pose_format/utils/holistic.py
import mediapipe as mp import numpy as np from tqdm import tqdm from .openpose import hand_colors from ..numpy.pose_body import NumPyPoseBody from ..pose import Pose from ..pose_header import PoseHeaderComponent, PoseHeaderDimensions, PoseHeader mp_holistic = mp.solutions.holistic BODY_POINTS = mp_holistic.PoseLandm...
Python
0.000001
9b169bf42bfb2c674460fc317cfb96f929ba0953
Add tests suite for text modifier tags.
tests/tests_tags/tests_textmodifiers.py
tests/tests_tags/tests_textmodifiers.py
""" SkCode text modifier tags test code. """ import unittest from skcode.etree import TreeNode from skcode.tags.textmodifiers import TextModifierBaseTagOptions from skcode.tags import (LowerCaseTextTagOptions, UpperCaseTextTagOptions, CapitalizeTextTagOptions, ...
Python
0
11f47fcad839b198d134f34b4489537360703a07
Add helpers.py
ckanext/orgdashboards/tests/helpers.py
ckanext/orgdashboards/tests/helpers.py
from ckan.tests import factories def create_mock_data(**kwargs): mock_data = {} mock_data['organization'] = factories.Organization() mock_data['organization_name'] = mock_data['organization']['name'] mock_data['organization_id'] = mock_data['organization']['id'] mock_data['dataset'] = factories....
Python
0.000015
46e1afd7faae8bd8c62f6b4f5c01322804e68163
add script to visualize simulation coefficient (us, g, us')
Modules/Biophotonics/python/iMC/script_visualize_simulation_coefficients.py
Modules/Biophotonics/python/iMC/script_visualize_simulation_coefficients.py
''' Created on Sep 22, 2015 @author: wirkert ''' import math import numpy as np import matplotlib.pyplot as plt from mc.usuag import UsG if __name__ == '__main__': # set up plots f, axarr = plt.subplots(1, 4) usplt = axarr[0] usplt.grid() usplt.set_xlabel("wavelengths [nm]") usplt.set_ylabe...
Python
0
b9c9a1f5cfea61050803ecc442232f2f8b4d7011
Create yaml2json.py
yaml2json.py
yaml2json.py
#!/usr/bin/python import sys import yaml import json if __name__ == '__main__': content = yaml.load(sys.stdin) print json.dumps(content, indent=2)
Python
0.000002
7714b3c640a3d6d7fae9dba3496adfddd9354e0e
Add CFFI binding generator
build_wide.py
build_wide.py
import cffi ffibuilder = cffi.FFI() ffibuilder.set_source( '_wide', r""" #include "wide.c" """, extra_compile_args=['-Werror', '-fno-unwind-tables', '-fomit-frame-pointer'], ) ffibuilder.cdef( r""" typedef uint32_t wp_index; typedef double wp_number; wp_index wide_product( ...
Python
0
826a68c7f1f67c3189939c06fcb623b2ede040d9
migrate from yorm to odm
migrate.py
migrate.py
import pymongo import logging import pprint import time from modularodm import StoredObject from modularodm import fields from modularodm import storage from modularodm.query.querydialect import DefaultQueryDialect as Q from framework.search.model import Keyword as Keyword_YORM from framework.auth.model import User ...
Python
0.000005
bc22cd37a62a4e8e9dbfa677a9b3f70b546f1850
Align dict values
jedihttp/handlers.py
jedihttp/handlers.py
# Copyright 2015 Cedraro Andrea <a.cedraro@gmail.com> # 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...
# Copyright 2015 Cedraro Andrea <a.cedraro@gmail.com> # 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...
Python
0.000001
6610483e55f5371d5dcfe06e984f791c3f051e4a
fix InMoov launching button
src/main/resources/resource/Intro/InMoov01_start.py
src/main/resources/resource/Intro/InMoov01_start.py
######################################### # InMoov01_start.py # categories: inmoov # more info @: http://myrobotlab.org/service/InMoov ######################################### # uncomment for virtual hardware # Platform.setVirtual(True) i01 = Runtime.start('i01', 'InMoov2')
Python
0
9ba00cc698a5ce38d8cfb8eb6e921df0e24525cc
Create netstew.py
netstew.py
netstew.py
#!/opt/anaconda/bin/python2.7 # Print the links to stndard out. from bs4 import BeautifulSoup soup = BeautifulSoup(open("index.html")) for link in soup.find_all('a'): print(link.get('href'))
Python
0.000005
2e3af241d989bf2b62bba5e344240246e8ff516b
add leave module
modules/leave.py
modules/leave.py
class LeaveModule: def __init__(self, circa): self.circa = circa def onload(self): self.circa.add_listener("cmd.leave", self.leave) self.circa.add_listener("cmd.goaway", self.leave) self.circa.add_listener("cmd.quit", self.quit) def onunload(self): self.circa.remove_listener("cmd.leave", self.leave) se...
Python
0.000001
3411020a0445afcb626e7079ae2f4d17a02d27a0
Add simple YTid2AmaraID mapper.
map_ytid2amaraid.py
map_ytid2amaraid.py
#!/usr/bin/env python3 import argparse, sys from pprint import pprint from amara_api import * from utils import answer_me def read_cmd(): """Function for reading command line options.""" desc = "Program for mapping YouTube IDs to Amara IDs. If given video is not on Amara, it is created." parser = argparse.Arg...
Python
0
32dffa922c1aedadf5cc87685d5ff5226fa306e9
add status.py and adjust the code
SMlib/widgets/status.py
SMlib/widgets/status.py
# -*- coding: utf-8 -*- # # Copyright ยฉ 2012 Pierre Raybaut # Licensed under the terms of the MIT License # (see SMlib/__init__.py for details) """Status bar widgets""" from PyQt4.QtGui import QWidget, QHBoxLayout, QLabel from PyQt4.QtCore import QTimer, SIGNAL # Local import from SMlib.configs.baseconfig import _ f...
Python
0
9fef390248387e02498d18ab7bba5b23e3632c7b
Add missing file
api/constants.py
api/constants.py
QUERY_PARAM_QUERY = 'q' QUERY_PARAM_SORT = 's' QUERY_PARAM_SIZE = 'size' QUERY_PARAM_PAGE = 'page' QUERY_PARAM_FIELDS = 'fields' QUERY_PARAM_OFFSET = 'offset' QUERY_PARAM_INCLUDE = 'include' QUERY_PARAM_EXCLUDE = 'exclude' QUERY_PARAM_WAIT_UNTIL_COMPLETE = 'wuc'
Python
0.000006
8f9c979fc2936d53321a377c67cbf2e3b4667f95
Create status_light.py
status_light.py
status_light.py
import time class StatusLight(object): """available patterns for the status light""" patterns = { 'blink_fast' : (.1, [False, True]), 'blink' : (.5, [False, True]), } """placeholder for pattern to tenmporarily interrupt status light with different pattern""" interrupt_pattern = [0, []] """continue fla...
Python
0.000001
dcced707c40c6a970d19dfca496dc86e38e8ea3c
Increments version to 0.2.2
deltas/__init__.py
deltas/__init__.py
from .apply import apply from .operations import Operation, Insert, Delete, Equal from .algorithms import segment_matcher, SegmentMatcher from .algorithms import sequence_matcher, SequenceMatcher from .tokenizers import Tokenizer, RegexTokenizer, text_split, wikitext_split from .segmenters import Segmenter, Segment, Ma...
from .apply import apply from .operations import Operation, Insert, Delete, Equal from .algorithms import segment_matcher, SegmentMatcher from .algorithms import sequence_matcher, SequenceMatcher from .tokenizers import Tokenizer, RegexTokenizer, text_split, wikitext_split from .segmenters import Segmenter, Segment, Ma...
Python
0.999289
a4ad0ffbda8beb4c2ea4ef0d181ec9ef0de3d1e1
add the md5 by python
SystemInfo/1_hashlib.py
SystemInfo/1_hashlib.py
#!/usr/bin/python #-*- coding:utf-8 -*- import hashlib import sys def md5sum(f): m = hashlib.md5() with open(f) as fd: while True: data = fd.read(4096) if data: m.update(data) else: break return m.hexdigest() if __name__ == '__main__': print md5sum(sys.argv[1])
Python
0.000218
0abb8f6d266408f20c751726460ae2d87f307583
solve 1 problem
solutions/factorial-trailing-zeroes.py
solutions/factorial-trailing-zeroes.py
#!/usr/bin/env python # encoding: utf-8 """ factorial-trailing-zeroes.py Created by Shuailong on 2016-02-21. https://leetcode.com/problems/factorial-trailing-zeroes/. """ class Solution(object): def trailingZeroes(self, n): """ :type n: int :rtype: int """ count = 0 ...
Python
0.000027
c8fa91104d712bf2743b07b5edd5f38a040d6507
Add unit tests for invoke_post_run
st2common/tests/unit/test_runners_utils.py
st2common/tests/unit/test_runners_utils.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
Python
0
8977f320979998c9f18cfa7629c1811c7082dddf
Add setup.py (sigh)
setup.py
setup.py
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="webxpath", # Replace with your own username version="0.0.2", author="Shiplu Mokaddim", author_email="shiplu@mokadd.im", description="Run XPath query and expressions against websites", ...
Python
0
9af2c53af417295842f8ae329a8bb8abc99f693d
add setup.py file
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup( name = 's7n-blog', version = "1a1", packages = ['s7n', 's7n.blog'], )
Python
0.000001
e1be390ab7a90d1efdb75a0b2e04c6414645a23c
Create setup.py
setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from setuptools import setup except ImportError: from distutils.core import setup with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read().replace('.. :changelog:', ...
Python
0.000001
18c0682306ee383d0eaad467d8fd7c9f74bb6e4f
add setup.py
setup.py
setup.py
#!/usr/bin/env python # encoding: utf-8 from setuptools import setup # , find_packages setup( name='pyoptwrapper', version='1.0', description='wrapper to pyopt', author='Andrew Ning', author_email='aning@byu.edu', py_modules=['pyoptwrapper'], license='Apache License, Version 2.0', zip...
Python
0.000001
a03fa3d725f296d3fa3fda323171924671ec65c0
add setup.py for setuptools support
setup.py
setup.py
from setuptools import setup, find_packages setup( name='mtools', version='1.0.0', packages=find_packages(), scripts=['scripts/mlaunch','scripts/mlog2json','scripts/mlogdistinct', 'scripts/mlogfilter','scripts/mlogmerge','scripts/mlogversion', 'scripts/mlogvis','scripts/mplotqueries'],...
Python
0
b106d4fdaf1667061879dd170ddeec1bde2042aa
Add setup.py.
setup.py
setup.py
from distutils.core import setup setup(name='twittytwister', version='0.1', description='Twitter client for Twisted Python', author='Dustin Sallings', author_email='dustin@spy.net', url='http://github.com/dustin/twitty-twister/', license='MIT', platforms='any', packages=['twittytwister'...
Python
0
3ab1c4c28f816d0c6495ce5d7b14b854ec77f754
Setting version number to 0.2.0
setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import find_packages, setup class UltraMagicString(object): ''' Taken from http://stackoverflow.com/questions/1162338/whats-the-right-way-to-use-unicode-metadata-in-setup-py ''' def __init__(self, value): self.value = value ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import find_packages, setup class UltraMagicString(object): ''' Taken from http://stackoverflow.com/questions/1162338/whats-the-right-way-to-use-unicode-metadata-in-setup-py ''' def __init__(self, value): self.value = value ...
Python
0.999493
dcedefebd46a80f18372e045e3e4869bb4c88d89
Remove all tests from setup.py except those of gloo.gl
setup.py
setup.py
# -*- coding: utf-8 -*- # Copyright (c) 2013, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. """ Vispy setup script. Steps to do a new release: Preparations: * Test on Windows, Linux, Mac * Make release notes * Update API documentation and other docs that need...
# -*- coding: utf-8 -*- # Copyright (c) 2013, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. """ Vispy setup script. Steps to do a new release: Preparations: * Test on Windows, Linux, Mac * Make release notes * Update API documentation and other docs that need...
Python
0
e0efdff7380101437c75ce6a50dd93302a3315e2
Increase version dependency.
setup.py
setup.py
from setuptools import setup, find_packages version='0.9' setup( name='pyres', version=version, description='Python resque clone', author='Matt George', author_email='mgeorge@gmail.com', maintainer='Matt George', license='MIT', url='http://github.com/binarydud/pyres', packages=find_...
from setuptools import setup, find_packages version='0.9' setup( name='pyres', version=version, description='Python resque clone', author='Matt George', author_email='mgeorge@gmail.com', maintainer='Matt George', license='MIT', url='http://github.com/binarydud/pyres', packages=f...
Python
0
8781799d2511dbafa7b11f2f8fb45356031a619b
Bump the sqlalchemy-citext version requirement
setup.py
setup.py
#!/usr/bin/env python # Copyright 2013 Donald Stufft # # 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 ag...
#!/usr/bin/env python # Copyright 2013 Donald Stufft # # 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 ag...
Python
0.000001
18d899f36a140e677637118039e245127b0d138a
remove the long description
setup.py
setup.py
from setuptools import setup, find_packages from tvrenamr import get_version setup( name = 'tvrenamr', version = get_version(), description = 'Rename tv show files using online databases', author = 'George Hickman', author_email = 'george@ghickman.co.uk', url = 'http://github.com/ghickman/tvre...
from os.path import dirname, join from setuptools import setup, find_packages from tvrenamr import get_version def fread(fname): return open(join(dirname(__file__), fname)).read() setup( name = 'tvrenamr', version = get_version(), description = 'Rename tv show files using online databases', long_...
Python
1
934e73247156b28d919957d738d8a5b03e403160
Add setup.py.
setup.py
setup.py
""" setup.py for simple_img_gallery. """ from distutils.core import setup setup(name="simple_img_gallery", version="0.0.1", description="Simple image gallery generation.", author="Pete Florence", author_email="", url="https://github.com/peteflorence/simple_img_gallery", scripts=['g...
Python
0
ff5c68ccd566ba388f919bb663c5055685be3070
Add initial setup.py
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup setup( name='mdx_picture', version='1.0', author='Artem Grebenkin', author_email='speechkey@gmail.com', description='Python-Markdown extension supports the <picture> tag.', url='http://www.artemgrebenkin.com/', py_modules=['mdx_picture'], ...
Python
0.000001
6972c0a6fc0431c7e41b110ea8c41dd9a4ed076c
Add distutils setup script
setup.py
setup.py
#!/usr/bin/env python3 from distutils.core import setup setup( name='python-fsb5', version='1.0', author='Simon Pinfold', author_email='simon@uint8.me', description='Library and to extract audio from FSB5 (FMOD Sample Bank) files', download_url='https://github.com/synap5e/python-fsb5/tarball/master', license='...
Python
0
0bf30432084a5b6e71ea2ac36af165f7c4cee133
Add setup.py
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup setup(name='acapi', version='0.1', description='Acquia Cloud API client.', author='Dave Hall', author_email='me@davehall.com.au', url='http://github.com/skwashd/python-acquia-cloud', install_requires=['httplib2==0.9', '...
Python
0.000001
28970e7d54186e1bf360cb91389b9ba6b3df4679
Add script to validate mvn repositories
dev-tools/validate-maven-repository.py
dev-tools/validate-maven-repository.py
# Licensed to Elasticsearch under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use this file except...
Python
0
3a235f8525ae89ae91c333f7cd10ed307c33011c
Exclude local data from package.
setup.py
setup.py
from __future__ import with_statement import os from setuptools import setup, find_packages exclude = ["forms_builder/example_project/dev.db", "forms_builder/example_project/local_settings.py"] exclude = dict([(e, None) for e in exclude]) for e in exclude: if e.endswith(".py"): try: ...
from setuptools import setup, find_packages setup( name = "django-forms-builder", version = __import__("forms_builder").__version__, author = "Stephen McDonald", author_email = "stephen.mc@gmail.com", description = ("A Django reusable app providing the ability for admin " "users to create...
Python
0
207116ee7ba8d8da521f497997da90066831a551
Add codemod to replace __unicode__ with __str__
django3_codemods/replace_unicode_with_str.py
django3_codemods/replace_unicode_with_str.py
import sys from bowler import Query ( Query(sys.argv[1]) .select_function("__unicode__") .rename('__str__') .idiff() ), ( Query(sys.argv[1]) .select_method("__unicode__") .is_call() .rename('__str__') .idiff() )
Python
0.000001
d85a68e36443bfcdeed2d8f1f3960d1596ef762a
Create catchtheball.py
catchtheball.py
catchtheball.py
import simplegui import random FRAME_WIDTH=STAGE_WIDTH=GROUND_WIDTH=821 FRAME_HEIGHT=498 STAGE_HEIGHT=FRAME_HEIGHT-30 PADDLE_HEIGHT=STAGE_HEIGHT PADDLE_WIDTH=8 PADDLE_POS=[STAGE_WIDTH/2,PADDLE_HEIGHT] image=simplegui.load_image("http://mrnussbaum.com/calendarclowns1/images/game_background.png") list_of_balls=[] col...
Python
0.000007
54bb69cd3646246975f723923254549bc5f11ca0
Add default paver commands
citools/paver.py
citools/paver.py
@task @consume_args @needs('unit', 'integrate') def test(): """ Run whole testsuite """ def djangonize_test_environment(test_project_module): sys.path.insert(0, abspath(join(dirname(__file__)))) sys.path.insert(0, abspath(join(dirname(__file__), "tests"))) sys.path.insert(0, abspath(join(dirname(__fil...
Python
0.000001
0575a141153fb07a5f03c0681cdf727450348fc0
Create space.py
space.py
space.py
def ParentOf(n, arr): if arr[n] == n: return n else: return ParentOf(arr[n],arr) n, p = list(map(int, input().split())) arr = [] for t in range(0,n): arr.append(t) for q in range(p): #Quick Union the line first, sec = list(map(int,input().split())) arr[first] = ParentOf(sec) ...
Python
0.001193
3c074ab5c630590ca32f8951eecb3087afd8ae01
add solution for Binary Tree Level Order Traversal II
src/binaryTreeLevelOrderTraversalII.py
src/binaryTreeLevelOrderTraversalII.py
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @return a list of lists of integers def levelOrderBottom(self, root): self.res = [] ...
Python
0
a5f90890f3cdd516c3955c868234ea1ffc7bd093
Verify that archiving audit + fql files work
auditlog_test.py
auditlog_test.py
import logging import os import os.path import pytest import shlex import stat import subprocess import tempfile import time from ccmlib.node import handle_external_tool_process from dtest import Tester since = pytest.mark.since logger = logging.getLogger(__name__) @since('4.0') class TestAuditlog(Tester): def t...
Python
0
79cf7834c4a92f84c3595af302c7b0bfa09331f2
word2vec basic
Experiments/Tensorflow/Neural_Networks/logic_gate_linear_regressor.py
Experiments/Tensorflow/Neural_Networks/logic_gate_linear_regressor.py
''' Logical Operation by 2-layer Neural Networks (using TF Layers) on TensorFlow Author: Rowel Atienza Project: https://github.com/roatienza/Deep-Learning-Experiments ''' # On command line: python3 logic_gate_linear_regressor.py # Prerequisite: tensorflow 1.0 (see tensorflow.org) from __future__ import print_function ...
Python
0.999103
f22b6368bdfe91cff06ede51c1caad04f769b437
add management command to load location type into supply point
custom/colalife/management/commands/load_location_type_into_supply_point.py
custom/colalife/management/commands/load_location_type_into_supply_point.py
from corehq.apps.commtrack.models import SupplyPointCase from corehq.apps.locations.models import Location from django.core.management import BaseCommand class Command(BaseCommand): help = 'Store location type with supply point.' def handle(self, *args, **options): for location_type in ["wholesaler",...
Python
0
3e02fe79f4fad6f5252af750a13d74d7a4f82cc5
read in the file, probably badly
src/emc/usr_intf/touchy/filechooser.py
src/emc/usr_intf/touchy/filechooser.py
# Touchy is Copyright (c) 2009 Chris Radek <chris@timeguy.com> # # Touchy 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 2 of the License, or # (at your option) any later version. # # Touchy i...
# Touchy is Copyright (c) 2009 Chris Radek <chris@timeguy.com> # # Touchy 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 2 of the License, or # (at your option) any later version. # # Touchy i...
Python
0.000001
2c98e54c7f2138b4472336520ab18af8f49b9b48
test networks on test data corresponding to each dataset
test_network.py
test_network.py
import keras from keras.optimizers import SGD, adadelta, rmsprop, adam from keras.preprocessing.image import ImageDataGenerator from keras.utils import np_utils from keras.metrics import matthews_correlation, precision, recall import cPickle import numpy as np import getpass username = getpass.getuser() from foo_two...
Python
0.000037
ed94317df99493c24c58a1e1aa553a8f822e793f
Test cases
erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py
erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import unittest import frappe import erpnext from erpnext.accounts.report.sales_payment_summary.sales_payment_summary import get_mode_of_payments, get_m...
Python
0.000001
37793ec10e2b27e64efaa3047ae89a6d10a6634d
Update urlrewrite_redirect.py
flexget/plugins/urlrewrite_redirect.py
flexget/plugins/urlrewrite_redirect.py
from __future__ import unicode_literals, division, absolute_import import logging from flexget import plugin from flexget.event import event log = logging.getLogger('urlrewrite_redirect') class UrlRewriteRedirect(object): """Rewrites urls which actually redirect somewhere else.""" def __init__(self): ...
from __future__ import unicode_literals, division, absolute_import import logging from flexget import plugin from flexget.event import event log = logging.getLogger('urlrewrite_redirect') class UrlRewriteRedirect(object): """Rewrites urls which actually redirect somewhere else.""" def __init__(self): ...
Python
0
e4ca040124e26b06a11e7fb51c3622a213285d24
Create thresholding.py
thresholding.py
thresholding.py
import numpy as np from PIL import Image def discretize(a): return np.uint8((a > 50)*255) image_id = 101 dirty_image_path = "../input/train/%d.png" % image_id clean_image_path = "../input/train_cleaned/%d.png" % image_id dirty = Image.open(dirty_image_path) clean = Image.open(clean_image_path) dirty.save("dirty...
Python
0
d78444cdb6018e2fe49905638ce7645e8de5738b
add util/csv_melt.py
util/csv_melt.py
util/csv_melt.py
#!/usr/bin/env python # https://github.com/shenwei356/bio_scripts" import argparse import csv import re import sys import pandas as pd parser = argparse.ArgumentParser( description="Melt CSV file, you can append new column", epilog="https://github.com/shenwei356/bio_scripts") parser.add_argument( 'key', ...
Python
0.000008
326010629c6d5bb1274d1db1231f5b84c394b4e4
Add some api tests for ZHA (#20909)
tests/components/zha/test_api.py
tests/components/zha/test_api.py
"""Test ZHA API.""" from unittest.mock import Mock import pytest from homeassistant.const import ATTR_ENTITY_ID from homeassistant.components.switch import DOMAIN from homeassistant.components.zha.api import ( async_load_api, WS_ENTITIES_BY_IEEE, WS_ENTITY_CLUSTERS, ATTR_IEEE, TYPE, ID, NAME, WS_ENTITY_CLUSTER_...
Python
0
3593fdc86dcb2559677b3b1f996c5c0e00659bc9
Add parser for 7elc (b)
d_parser/d_spider_7elc.py
d_parser/d_spider_7elc.py
from d_parser.d_spider_common import DSpiderCommon from d_parser.helpers.re_set import Ree from helpers.url_generator import UrlGenerator VERSION = 28 # Warn: Don't remove task argument even if not use it (it's break grab and spider crashed) # Warn: noinspection PyUnusedLocal class DSpider(DSpiderCommon): def _...
Python
0.000786
377c61203d2e684b9b8e113eb120213e85c4487f
Fix call to super() (#19279)
homeassistant/components/light/lutron.py
homeassistant/components/light/lutron.py
""" Support for Lutron lights. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/light.lutron/ """ import logging from homeassistant.components.light import ( ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light) from homeassistant.components.lutron import ( ...
""" Support for Lutron lights. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/light.lutron/ """ import logging from homeassistant.components.light import ( ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light) from homeassistant.components.lutron import ( ...
Python
0
0b1fc2eb8dad6e5b41e80c5b0d97b9f8a20f9afa
Add utils.py
krcurrency/utils.py
krcurrency/utils.py
""":mod:`krcurrency.utils` --- Helpers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ from bs4 import BeautifulSoup as BS import requests __all__ = 'request', def request(url, encoding='utf-8', parselib='lxml'): """url๋กœ ์š”์ฒญํ•œ ํ›„ ๋Œ๋ ค๋ฐ›์€ ๊ฐ’์„ BeautifulSoup ๊ฐ์ฒด๋กœ ๋ณ€ํ™˜ํ•ด์„œ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. """ r = requests.get(url) if r.status_c...
Python
0.000004
76a2c80b015228dd4c6aa932ca9b2faece23a714
Create multiplesof3and5.py
multiplesof3and5.py
multiplesof3and5.py
#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. answer = 0 for i in range (1,1000); if i%3 = 0 or i%5 = 0; answer = answer + i else; continue print answer
Python
0.998635
2d1624f088431e5f71214988499f732695a82b16
Bump version 0.15.0rc3 --> 0.15.0rc4
lbrynet/__init__.py
lbrynet/__init__.py
import logging __version__ = "0.15.0rc4" version = tuple(__version__.split('.')) logging.getLogger(__name__).addHandler(logging.NullHandler())
import logging __version__ = "0.15.0rc3" version = tuple(__version__.split('.')) logging.getLogger(__name__).addHandler(logging.NullHandler())
Python
0
a79e76470f747e6dc060c7aa3e0f02ee825eeb56
Add back enikshay missing foreign key constraints
custom/enikshay/management/commands/add_back_enikshay_foreign_keys.py
custom/enikshay/management/commands/add_back_enikshay_foreign_keys.py
from datetime import datetime from django.db import connections from django.core.management.base import BaseCommand from corehq.sql_db.util import get_db_aliases_for_partitioned_query def foreign_key_exists(db_alias, table_name, foreign_key_name): cursor = connections[db_alias].cursor() cursor.execute( ...
Python
0.000009
5dd4deba3d5a53406e735aadad5ac917919b3852
add tests for PlotableObject
tests/unit/TestPlotableObject.py
tests/unit/TestPlotableObject.py
import os import unittest import ROOT from PyAnalysisTools.PlottingUtils import PlotableObject as po cwd = os.path.dirname(__file__) ROOT.gROOT.SetBatch(True) class TestPlotableObject(unittest.TestCase): def test_ctor(self): obj = po.PlotableObject() self.assertIsNone(obj.plot_object) se...
Python
0
f0651b2b68ecb4ac093a07d72722b65ea134baa9
Remove trailing slashes.
pelican/__init__.py
pelican/__init__.py
import argparse import os from pelican.settings import read_settings from pelican.utils import clean_output_dir from pelican.writers import Writer from pelican.generators import (ArticlesGenerator, PagesGenerator, StaticGenerator, PdfGenerator) def init_params(settings=None, path=None...
import argparse import os from pelican.settings import read_settings from pelican.utils import clean_output_dir from pelican.writers import Writer from pelican.generators import (ArticlesGenerator, PagesGenerator, StaticGenerator, PdfGenerator) def init_params(settings=None, path=Non...
Python
0.000005
854a1ab7c13b4d4d8e28ab13f0cdaef5c1fcb9a6
Create solution.py
hackerrank/algorithms/warmup/easy/compare_the_triplets/py/solution.py
hackerrank/algorithms/warmup/easy/compare_the_triplets/py/solution.py
#!/bin/python3 import sys cmp = lambda a, b: (a > b) - (b > a) aliceScores = tuple(map(int, input().strip().split(' '))) bobScores = tuple(map(int, input().strip().split(' '))) scoreCmp = tuple(map(lambda a, b: cmp(a, b), aliceScores, bobScores)) aliceScore = len(tuple(filter(lambda x: x > 0, scoreCmp...
Python
0.000018
4764b5248cf91042a12ce6aef77a04c37360eb4f
Add initial shell of Pyglab class.
pyglab/pyglab.py
pyglab/pyglab.py
import requests class Pyglab(object): def __init__(self, token): self.token = token self.headers = {'PRIVATE-TOKEN', token} self.user = None def sudo(self, user): """Permanently set a different username. Returns the old username.""" previous_user = self.user s...
Python
0
70e04b20c5d78b41546aa4ea1a1e2fd82af7527f
Add JSON HttpResponse that does the encoding for you.
comrade/http/__init__.py
comrade/http/__init__.py
from django.core.serializers import json, serialize from django.db.models.query import QuerySet from django.http import HttpResponse from django.utils import simplejson class HttpJsonResponse(HttpResponse): def __init__(self, object, status=None): if isinstance(object, QuerySet): content = seri...
Python
0
d3ba2b8cf84ba54d932fcc48b464f125798c0b27
Add simple bash with git install script
toolbox/install_script_git.sh.py
toolbox/install_script_git.sh.py
#!/bin/bash venv="nephoria_venv" neph_branch="oldboto" adminapi_branch="master" yum install -y python-devel gcc git python-setuptools python-virtualenv if [ ! -d adminapi ]; then git clone https://github.com/nephomaniac/adminapi.git fi if [ ! -d nephoria ]; then git clone https://github.com/nephomaniac/nephoria...
Python
0
5ae194cacef0a24c3d6a0714d3f435939973b3cb
Add some helpful utilities
utils.py
utils.py
from functools import wraps def cached_property(f): name = f.__name__ @property @wraps(f) def inner(self): if not hasattr(self, "_property_cache"): self._property_cache = {} if name not in self._property_cache: self._property_cache[name] = f(self) return...
Python
0
93b1253389075174fa942e848d6c1f7666ffc906
add solution for Combination Sum II
src/combinationSumII.py
src/combinationSumII.py
class Solution: # @param candidates, a list of integers # @param target, integer # @return a list of lists of integers def combinationSum2(self, candidates, target): if not candidates: return [] candidates.sort() n = len(candidates) res = set() def s...
Python
0.000001
19d5b2f58d712f49638dad83996f9e60a6ebc949
Add a release script.
release.py
release.py
#!/usr/bin/env python import re import ast import subprocess def version(): _version_re = re.compile(r'__version__\s+=\s+(.*)') with open('pgcli/__init__.py', 'rb') as f: version = str(ast.literal_eval(_version_re.search( f.read().decode('utf-8')).group(1))) return version def create...
Python
0
7d2906d58db373f5f7326c140e8cb191bc3d0059
Make other logging work when logging/config_file is in use
mopidy/utils/log.py
mopidy/utils/log.py
from __future__ import unicode_literals import logging import logging.config import logging.handlers class DelayedHandler(logging.Handler): def __init__(self): logging.Handler.__init__(self) self._released = False self._buffer = [] def handle(self, record): if not self._relea...
from __future__ import unicode_literals import logging import logging.config import logging.handlers class DelayedHandler(logging.Handler): def __init__(self): logging.Handler.__init__(self) self._released = False self._buffer = [] def handle(self, record): if not self._relea...
Python
0
0003b3fe31a1b92dda994b2f7eacf6cef7e08ce4
Add check_blocked.py
check_blocked.py
check_blocked.py
# This script is licensed under the GNU Affero General Public License # either version 3 of the License, or (at your option) any later # version. # # This script was tested on GNU/Linux opreating system. # # To run this script: # 1) Download the list of articles for the Wikipedia edition that # you want to scan ...
Python
0.000002