commit
stringlengths
40
40
subject
stringlengths
4
1.73k
repos
stringlengths
5
127k
old_file
stringlengths
2
751
new_file
stringlengths
2
751
new_contents
stringlengths
1
8.98k
old_contents
stringlengths
0
6.59k
license
stringclasses
13 values
lang
stringclasses
23 values
6855bfdc910c0c74743906f195f430817f2399b3
Add rel-fra creation
moreymat/omw-graph,moreymat/omw-graph,moreymat/omw-graph
omwg/fra2tab.py
omwg/fra2tab.py
#!/usr/share/python # -*- encoding: utf-8 -*- # # Extract synset-word pairs from the WOLF (Wordnet Libre du Français) # Remap 'b' to 'r' # Some clean up (remove ' ()', '|fr.*') import sys, re import codecs, collections ### Change this! wndata = "../wordnet/" wnname = "WOLF (Wordnet Libre du Français)" wnurl = "http:...
mit
Python
4731e99882d035a59555e5352311d00c4e122f09
Print useful information about a GTFS feed
transitland/transitland-python-client,srthurman/transitland-python-client
onestop/info.py
onestop/info.py
"""Provide useful information about a GTFS file.""" import argparse import geohash import gtfs if __name__ == "__main__": parser = argparse.ArgumentParser(description='GTFS Information') parser.add_argument('filename', help='GTFS File') parser.add_argument('--debug', help='Show helpful debugging information', a...
mit
Python
335881f4644a6bb2b5f2abb5b193f39d304dbc71
Fix user agent for the bnn_ sites
chilland/scraper,openeventdata/scraper
pages_scrape.py
pages_scrape.py
import logging import requests def scrape(url, extractor): """ Function to request and parse a given URL. Returns only the "relevant" text. Parameters ---------- url : String. URL to request and parse. extractor : Goose class instance. An instance of Goose th...
import logging import requests def scrape(url, extractor): """ Function to request and parse a given URL. Returns only the "relevant" text. Parameters ---------- url : String. URL to request and parse. extractor : Goose class instance. An instance of Goose th...
mit
Python
dddf634f8445fac66aa25265c7f7e859dab4c000
add test file for python
KeitaNakamura/highlighter.nvim
test/test.py
test/test.py
# Highlighter Demo class Person: def __init__(self, x): self.x = x def show(self): print(self.x) person = Person("Ken") person.show()
mit
Python
abcbe6443492ba2f011dec0132a0afb3b8cc9b0b
Create __init__.py
terry-12345/hello-world
hello-world/__init__.py
hello-world/__init__.py
bsd-2-clause
Python
8d36c444fe379b5901692485c2850e86ed714f89
Add sql connection tester
stormaaja/csvconverter,stormaaja/csvconverter,stormaaja/csvconverter
sql_connection_test.py
sql_connection_test.py
import mysql.connector import json with open("config.json") as f: config = json.load(f) try: conn = mysql.connector.connect( user=config["database_connection"]["username"], password=config["database_connection"]["password"], host=config["database_connection"]["host"], d...
mit
Python
05741f17ffac95d66290d2ec705cbfb66fc74ff9
Add dummpy documentation/stats/plot_sky_locations.py
gammapy/gamma-cat
documentation/stats/plot_sky_locations.py
documentation/stats/plot_sky_locations.py
from bokeh.plotting import figure, output_file, show output_file("example.html") x = [1, 2, 3, 4, 5] y = [6, 7, 6, 4, 5] p = figure(title="example", plot_width=300, plot_height=300) p.line(x, y, line_width=2) p.circle(x, y, size=10, fill_color="white") show(p)
bsd-3-clause
Python
fe4b226b9b3d6fbc7be7d545c185ed7950f3a5fd
Add Python benchmark
stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib
lib/node_modules/@stdlib/math/base/dist/beta/logpdf/benchmark/python/benchmark.scipy.py
lib/node_modules/@stdlib/math/base/dist/beta/logpdf/benchmark/python/benchmark.scipy.py
#!/usr/bin/env python """Benchmark scipy.stats.beta.logpdf.""" import timeit name = "beta:logpdf" repeats = 3 iterations = 1000 def print_version(): """Print the TAP version.""" print("TAP version 13") def print_summary(total, passing): """Print the benchmark summary. # Arguments * `total`:...
apache-2.0
Python
c36e390910b62e1ad27066a0be0450c81a6f87c6
Add context manager for logging
DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python
d1_common_python/src/d1_common/logging_context.py
d1_common_python/src/d1_common/logging_context.py
# -*- coding: utf-8 -*- """Context manager that enables temporary changes in logging level. Note: Not created by DataONE. Source: https://docs.python.org/2/howto/logging-cookbook.html """ import logging import sys class LoggingContext(object): def __init__(self, logger, level=None, handler=None, close=True): s...
apache-2.0
Python
4e36e520cb8fef8f07b545a3109e8507789e64bf
add tests, most are still stubbed out
mohierf/mod-ui-graphite,mohierf/mod-ui-graphite
tests/test.py
tests/test.py
import unittest import urlparse import sys import os import time from datetime import datetime FILE_PATH = os.path.dirname(os.path.realpath(__file__)) ROOT_PATH = os.path.abspath(os.path.join(FILE_PATH, '../')) sys.path.append(ROOT_PATH) from module.util import JSONTemplate from module.graphite_utils import GraphSty...
agpl-3.0
Python
6c7a927e2fc0a054470c2a87fa98d07e993657ac
Add tests
ordian/pydirectio,ordian/pydirectio
test/test.py
test/test.py
import os import unittest try: import directio except ImportError: import sys sys.exit(""" Please install directio: take a look at directio/README""") class TestDirectio(unittest.TestCase): def setUp(self): super(TestDirectio, self).setUp() flags = os.O_RDWR | os.O_DIRECT |...
mit
Python
45148b72cb69c49b2a6ef6e278f23d63328a7942
Clean up and docs
kristofvanmoffaert/python-omniture,dancingcactus/python-omniture,kristofvanmoffaert/python-omniture,kristofvanmoffaert/python-omniture,dancingcactus/python-omniture,dancingcactus/python-omniture
testQuery.py
testQuery.py
#!/usr/bin/python import unittest import omniture import sys import os import pprint creds = {} creds['username'] = os.environ['OMNITURE_USERNAME'] creds['secret'] = os.environ['OMNITURE_SECRET'] class QueryTest(unittest.TestCase): def setUp(self): self.analytics = omniture.authenticate(creds['username'...
mit
Python
96a3fc178c9da5a8f917378e40454a0702d746e5
Initialize construction module
Nekroze/drydock,Nekroze/drydock
drydock/construction.py
drydock/construction.py
"""DryDock container construction.""" def construct(spec): pass
mit
Python
4c33fe7a927cde83aa53374e9fcaedfa18e51e77
Add function to delete collection
tracek/gee_asset_manager
utilities.py
utilities.py
def delete_collection(ee, id): if 'users' not in id: root_path_in_gee = ee.data.getAssetRoots()[0]['id'] id = root_path_in_gee + '/' + id params = {'id': id} items_in_collection = ee.data.getList(params) for item in items_in_collection: ee.data.deleteAsset(item['id']) ee.data...
apache-2.0
Python
4d9d286ec96e834fcb9acf1f1f52876e81668996
Test script
billingstack/python-fakturo-billingstack
tools/test.py
tools/test.py
from fakturo.billingstack.client import Client client = Client('http://localhost:9090/billingstack', username='ekarlso', password='secret0') merchants = client.merchant.list()
apache-2.0
Python
583b520a6dada6e7a8bf984469fd6d2e9d8eaf28
add general methods to instruments
rstoneback/pysat
pysat/instruments/methods/general.py
pysat/instruments/methods/general.py
# -*- coding: utf-8 -*- """Provides generalized routines for integrating instruments into pysat. """ from __future__ import absolute_import, division, print_function import pandas as pds import pysat import logging logger = logging.getLogger(__name__) def list_files(tag=None, sat_id=None, data_path=None, format_s...
bsd-3-clause
Python
79a236133ea00fa1d1af99426380392fe51ec0f4
Create iis_shortname.py
nanshihui/PocCollect,nanshihui/PocCollect
middileware/iis/iis_shortname.py
middileware/iis/iis_shortname.py
#!/usr/bin/env python # encoding: utf-8 from t import T import re import urllib2,requests,urllib2,json,urlparse requests.packages.urllib3.disable_warnings() class P(T): def __init__(self): T.__init__(self) def verify(self,head='',context='',ip='',port='',productname={},keywords='',hackinfo='',verify...
mit
Python
50af4f518912f758e7961055342642c9d31832a0
Create 6-pwm2.py
CamJam-EduKit/EduKit3
Code/6-pwm2.py
Code/6-pwm2.py
# CamJam EduKit 3 - Robotics # Worksheet 6 – Varying the speed of each motor with PWM import RPi.GPIO as GPIO # Import the GPIO Library import time # Import the Time library # Set the GPIO modes GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) # Set variables for the GPIO motor pins pinMotorAForwards = 10 pinMotorABac...
mit
Python
2d25c2329a9ae4d084671ab99cf53290fe7547ab
add tests for cython script
adrn/streams,adrn/streams
streams/simulation/tests/test_integrate_lm10.py
streams/simulation/tests/test_integrate_lm10.py
# coding: utf-8 """ Test the Cython integrate code """ from __future__ import absolute_import, unicode_literals, division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import os, sys import glob import time # Third-party import numpy as np import pytest import astropy.units as...
mit
Python
af3333906125e9bde3cc5b3ebdb7209c25bcf6ff
Add pinger script
johan-andersson01/biblion,johan-andersson01/biblion,johan-andersson01/biblion,johan-andersson01/biblion
pinger.py
pinger.py
#!/usr/bin/python3 import requests import datetime import time while True: hour = datetime.datetime.now().hour if hour > 7: requests.get('https://biblion.se') time.sleep(60*29)
mit
Python
e140c21cd0b7d5b0e7cbe7895096476105d03f91
Create update_sql.py
dichild/Searching,dichld/A-framework-of-search-engine-using-python-and-mysql
update_sql.py
update_sql.py
__author__ = 'userme865' # ver 0.1 import MySQLdb def update_db(): try: # start msql and creat stable at first time conn = MySQLdb.connect(host='localhost', user='root', passwd='', port=3306) cur = conn.cursor() conn.select_db('python') cur.execute('DROP TABLE dataexchange') ...
mit
Python
3921f1522851767444644d1dc3c126521476d9dc
add util script to help troll autoplot feature ideas
akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem
scripts/util/list_stale_autoplots.py
scripts/util/list_stale_autoplots.py
"""Look into which autoplots have not been used in a while""" import psycopg2 import re import pandas as pd QRE = re.compile("q=([0-9]+)") pgconn = psycopg2.connect(database='mesosite', host='iemdb', user='nobody') cursor = pgconn.cursor() cursor.execute("""SELECT valid, appurl from feature WHERE appurl is not null ...
mit
Python
faa6872cf008171afa3db6687d23c1bcc9b6dbac
Add views to the main files
Etskh/TheDruid,Etskh/TheDruid,Etskh/TheDruid,Etskh/TheDruid
Druid/views.py
Druid/views.py
from django.shortcuts import render from gfx.models import Material from django.template import RequestContext def home( request ): rc = RequestContext(request) return render( request, 'Druid/index.html', context_instance=rc )
mit
Python
fc23860b1adbf7c75dfd53dc213c24a65b455597
Create ExtractData.py
anfederico/Stock-Talk
ExtractData.py
ExtractData.py
bsd-2-clause
Python
ff3b36b4d64af54b6bd22f107a9d5dd5cf4f4473
solve problem no.1152
ruby3141/algo_solve,ruby3141/algo_solve,ruby3141/algo_solve
1152/answer.py
1152/answer.py
from sys import stdin input = stdin.readline().strip() if input == "": print(0) exit() i = 1 for char in input: if char == ' ': i += 1 print(i)
mit
Python
f5706084caca2c6f6235914cb70e79c16438e1a0
Create OverlappingAMR.py
lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples
src/Python/CompositeData/OverlappingAMR.py
src/Python/CompositeData/OverlappingAMR.py
#!/usr/bin/env python import vtk def MakeScalars(dims, origin, spacing, scalars): # Implicit function used to compute scalars sphere = vtk.vtkSphere() sphere.SetRadius(3) sphere.SetCenter(5, 5, 5) scalars.SetNumberOfTuples(dims[0]*dims[1]*dims[2]) for k in range(0, dims[2]): z = origin[...
apache-2.0
Python
82bfe668b11ac76159f2a599734ba33c4ef57026
Add another views_graph_service file
corpulentcoffee/globus-sdp,globus/globus-sample-data-portal
portal/views_graph_service.py
portal/views_graph_service.py
from flask import (flash, redirect, render_template, request, session, url_for) import requests from portal import app, datasets from portal.decorators import authenticated from portal.utils import get_portal_tokens @app.route('/graph', methods=['GET', 'POST']) @authenticated def graph(): if r...
unlicense
Python
3684e8be098300006b09c6677a2805e10d623acd
Add GYP file tld_cleanup tool.
Crystalnix/house-of-life-chromium,yitian134/chromium,gavinp/chromium,adobe/chromium,adobe/chromium,gavinp/chromium,ropik/chromium,adobe/chromium,yitian134/chromium,Crystalnix/house-of-life-chromium,ropik/chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,ropik/chromium,gavinp/chromium,gavinp/chromium,ropik/chro...
net/tools/tld_cleanup/tld_cleanup.gyp
net/tools/tld_cleanup/tld_cleanup.gyp
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, }, 'includes': [ '../../../build/common.gypi', ], 'targets': [ { 'target_name': 'tld_cle...
bsd-3-clause
Python
5f9c7d10957c7b0b0da46b031120fe2434315d0d
Test of new persistence layer.
seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core
ndtable/persistence/simple.py
ndtable/persistence/simple.py
from ndtable.carray import carray, cparams from bloscpack import pack_list, unpack_file from numpy import array, frombuffer def test_simple(): filename = 'output' # hackish, just experimenting! arr = carray(xrange(10000)).chunks ca = [bytes(chunk.viewof) for chunk in arr] pack_list(ca, {}, filenam...
bsd-2-clause
Python
e6a4863d9663791fabc4bd6ccdf0ab45ba2a86eb
Add standalone benchmark runner
urschrei/lonlat_bng,urschrei/rust_bng,urschrei/lonlat_bng,urschrei/lonlat_bng,urschrei/rust_bng
remote_bench.py
remote_bench.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Standalone benchmark runner """ import cProfile import pstats import profile import numpy as np print("Running Rust and Pyproj benchmarks\n") # calibrate pr = profile.Profile() calibration = np.mean([pr.calibrate(100000) for x in xrange(5)]) # add the bias profile.Pr...
mit
Python
b4042f23d02e77c45d772fe64ae5e98db8b5e4e4
Add new package: re2 (#18302)
LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack
var/spack/repos/builtin/packages/re2/package.py
var/spack/repos/builtin/packages/re2/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Re2(CMakePackage): """RE2 is a fast, safe, thread-friendly alternative to backtracking ...
lgpl-2.1
Python
9c0bcd4e0317aa8b76ebbf3c9ecae82d1b90027d
Create initial night sensor code for Pi
wodiesan/senior_design_spring
night_sensor/night_feature.py
night_sensor/night_feature.py
""" @author: Sze "Ron" Chau @e-mail: chaus3@wit.edu @source: https://github.com/wodiesan/sweet-skoomabot @desc Night sensor-->RPi for Senior Design 1 """ import logging import os import RPi.GPIO as GPIO import serial import subprocess import sys import time import traceback # GPIO pins. Uses the BC...
mit
Python
b7e1e05bfe5aa7a8d91a4d8ee786e61b4aa7bd1b
Add ArrayQueue
xliiauo/leetcode,xliiauo/leetcode,xiao0720/leetcode,xliiauo/leetcode,xiao0720/leetcode
ArrayQueue.py
ArrayQueue.py
class ArrayQueue: def __init__(self, max=10): self._data = [None] * max self._size = 0 self._front = 0 self._max = max def enqueue(self, e): self._data[(self._front + self._size) % self._max] = e self._size += 1 def dequeue(self): rst, self._data[sel...
mit
Python
55b6d19fc8c80e3d4ff7842f20d284879f5ea151
Create BubbleSort.py
CindyDing1115/DataStruct_Sort
BubbleSort.py
BubbleSort.py
""" 冒泡: 原始版本:将i由0开始,与后面每一个j=i+1 进行比较,交换 再i=1 ...这样好不容易换到前面第一位的容易被序列最后一个最小值直接怼到末尾去 现在的更新版:i由0开始 j = length-2 与 j = length-1 进行比较,换位 确保移到上面的较小值不会有太大的变动 -- 见P381 图 """ def bubble_sort(lists): count = len(lists) for i in range(0, count): for j i...
epl-1.0
Python
17966b6af3039aa6d6308e1592c14527513c70c1
apply oa start date from journals to relative update requests - script
DOAJ/doaj,DOAJ/doaj,DOAJ/doaj,DOAJ/doaj
portality/migrate/3053_oa_start_date_from_journals_to_urs/migrate.py
portality/migrate/3053_oa_start_date_from_journals_to_urs/migrate.py
""" This script can be run to generate a CSV output of accounts which do not have their passwords set, along with some useful account information, and possible explanations for the lack of password ``` python accounts_with_missing_passwords.py -o accounts.csv ``` """ import csv import esprit from portality.core import...
apache-2.0
Python
ab50818c18b4275c205419c4c844bfc9ecb7a4c8
add rename.py
jiangzhonghui/ToolScripts,jiangzhonghui/ToolScripts,jiangzhonghui/ToolScripts
FileUtils/rename.py
FileUtils/rename.py
import os import sys import re dirname, filename = os.path.split(os.path.abspath(sys.argv[0])) os.chdir(dirname) fileList = os.listdir(dirname) print dirname name='edge_effect_' for fileItem in fileList: dotIndex = fileItem.rfind('.') fileName = fileItem[: dotIndex] fileExt = fileItem[dotIndex : ] print fileName,f...
apache-2.0
Python
dc993796fc15e3670c8a702f43fcb9a5d9b4c84e
Add forgotten file.
astrobin/astrobin,astrobin/astrobin,astrobin/astrobin,astrobin/astrobin
astrobin_apps_donations/utils.py
astrobin_apps_donations/utils.py
from subscription.models import UserSubscription def user_is_donor(user): if user.is_authenticated: return UserSubscription.objects.filter(user = user, subscription__name = 'AstroBin Donor').count() > 0 return False
agpl-3.0
Python
e51f3869b4a047489b9bb1e4b88af0e0bdc3078b
Add a command to list all the documents.
maxking/paper-to-git,maxking/paper-to-git
paper_to_git/commands/list_command.py
paper_to_git/commands/list_command.py
""" List the Documents and Folders """ from paper_to_git.commands.base import BaseCommand from paper_to_git.models import PaperDoc, PaperFolder __all__ = [ 'ListCommand', ] class ListCommand(BaseCommand): """List the PaperDocs and Folders """ name = 'list' def add(self, parser, command_par...
apache-2.0
Python
a797de9014a3d466bb10e9bc318c3e2edec328be
add base for rendering widgets
VisTrails/VisTrails,Nikea/VisTrails,hjanime/VisTrails,minesense/VisTrails,hjanime/VisTrails,hjanime/VisTrails,VisTrails/VisTrails,minesense/VisTrails,Nikea/VisTrails,celiafish/VisTrails,celiafish/VisTrails,minesense/VisTrails,hjanime/VisTrails,VisTrails/VisTrails,hjanime/VisTrails,minesense/VisTrails,VisTrails/VisTrail...
packages/SCIRun/renderbase.py
packages/SCIRun/renderbase.py
from core import system from core.modules.module_registry import registry from packages.spreadsheet.basic_widgets import SpreadsheetCell, CellLocation class Render(SpreadsheetCell): def compute(self): pass def registerRender(): registry.add_module(Render, abstract=True)
bsd-3-clause
Python
6a9fae290c8ce1618a7207efe669347b9503e3be
Add missing logparse file.
nyu-mll/spinn,nyu-mll/spinn,nyu-mll/spinn
python/spinn/util/logparse.py
python/spinn/util/logparse.py
""" Really easy log parsing. """ try: from parse import * except: pass import json FMT_TRAIN = "Train-Format: " FMT_TRAIN_EXTRA = "Train-Extra-Format: " FMT_EVAL = "Eval-Format: " FMT_EVAL_EXTRA = "Eval-Extra-Format: " IS_TRAIN = "Acc:" IS_TRAIN_EXTRA = "Train Extra:" IS_EVAL = "Eval acc:" IS_EVAL_EXTRA =...
mit
Python
8b1e6b226d925d7f2ef4890463122ec8046aa07a
add test
anvanza/invenavi,anvanza/invenavi,anvanza/invenavi
sensor/test_compass.py
sensor/test_compass.py
#! /usr/bin/python from Adafruit_LSM303 import LSM303 lsm = LSM303() while 1: print lsm.read()
mit
Python
a5dbda3f429d0a1e6cb4fc28b2a620dc2b40fd59
Resolve import dependency in consoleauth service
scripnichenko/nova,Tehsmash/nova,angdraug/nova,edulramirez/nova,mikalstill/nova,yatinkumbhare/openstack-nova,projectcalico/calico-nova,viggates/nova,devendermishrajio/nova_test_latest,varunarya10/nova_test_latest,alexandrucoman/vbox-nova-driver,sebrandon1/nova,JioCloud/nova,gooddata/openstack-nova,NeCTAR-RC/nova,goodda...
nova/cmd/consoleauth.py
nova/cmd/consoleauth.py
# Copyright (c) 2012 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 r...
# Copyright (c) 2012 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 r...
apache-2.0
Python
23b2578fadd8a7ee0885e9956a10667d647acaf8
add basic test for bist
cr1901/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware
test/test_bist.py
test/test_bist.py
#!/usr/bin/env python3 from litex.soc.tools.remote import RemoteClient wb = RemoteClient(csr_data_width=8) wb.open() regs = wb.regs # # # test_size = 128*1024*1024 regs.generator_reset.write(1) regs.generator_reset.write(0) regs.generator_base.write(0) regs.generator_length.write((test_size*8)//128) regs.generator...
bsd-2-clause
Python
f070b3c9a97b16aebc8500af703ed713e170f519
Fix Dask-on-Ray test: Python 3 dictionary .values() is a view, and is not indexable (#13945)
pcmoritz/ray-1,ray-project/ray,ray-project/ray,pcmoritz/ray-1,pcmoritz/ray-1,pcmoritz/ray-1,ray-project/ray,pcmoritz/ray-1,pcmoritz/ray-1,ray-project/ray,ray-project/ray,pcmoritz/ray-1,ray-project/ray,pcmoritz/ray-1,ray-project/ray,ray-project/ray
python/ray/tests/test_dask_scheduler.py
python/ray/tests/test_dask_scheduler.py
import dask import numpy as np import dask.array as da import pytest import ray from ray.util.dask import ray_dask_get def test_ray_dask_basic(ray_start_regular_shared): @ray.remote def stringify(x): return "The answer is {}".format(x) zero_id = ray.put(0) def add(x, y): # Can retri...
import dask import numpy as np import dask.array as da import pytest import ray from ray.util.dask import ray_dask_get def test_ray_dask_basic(ray_start_regular_shared): @ray.remote def stringify(x): return "The answer is {}".format(x) zero_id = ray.put(0) def add(x, y): # Can retri...
apache-2.0
Python
8e91c1fa76382f3b2568c425b41339f5597f9268
Add bound and brake solver (initial raw implementation)
Cosiek/KombiVojager
solvers/BoundAndBrake.py
solvers/BoundAndBrake.py
#!/usr/bin/env python # encoding: utf-8 from collections import deque from copy import deepcopy from itertools import permutations from random import shuffle from base_solver import BaseSolver INF = float('inf') class PartialSolution(object): lower_bound = INF upper_bound = INF partial_route = [] ...
mit
Python
5e008ac92016a092c1ce9c9590a79d72f4cf1cf6
Initialize tests
kshvmdn/cobalt-uoft-python
tests/__main__.py
tests/__main__.py
import unittest if __name__ == '__main__': unittest.main()
mit
Python
0e3effc3a7402d3b4c1b2c91539c4d1004c5b0e3
Add test_traitscli.py
tkf/traitscli,tkf/traitscli
test_traitscli.py
test_traitscli.py
import unittest from traits.api import Event, Callable, Type from traitscli import TraitsCLIBase from sample import SampleCLI class TestingCLIBase(TraitsCLIBase): def do_run(self): # Get trait attribute names names = self.class_trait_names( # Avoid 'trait_added' and 'trait_modified'...
bsd-3-clause
Python
31622652980f603ddc308dff514eae65635eb318
Add serializers to serialize Image to: - A PIL image (optionally resized) - A binary object (optionally resized)
comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django
app/grandchallenge/retina_api/serializers.py
app/grandchallenge/retina_api/serializers.py
from io import BytesIO import SimpleITK as sitk from PIL import Image as PILImage from django.http import Http404 from rest_framework import serializers class PILImageSerializer(serializers.BaseSerializer): """ Read-only serializer that returns a PIL image from a Image instance. If "width" and "height" ...
apache-2.0
Python
101a4c1288ddadbad6dbe0186adde3921ef2546f
add ctrl-c handler
DexterLB/bookrat,DexterLB/bookrat,DexterLB/bookrat,DexterLB/bookrat,DexterLB/bookrat
lib/ctrlc.py
lib/ctrlc.py
import sys import time import signal class CtrlC: pressed = False @classmethod def handle(cls, signal, frame): print('Ctrl-C pressed, will exit soon') if cls.pressed: print('Ctrl-C pressed twice. Committing violent suicide.') sys.exit(1) cls.pressed = True ...
mit
Python
1298cf9c7a40ce73d46067035ded2318c62f7380
Add simple tests for DrsSymbol and DrsIndexed
tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge
tests/drs_test.py
tests/drs_test.py
"""Tests for drudge scripts.""" from sympy import Symbol, IndexedBase from drudge.drs import DrsSymbol from drudge.utils import sympy_key # # Unit tests for the utility classes and functions # ------------------------------------------------ # def test_basic_drs_symb(): """Test the symbol class for basic oper...
mit
Python
a412295b09481113d6f42565520d03ce8bfd36b8
Create ECIScraper.py
mvineetmenon/ECIResultScraper
ECIScraper.py
ECIScraper.py
from bs4 import BeautifulSoup as bs import httplib class ECIScrapper: def __init__(self, url): self.url = url.split("/")[0] self.getrequest = '/'.join(url.split('/')[1:]) print self.url, self.getrequest self.connection = httplib.HTTPConnection(self.url) self.connection.request("GET", '/'+self.getrequest) ...
mit
Python
67018fa6dc38f0035b1ce17dee4a7840f37cab30
Move documentation to Sphinx/RST
Juniper/libslax,Juniper/libslax,Juniper/libslax
doc/conf.py
doc/conf.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # libslax documentation build configuration file, created by # sphinx-quickstart on Tue Oct 10 10:18:55 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # au...
bsd-3-clause
Python
1753de3492b76d9c13d72bde7f13c0f696499e3a
Add configuration of pytest with some fixtures related to tests based on fantasy example
vovanbo/aiohttp_json_api
tests/conftest.py
tests/conftest.py
import json import socket import uuid import docker as libdocker import pathlib import invoke import psycopg2 import pytest import time from jsonschema import Draft4Validator DSN_FORMAT = 'postgresql://{user}:{password}@{host}:{port}/{dbname}' @pytest.fixture(scope='session') def session_id(): return str(uuid....
mit
Python
82617f295ed21c179bab6ad3c3c2af5c417f40ba
Install pandas and scipy from Anaconda as part of upgrade process. Provides final installation fix for burden testing code. #167 #191
xuzetan/gemini,bpow/gemini,udp3f/gemini,bpow/gemini,xuzetan/gemini,bw2/gemini,bw2/gemini,brentp/gemini,arq5x/gemini,xuzetan/gemini,udp3f/gemini,bw2/gemini,bpow/gemini,brentp/gemini,bgruening/gemini,xuzetan/gemini,heuermh/gemini,arq5x/gemini,brentp/gemini,udp3f/gemini,bgruening/gemini,heuermh/gemini,bgruening/gemini,bgr...
gemini/gemini_update.py
gemini/gemini_update.py
"""Perform in-place updates of gemini and databases when installed into virtualenv. """ import os import subprocess import sys import gemini.config def release(parser, args): """Update gemini to the latest release, along with associated data files. """ url = "https://raw.github.com/arq5x/gemini/master/req...
"""Perform in-place updates of gemini and databases when installed into virtualenv. """ import os import subprocess import sys import gemini.config def release(parser, args): """Update gemini to the latest release, along with associated data files. """ url = "https://raw.github.com/arq5x/gemini/master/req...
mit
Python
41553e2c2a9ad7f2396e8492ce11d053c2fe5c7a
Add a console application template
dakside/pydemo,dakside/pydemo,letuananh/pydemo,letuananh/pydemo,dakside/pydemo
basic/template.py
basic/template.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' A template for writing Python application with MIT license. Latest version can be found at https://github.com/letuananh/pydemo References: Python documentation: https://docs.python.org/ argparse module: https://docs.python.org/2/howto/argparse.html PEP 257 - P...
mit
Python
f69de6e6cf63f9b3770ffdf4da32ca2149006a2e
add fit test for record, test is renamed so nose doesn't run it
jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt,scipy/scipy-svn,jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt,lesserwhirls/scipy-cwt,scipy/scipy-svn,jasonmccampbell/scipy-refactor,jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt,scipy/scipy-svn,scipy/scipy-svn
scipy/stats/tests/test_fit.py
scipy/stats/tests/test_fit.py
# NOTE: contains only one test, _est_cont_fit, that is renamed so that # nose doesn't run it # I put this here for the record and for the case when someone wants to # verify the quality of fit # with current parameters: import numpy.testing as npt import numpy as np from scipy import stats from t...
bsd-3-clause
Python
6908f6cb06ed1d15510bc51780d4109f5bdb7423
Add cs2cs_test.py to excercise the cs2cs binary via subprocess
schwehr/gdal-autotest2,schwehr/gdal-autotest2
python/third_party/proj/cs2cs_test.py
python/third_party/proj/cs2cs_test.py
# Copyright 2018 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
apache-2.0
Python
a911d8720ad7dd8bfff2fa4230e1a4cef1a232f5
add logistic
nicepear/machine-learning
logRegres.py
logRegres.py
''' Created on Oct 27, 2015 Logistic Regression Working Module @author: Gu ''' from numpy import * def loadDataSet(): dataMat = []; labelMat = [] fr = open('testSet.txt') for line in fr.readlines(): lineArr = line.strip().split() dataMat.append([1.0, float(lineArr[0]), float(lineArr[1])]) ...
mit
Python
7720fbc1d8a81430c38598fd96b95d8b4da4a74c
fix a bug about can not import ChineseAnalyzer with change tab to 4 wihte spaces under PEP8
wtl-zju/jieba,dennisit/jieba,lcwrey/jieba,WangYueFt/jieba,sx4452/jieba,Yinzo/jieba,Acanzyh/jieba,jango2015/jieba,insflow/jieba,HUANG-YI-CHEN/jieba,bladehd/jieba,GaussDing/jieba,beni55/jieba,liqueur/jieba,lcwrey/jieba,xuerenlv/jieba,PegasusWang/jieba,fbukevin/jieba,polossk/jieba,ZhangYet/jieba,tigerneil/jieba,didoteebin...
jieba/analyse/__init__.py
jieba/analyse/__init__.py
import jieba import os try: from analyzer import ChineseAnalyzer except ImportError: pass _curpath=os.path.normpath( os.path.join( os.getcwd(), os.path.dirname(__file__) ) ) f_name = os.path.join(_curpath,"idf.txt") content = open(f_name,'rb').read().decode('utf-8') idf_freq = {} lines = content.split('\n') ...
import jieba import os try: from analyzer import ChineseAnalyzer except ImportError: pass _curpath=os.path.normpath( os.path.join( os.getcwd(), os.path.dirname(__file__) ) ) f_name = os.path.join(_curpath,"idf.txt") content = open(f_name,'rb').read().decode('utf-8') idf_freq = {} lines = content.split('\n') for li...
mit
Python
ec96ce58076ba5aa54abeb423937a629cbe1e3d5
Work in progress
Commonists/DonationsLogParser,Commonists/DonationsLogParser
logparser.py
logparser.py
#!/usr/bin/python """ Log parser. """ from HTMLParser import HTMLParser import urllib class DailyParser(HTMLParser): """ HTML parser for the donations log of Wikimedia France Attributes: status (int): status variable of the parser. donations (list data.Donation): list of donations read. ...
mit
Python
162b82b64d319e0c854c08b3bd2e412ab5e67d97
add pytables testing file
cowlicks/blaze,scls19fr/blaze,alexmojaki/blaze,maxalbert/blaze,jcrist/blaze,cpcloud/blaze,cpcloud/blaze,mrocklin/blaze,xlhtc007/blaze,cowlicks/blaze,mrocklin/blaze,dwillmer/blaze,xlhtc007/blaze,jdmcbr/blaze,caseyclements/blaze,jdmcbr/blaze,ChinaQuants/blaze,LiaoPan/blaze,dwillmer/blaze,ChinaQuants/blaze,scls19fr/blaze,...
blaze/compute/tests/test_pytables_compute.py
blaze/compute/tests/test_pytables_compute.py
from __future__ import absolute_import, division, print_function import pytest tables = pytest.importorskip('tables') import numpy as np import tempfile from contextlib import contextmanager import os from blaze.compute.core import compute from blaze.compute.pytables import * from blaze.compute.numpy import * from b...
bsd-3-clause
Python
67df732067847af15e41b8eed05137b6ab2bb6d2
add __version__ (forgot to commit)
marcelm/cutadapt,Chris7/cutadapt
libcutadapt/__init__.py
libcutadapt/__init__.py
__version__ = '0.9.2'
mit
Python
188d583caea0e640f41e400839552fe593154eda
Set 2, challenge 9 completed.
walshman23/Cryptopals
set2/crypto9.py
set2/crypto9.py
#!/usr/local/bin/python __author__ = 'Walshman23' import sys sys.path.insert(1, "../common") # Want to locate modules in our 'common' directory # A block cipher transforms a fixed-sized block (usually 8 or 16 bytes) of plaintext into ciphertext. # But we almost never want to transform a single block; we encrypt irr...
bsd-3-clause
Python
ed33a8dc90468f2873a4a581c22027f10d9393d4
Add Wordpress_2_Instances testcase
dims/heat,redhat-openstack/heat,cryptickp/heat,rickerc/heat_audit,openstack/heat,cwolferh/heat-scratch,maestro-hybrid-cloud/heat,Triv90/Heat,cryptickp/heat,miguelgrinberg/heat,varunarya10/heat,varunarya10/heat,JioCloud/heat,takeshineshiro/heat,openstack/heat,steveb/heat,Triv90/Heat,miguelgrinberg/heat,jasondunsmore/hea...
heat/tests/functional/test_WordPress_2_Intances.py
heat/tests/functional/test_WordPress_2_Intances.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # 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 applicabl...
apache-2.0
Python
fb7bc8af34f3ed375d30b43655366e6368080e76
Create Import_Libraries.py
MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab
home/INMOOV/Config/ExtraConfig/Import_Libraries.py
home/INMOOV/Config/ExtraConfig/Import_Libraries.py
from java.lang import String from org.myrobotlab.net import BareBonesBrowserLaunch from datetime import datetime from subprocess import Popen, PIPE ####################### import threading import time import random import urllib, urllib2 import json import io import itertools import textwrap import codecs import socket...
apache-2.0
Python
4de971725601ed5f630ec103ad01cf5c624ad866
Add the occupancy sensor_class (#3176)
shaftoe/home-assistant,rohitranjan1991/home-assistant,ct-23/home-assistant,philipbl/home-assistant,varunr047/homefile,JshWright/home-assistant,rohitranjan1991/home-assistant,ct-23/home-assistant,DavidLP/home-assistant,xifle/home-assistant,LinuxChristian/home-assistant,eagleamon/home-assistant,happyleavesaoc/home-assist...
homeassistant/components/binary_sensor/__init__.py
homeassistant/components/binary_sensor/__init__.py
""" Component to interface with binary sensors. For more details about this component, please refer to the documentation at https://home-assistant.io/components/binary_sensor/ """ import logging import voluptuous as vol from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.ent...
""" Component to interface with binary sensors. For more details about this component, please refer to the documentation at https://home-assistant.io/components/binary_sensor/ """ import logging import voluptuous as vol from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.ent...
mit
Python
6f0b5a0dc44269d9e72f3698317604d90d6cecf3
add script for migrate user mailchimp
mattclark/osf.io,cslzchen/osf.io,saradbowman/osf.io,erinspace/osf.io,brianjgeiger/osf.io,adlius/osf.io,felliott/osf.io,leb2dg/osf.io,leb2dg/osf.io,icereval/osf.io,aaxelb/osf.io,erinspace/osf.io,pattisdr/osf.io,TomBaxter/osf.io,mfraezz/osf.io,brianjgeiger/osf.io,adlius/osf.io,aaxelb/osf.io,CenterForOpenScience/osf.io,fe...
scripts/fix_user_mailchimp.py
scripts/fix_user_mailchimp.py
import logging import sys from datetime import datetime from django.db import transaction from django.utils import timezone from website.app import setup_django setup_django() from osf.models import OSFUser from scripts import utils as script_utils from website.mailchimp_utils import subscribe_mailchimp from website ...
apache-2.0
Python
9571acd941cb7ecac96676ead87c43fadda3e74f
Create TimeUpload.py
GallaghG/Piditarod,GallaghG/Piditarod
TimeUpload.py
TimeUpload.py
from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive import time import csv timeID='0B9ffTjUEqeFEZ28zdTRhMlJlY0k' for i in range(10): #get the curret time date_time=time.asctime() date_time_split=date_time.split(' ') #gives a list with the date and time components time_only=date_time_...
mit
Python
7c6bbe3860e7cce0f464dc0d95683de3c5ca57a5
Add test of `ResNet50FeatureProducer()`
dave-lab41/pelops,d-grossman/pelops,Lab41/pelops,dave-lab41/pelops,d-grossman/pelops,Lab41/pelops
testci/test_resnet50_feature.py
testci/test_resnet50_feature.py
from PIL import Image import collections import datetime import numpy as np import pytest from pelops.features.resnet50 import ResNet50FeatureProducer @pytest.fixture def img_data(): DATA = [[[ 0, 0, 0], [255, 255, 255], [ 0, 0, 0]], [[255, 255, 255], ...
apache-2.0
Python
d8a3f92a06971ba6fe24f71914a466ff91f00f5f
Create WikiBot3.5.py
COLAMAroro/WikiBot
WikiBot3.5.py
WikiBot3.5.py
import discord import wikipedia token = "Mjg3NjU2MjM1MjU0NDE1MzYx.C-5xKQ.khJ9dPouM9783FMA0Ht-92XkS6A" language = "en" client = discord.Client() @client.event async def on_ready(): print("Bot is ready") print(client.user.name) print(client.user.id) @client.event async def on_server_join(server): a...
bsd-3-clause
Python
3ef6866b39601dfafa10895a69c5d348a77ded3e
add test for eject and eject_all
missionpinball/mpf,missionpinball/mpf
mpf/tests/test_BallDevice_SmartVirtual.py
mpf/tests/test_BallDevice_SmartVirtual.py
from mpf.tests.MpfTestCase import MpfTestCase class TestBallDeviceSmartVirtual(MpfTestCase): def getConfigFile(self): return 'test_ball_device.yaml' def getMachinePath(self): return 'tests/machine_files/ball_device/' def get_platform(self): return 'smart_virtual' def test_ej...
mit
Python
104fcfc4eed7f3233d329602283093c7f86484c3
add development server
rollandf/codeandtalk.com,szabgab/codeandtalk.com,szabgab/codeandtalk.com,szabgab/codeandtalk.com,rollandf/codeandtalk.com,mhorvvitz/codeandtalk.com,szabgab/codeandtalk.com,mhorvvitz/codeandtalk.com,shaylavi/codeandtalk.com,mhorvvitz/codeandtalk.com,rollandf/codeandtalk.com,rollandf/codeandtalk.com,shaylavi/codeandtalk....
server.py
server.py
from http.server import HTTPServer, BaseHTTPRequestHandler class StaticServer(BaseHTTPRequestHandler): def do_GET(self): root = 'html' #print(self.path) if self.path == '/': filename = root + '/index.html' else: filename = root + self.path self.send...
apache-2.0
Python
e88ba0984f3e6045b407342fa7231887142380e2
Add migration to create roles
dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq
corehq/apps/accounting/migrations/0031_create_report_builder_roles.py
corehq/apps/accounting/migrations/0031_create_report_builder_roles.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from corehq.apps.hqadmin.management.commands.cchq_prbac_bootstrap import cchq_prbac_bootstrap from corehq.sql_db.operations import HqRunPython class Migration(migrations.Migration): dependencies = [ (...
bsd-3-clause
Python
df34c1a07fa6029efbd4df41cbd2009ac5031aca
Create matrixAlg.py
ghevcoul/matrixAlg
matrixAlg.py
matrixAlg.py
#!/usr/bin/python ##################################### # Written by Gavin Heverly-Coulson # Email: gavin <at> quantumgeranium.com ##################################### # A set of matrix algebra functions for performing # basic matrix algebra operations. # # Tested with Python 2.6/2.7 # # This work is licensed under a...
bsd-2-clause
Python
7b7ec9cdd1f0ed213608a5c309702e49e44b36e2
Add simple test.
tsotetsi/django-seed
tests/integration/test_smoke.py
tests/integration/test_smoke.py
from django.test import TestCase URLS_PUBLIC = [ "/", ] class SimpleTests(TestCase): def test_urls(self): for url in URLS_PUBLIC: res = self.client.get(url) self.assertEqual(res.status_code, 200)
mit
Python
c44001ec697faf7552764f91e52fa927056b1538
Add solution for porblem 31
cifvts/PyEuler
euler031.py
euler031.py
#!/usr/bin/python LIMIT = 200 coins = [1, 2, 5, 10, 20, 50, 100, 200] def rec_count(total, step): if total == LIMIT: return 1 if total > LIMIT: return 0 c = 0 for x in coins: if x < step: continue c += rec_count(total + x, x) return c count = 0 for x i...
mit
Python
84c5bfa0252814c5797cf7f20b04808dafa9e1fa
Create MergeIntervals_001.py
Chasego/cod,Chasego/codi,Chasego/codirit,cc13ny/algo,Chasego/codirit,Chasego/codi,Chasego/cod,cc13ny/algo,Chasego/codi,cc13ny/Allin,Chasego/codirit,Chasego/codirit,cc13ny/Allin,cc13ny/Allin,cc13ny/Allin,cc13ny/Allin,cc13ny/algo,Chasego/codi,cc13ny/algo,Chasego/cod,cc13ny/algo,Chasego/cod,Chasego/cod,Chasego/codi,Chaseg...
leetcode/056-Merge-Intervals/MergeIntervals_001.py
leetcode/056-Merge-Intervals/MergeIntervals_001.py
# Definition for an interval. # class Interval: # def __init__(self, s=0, e=0): # self.start = s # self.end = e class Solution: # @param {Interval[]} intervals # @return {Interval[]} def sortmeg(self, intervals): ls = [] for i in intervals: ls.append(i.s...
mit
Python
8471516294d5b28a81cae73db591ae712f44bc01
Add failing cairo test
lazka/pgi,lazka/pgi
tests/pygobject/test_structs.py
tests/pygobject/test_structs.py
# Copyright 2013 Christoph Reiter # # 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 License, or (at your option) any later version. import unittest from gi.r...
lgpl-2.1
Python
c46e6d170f4d641c3bb5045a701c7810d77f28a6
add update-version script
trustathsh/ifmapcli,trustathsh/ifmapcli
update-version.py
update-version.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import os import xml.etree.ElementTree as et NS = "http://maven.apache.org/POM/4.0.0" POM_NS = "{http://maven.apache.org/POM/4.0.0}" def getModuleNames(mainPom): pom = et.parse(mainPom) modules = pom.findall("./{ns}modules/{ns}module".format(ns=...
apache-2.0
Python
0bc4d105bd649ed9e174b26b5017572f08fd5c2f
Write unit tests for physics library
cnlohr/bridgesim,cnlohr/bridgesim,cnlohr/bridgesim,cnlohr/bridgesim
src/server/test_physics.py
src/server/test_physics.py
#!/usr/bin/env python import unittest from physics import * class TestNVectors(unittest.TestCase): def setUp(self): self.v11 = NVector(1, 1) self.v34 = NVector(3, 4) self.v10 = NVector(10, 0) self.vneg = NVector(-2, -2) def test_dimensionality(self): """Test counting of number of dimension...
mit
Python
b9cf46407eea6df9bb3fef5eb3103c7353b249a9
solve problem 11
edpark13/euler
problem11.py
problem11.py
def largest_grid_product(grid): max = float("-inf") for i in xrange(0, len(grid)): for j in xrange(0, len(grid[i]) - 3): productx = grid[i][j] * grid[i][j+1] * grid[i][j+2] * grid[i][j+3] producty = grid[j][i] * grid[j+1][i] * grid[j+2][i] * grid[j+3][i] if productx > max: max = produc...
mit
Python
1d3719bcd03b92d04efae10933928f953d95c7a4
Add a simple basicmap python example
SunGuo/learning-spark,asarraf/learning-spark,SunGuo/learning-spark,jaehyuk/learning-spark,asarraf/learning-spark,negokaz/learning-spark,kod3r/learning-spark,diogoaurelio/learning-spark,databricks/learning-spark,zaxliu/learning-spark,JerryTseng/learning-spark,anjuncc/learning-spark-examples,gaoxuesong/learning-spark,hui...
src/python/BasicMap.py
src/python/BasicMap.py
""" >>> from pyspark.context import SparkContext >>> sc = SparkContext('local', 'test') >>> b = sc.parallelize([1, 2, 3, 4]) >>> sorted(basicSquare(b).collect()) [1, 4, 9, 12] """ import sys from pyspark import SparkContext def basicSquare(nums): """Square the numbers""" return nums.map(lambda x: x * x) if ...
mit
Python
41220718d0e9a32fc9e95d55acdb989b2f87563f
Add @job tasks
RyanBalfanz/django-smsish
smsish/tasks.py
smsish/tasks.py
import django_rq from rq.decorators import job DEFAULT_QUEUE_NAME = "default" DEFAULT_REDIS_CONNECTION = django_rq.get_connection() @job(DEFAULT_QUEUE_NAME, connection=DEFAULT_REDIS_CONNECTION) def send_sms(*args, **kwargs): from smsish.sms import send_sms as _send_sms return _send_sms(*args, **kwargs) @job(DEFA...
mit
Python
6ee145c7af7084f228ee48754ef2a0bfc37c5946
Add missing hooks.py module
ColinDuquesnoy/pyqt_distutils
pyqt_distutils/hooks.py
pyqt_distutils/hooks.py
""" A pyqt-distutils hook is a python function that is called after the compilation of a ui script to let you customise its content. E.g. you might want to write a hook to change the translate function used or replace the PyQt imports by your owns if you're using a shim,... The hook function is a simple python functio...
mit
Python
ff79343cb1feda5259244199b4f0d503da401f24
Create quick_sort_iterativo.py
jeffmorais/estrutura-de-dados
quick_sort_iterativo.py
quick_sort_iterativo.py
import unittest def _quick_recursivo(seq, inicio, final): if inicio >= final: return seq indice_pivot = final pivot = seq[indice_pivot] i_esquerda = inicio i_direita = final - 1 while i_esquerda<=i_direita: while i_esquerda<=i_direita and seq[i_esquerda]<=pivot: i_...
mit
Python
8543b2bf12c25163be62a8d44b48d32396f3ac9b
Add source.
ADEHJKNTV/GraphingSolver
solver.py
solver.py
#!usr/bin/env python3 import sys, time from tkinter import messagebox, Tk game_w, game_h = 50, 30 # total width and height of the game board in game coordinates formula_mode = "axis" from pymouse import PyMouse, PyMouseEvent from pykeyboard import PyKeyboard, PyKeyboardEvent m = PyMouse() k = PyKeyboard() class Poin...
mit
Python
4324eaf427731db3943cf130e42e29509bdbd4df
Fix for Python 3
pv/asv,qwhelan/asv,mdboom/asv,giltis/asv,airspeed-velocity/asv,spacetelescope/asv,pv/asv,airspeed-velocity/asv,qwhelan/asv,giltis/asv,airspeed-velocity/asv,ericdill/asv,mdboom/asv,pv/asv,edisongustavo/asv,spacetelescope/asv,edisongustavo/asv,pv/asv,cpcloud/asv,spacetelescope/asv,waylonflinn/asv,airspeed-velocity/asv,wa...
asv/config.py
asv/config.py
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import os import sys from . import util class Config(object): """ Manages the configuration for a benchmark pr...
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import os import sys from . import util class Config(object): """ Manages the configuration for a benchmark pr...
bsd-3-clause
Python
0eb579b00c7e42813d45aa841df3f42607db0a7e
add thermoengineTest
pierrelb/RMG-Py,pierrelb/RMG-Py
rmgpy/thermo/thermoengineTest.py
rmgpy/thermo/thermoengineTest.py
#!/usr/bin/env python # encoding: utf-8 -*- """ This module contains unit tests of the rmgpy.parallel module. """ import os import sys import unittest import random from external.wip import work_in_progress from rmgpy import settings from rmgpy.data.rmg import RMGDatabase from rmgpy.rmg.main import RMG from rmgpy.sc...
mit
Python
6a47c684012b98679c9274ca4087958c725a1fa7
support extensions in tests
evansde77/dockerstache,evansde77/dockerstache,evansde77/dockerstache
test/unit/dockerstache_tests.py
test/unit/dockerstache_tests.py
#!/usr/bin/env python """ dockerstache module test coverage for API calls """ import os import tempfile import json import unittest import mock from dockerstache.dockerstache import run class RunAPITests(unittest.TestCase): """tests for run API call""" def setUp(self): self.tempdir = tempfile.mkdtem...
apache-2.0
Python
3618ce5749517c7757a04f0c08a74275e8e82b69
Create fasttext.py
botlabio/autonomio,botlabio/autonomio
fasttext.py
fasttext.py
from __future__ import print_function import numpy as np from keras.preprocessing import sequence from keras.models import Sequential from keras.layers import Dense from keras.layers import Embedding from keras.layers import GlobalAveragePooling1D from keras.datasets import imdb class FastText: ''' Takes...
mit
Python
d23b83f8052f1ca5a988b05c3893b884eb3be6cc
Add link.py
dustalov/watset,dustalov/watset
misc/link.py
misc/link.py
#!/usr/bin/env python from signal import signal, SIGPIPE, SIG_DFL signal(SIGPIPE, SIG_DFL) import argparse import csv import sys import itertools from collections import defaultdict, Counter from math import log from sklearn.feature_extraction import DictVectorizer from sklearn.metrics.pairwise import cosine_similari...
mit
Python
7655e376696a04aa1c3596274861515953f592e8
Add profiling script for savings code
ebmdatalab/openprescribing,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc
openprescribing/frontend/price_per_unit/profile.py
openprescribing/frontend/price_per_unit/profile.py
""" Basic profiling code for working out where we're spending our time Invoke with: ./manage.py shell -c 'from frontend.price_per_unit.profile import profile; profile()' """ from cProfile import Profile import datetime import time from .savings import get_all_savings_for_orgs def test(): get_all_savings_for_org...
mit
Python
40caa4c9b720388207e338ffde3cd7f2d85cdf0d
add a single script to perform formatting of base log files
aliclark/irctail,aliclark/irctail
base-format.py
base-format.py
#!/usr/bin/python from __future__ import print_function import sys import re import datetime import ircformatlib as il timeformat_format = '%H:%M:%S' timeformat_formatlen = 8 timeformat_filler = ' ' * timeformat_formatlen def timeformat(time): try: x = int(time) dt = datetime.datetime.from...
isc
Python
2766e8797515497e5569b31696416db68641c9b4
Extend MediaRemovalMixin to move media files on updates
matus-stehlik/roots,rtrembecky/roots,matus-stehlik/glowing-batman,tbabej/roots,rtrembecky/roots,rtrembecky/roots,matus-stehlik/roots,matus-stehlik/roots,tbabej/roots,matus-stehlik/glowing-batman,tbabej/roots
base/models.py
base/models.py
import os from django.conf import settings class MediaRemovalMixin(object): """ Removes all files associated with the model, as returned by the get_media_files() method. """ # Models that use this mixin need to override this method def get_media_files(self): return def delete(se...
import os from django.conf import settings class MediaRemovalMixin(object): """ Removes all files associated with the model, as returned by the get_media_files() method. """ # Models that use this mixin need to override this method def get_media_files(self): return def delete(se...
mit
Python
24c642063ffcb3313545b2e1ba3abbb62aa98437
Add cuit validator to utils module
coyotevz/nobix-app
nbs/utils/validators.py
nbs/utils/validators.py
# -*- coding: utf-8-*- def validate_cuit(cuit): "from: http://python.org.ar/pyar/Recetario/ValidarCuit by Mariano Reingart" # validaciones minimas if len(cuit) != 13 or cuit[2] != "-" or cuit [11] != "-": return False base = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2] cuit = cuit.replace("-", "") ...
mit
Python
7274f9286bd267970c286954e9d21e601af30cb7
Create messenger.py
wanglei6111/-Python-
messenger.py
messenger.py
# -*- coding: utf-8 -*- import requests apiurl = '你的地址' apiheaders = {'U-ApiKey': '你的key'} code="动态码" response = requests.get(apiurl, params={"media_id":'gh_3fc78df4c9d2',"auth_code":code, "scene":1,"device_no":1,"location":'jia'}) json = response.json() print(json)
apache-2.0
Python
620ad7f4dc5ed9403f468f592b99a22a92d22072
make python -m i3configger work
obestwalter/i3configger
i3configger/__main__.py
i3configger/__main__.py
import i3configger.main if __name__ == "__main__": i3configger.main.main()
mit
Python
ad2178a8973ce2de55611321c0b7b57b1488fc6b
move utilities in a private module
masci/django-appengine-toolkit,masci/django-appengine-toolkit,masci/django-appengine-toolkit
appengine_toolkit/management/commands/_utils.py
appengine_toolkit/management/commands/_utils.py
import pkg_resources import os class RequirementNotFoundError(Exception): pass def collect_dependency_paths(package_name): """ TODO docstrings """ deps = [] try: dist = pkg_resources.get_distribution(package_name) except ValueError: message = "Distribution '{}' not found....
bsd-3-clause
Python
79b99968d7c9e728efe05f8c962bdda5c9d56559
Add LDAP authentication plugin
ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo
web/utils/auth.py
web/utils/auth.py
# http://www.djangosnippets.org/snippets/501/ from django.contrib.auth.models import User from django.conf import settings import ldap class ActiveDirectoryBackend: supports_object_permissions = False supports_anonymous_user = False supports_inactive_user = False def authenticate(self, username=None...
agpl-3.0
Python
6f8460b10827a9877fd0c3f0d45a01e7b2d42014
Create ios.py
wizardofozzie/pybitcointools
bitcoin/ios.py
bitcoin/ios.py
import ecdsa import binascii import hashlib import struct from bitcoin.main import * from bitcoin.pyspecials import * # https://gist.github.com/b22e178cff75c4b432a8 # Returns byte string value, not hex string def varint(n): if n < 0xfd: return struct.pack('<B', n) elif n < 0xffff: return struc...
mit
Python