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
3492ffd5ffa0c7d1dfb5a9f4a587777245044685
add test cases of ruamel.yaml backend
ssato/python-anyconfig,ssato/python-anyconfig
tests/backend/yaml/ruamel_yaml.py
tests/backend/yaml/ruamel_yaml.py
# # Copyright (C) - 2018 Satoru SATOH <ssato @ redhat.com> # License: MIT # # pylint: disable=missing-docstring,invalid-name,too-few-public-methods # pylint: disable=ungrouped-imports from __future__ import absolute_import import os import anyconfig.backend.yaml.pyyaml as TT import tests.backend.common as TBC from an...
mit
Python
d4f3f65a9c6dbe4a7119eb65f872524a45f756a7
Add codifflib.py
nzre/codifflib
codifflib.py
codifflib.py
import sys from difflib import SequenceMatcher from pygments import lex from pygments.lexers.c_cpp import CLexer from pygments.styles import get_style_by_name class CodeDiff: opcode_style = { 'insert': {'bgcolor': 'eaffea'}, 'replace': {'bgcolor': 'fff68f'}, 'delete': {'bgcolor': 'ffaaaa'}, 'equal': {'bgco...
mit
Python
3f9a8ee16e47f4ce0d75a1b856341c05436c2aff
Create sending_email.py
wliu2016/sending_email
sending_email.py
sending_email.py
# -*- coding: utf-8 -*- """ Created on Wed May 10 16:32:22 2017 This scripts are used to send out data from Pasture to Wenlong from field. Key features: - Parse and send out all .par files - Send out email at certain intervals: such as one day. @author: wliu14 """ from email import encoders from email.mime.text impor...
apache-2.0
Python
03f46b0d6867bcb8a88e53b26089705cb1667bbd
Add script to generate images from all samples
megacool/teetime
tools/create_from_sample_texts.py
tools/create_from_sample_texts.py
#!/usr/bin/env python import teetime import os def main(): with open('samples/sample-texts.txt') as fh: for line in fh: print line.strip() path = teetime.create_typography(line.strip(), colors=False) os.rename(path, os.path.join('samples', os.path.basename(path))) if...
mit
Python
08c0c68ed52e9644cc92ad8afdc423b43b4c1326
Add Fractal_Tree.py.
mcsoo/Exercises
Fractal_Tree.py
Fractal_Tree.py
__author__ = "ClaytonBat" import turtle def tree(branchLen,t): if branchLen > 5: t.forward(branchLen) t.right(20) tree(branchLen-15,t) t.left(40) tree(branchLen-15,t) t.right(20) t.backward(branchLen) def main(): t = turtle.Turtle() myWin = turtle.Sc...
mit
Python
1893473729acd938a0657127b82892af1bdb987b
Create AbortMultipartUploads.py
OpenTelekomCloud/docs
obs/cleanUnmergedFragments/AbortMultipartUploads.py
obs/cleanUnmergedFragments/AbortMultipartUploads.py
#!/usr/bin/python # -*- coding: UTF-8 -*- import sys import commands if __name__ == '__main__': if len(sys.argv[1:]) > 0: bucket_nameurl = str(sys.argv[1:][0]) else: bucket_nameurl = "" print("bucket name should be specified\nAbortMultipartUploads.py [s3://BucketName]") sys.exit...
apache-2.0
Python
6dca2d95144ebe22f58cb4dafb00a3f8a402316e
add answer for question 4
pythonzhichan/DailyQuestion,pythonzhichan/DailyQuestion
question_4/heguilong.py
question_4/heguilong.py
#!/usr/bin/env python3 """ File: heguilong.py Author: heguilong Email: hgleagle@gmail.com Github: https://github.com/hgleagle Description: 斐波那契数列由0和1开始,之后的斐波那契系数就是由之前的两数相加而得出,例如 斐波那契数列的前10个数是 0, 1, 1, 2, 3, 5, 8, 13, 21, 34。 """ import sys import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)...
mit
Python
a50ce7117e4c1300410b74b5511722e4d7d57be4
Implement script to automate setting scope location and time
bgottula/track,bgottula/track
set_when_and_where.py
set_when_and_where.py
#!/usr/bin/env python import config import configargparse import math import time import nexstar import ephem parser = configargparse.ArgParser(default_config_files=config.DEFAULT_FILES) parser.add_argument('--scope', help='serial device for connection to telescope', default='/dev/ttyUSB0') parser.add_argument('--lat...
mit
Python
1212677ac1087498fa83a3d4d9e8ba9d13c35b20
Add the basic structure for the notification handler.
yiyangyi/cc98-tornado
handler/notification.py
handler/notification.py
class ListHandler(BaseHandler):
mit
Python
7225514cd2e4acb3bf78d6ba1c221caf9c084490
Add plotting script for correction files
GeoscienceAustralia/PyRate,GeoscienceAustralia/PyRate
utils/plot_correction_files.py
utils/plot_correction_files.py
import numpy as np from matplotlib import pyplot as plt import glob import re import math import rasterio as rio import argparse import os """ This script plots the original interferogram, the corresponding correction file, and the resulting corrected interferogram from a PyRate directory with already, processed data...
apache-2.0
Python
77fc04ddf6dbc9cb618b427b36628adb019b2f43
add import script
sassoftware/mirrorball,sassoftware/mirrorball
scripts/import.py
scripts/import.py
#!/usr/bin/python # # Copyright (c) 2008 rPath, Inc. # # This program is distributed under the terms of the Common Public License, # version 1.0. A copy of this license should have been distributed with this # source file in a file called LICENSE. If it is not present, the license # is always available at http://www.rp...
apache-2.0
Python
42a9c36d711f2550cc68fdba96b6af36d3d31d8d
Create grasshopperDebug.py
NendoTaka/CodeForReference,NendoTaka/CodeForReference,NendoTaka/CodeForReference
CodeWars/8kyu/grasshopperDebug.py
CodeWars/8kyu/grasshopperDebug.py
def weather_info (temp): c = convertToCelsius(temp) if (c <= 0): return (str(c) + " is freezing temperature") else: return (str(c) + " is above freezing temperature") def convertToCelsius (temp): temp = (((float(temp) - 32) * 5) / 9) return temp
mit
Python
9ba0ff62572dcfd7912c9b58091b59844f8e1753
Add script for Helmholtz rates
thomasgibson/tabula-rasa
results/sccg-table.py
results/sccg-table.py
import os import sys import pandas as pd p4_data = "helmholtz-results/helmholtz_conv-d-4.csv" p5_data = "helmholtz-results/helmholtz_conv-d-5.csv" p6_data = "helmholtz-results/helmholtz_conv-d-6.csv" p7_data = "helmholtz-results/helmholtz_conv-d-7.csv" data_set = [p4_data, p5_data, p6_data, p7_data] for data in data...
mit
Python
248c738b31e43ef456d47045bc5f5b2d58d35d98
add autocomplete with a German-Korean dictionary
Kuniz/alfnaversearch,Kuniz/alfnaversearch
workflow/dedic_naver_search.py
workflow/dedic_naver_search.py
# Naver Search Workflow for Alfred 2 # Copyright (C) 2013 Jinuk Baek # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later versi...
mit
Python
4137bdd36fa4a1b4e194c2c61f803cecdebe8f69
Implement MySQL driver
romuloceccon/logviewer,romuloceccon/logviewer
lib/mysql_driver.py
lib/mysql_driver.py
import mysql.connector import sql_driver import screen_buffer class MySQLDriver(sql_driver.SqlDriver): class Factory(object): def __init__(self, **mysql_conf): self._mysql_conf = mysql_conf if 'port' in self._mysql_conf: self._mysql_conf['port'] = int(self._mysql_co...
mit
Python
6a29e9f963af4920b21c64d157ca90b0d7d081c4
implement parallelForLoop.py
xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples,xmementoit/practiseSamples
pythonPractiseSamples/parallelForLoop.py
pythonPractiseSamples/parallelForLoop.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2017 Damian Ziobro <damian@xmementoit.com> # from joblib import Parallel, delayed import multiprocessing n=1000000 def squareRoot(i): return i*i cpus = multiprocessing.cpu_count() #cpus = 1 results = Parallel(n_jobs=cpus)(delayed(s...
apache-2.0
Python
b9711e4fd82441669fdd97b1e5eeb12f03e995a5
Make srrun use the proper executable on windows
mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge
srrun.py
srrun.py
#!/usr/bin/env python # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. import copy import os import platform import subprocess import sys mypath = os.path.abspath(__fil...
#!/usr/bin/env python # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at http://mozilla.org/MPL/2.0/. import copy import os import subprocess import sys mypath = os.path.abspath(__file__) mydir = os....
mpl-2.0
Python
5d1da267791456f6c5e386d6e7204d02371c2eb2
Add tests for gold projects
emawind84/readthedocs.org,kenshinthebattosai/readthedocs.org,Tazer/readthedocs.org,SteveViss/readthedocs.org,atsuyim/readthedocs.org,clarkperkins/readthedocs.org,safwanrahman/readthedocs.org,kenwang76/readthedocs.org,SteveViss/readthedocs.org,sunnyzwh/readthedocs.org,mhils/readthedocs.org,attakei/readthedocs-oauth,rtfd...
readthedocs/rtd_tests/tests/test_gold.py
readthedocs/rtd_tests/tests/test_gold.py
from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.test import TestCase from django_dynamic_fixture import get from django_dynamic_fixture import new from readthedocs.gold.models import GoldUser, LEVEL_CHOICES from readthedocs.projects.models import Project def crea...
mit
Python
680ab5562e2b4599c74b9605b688538c1da1479d
add profiler helper function
nikken1/patentprocessor,yngcan/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor,yngcan/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor,yngcan/patentprocessor,funginstitute/patentprocessor
lib/util/profile.py
lib/util/profile.py
import cProfile def profile_this(fn): def profiled_fn(*args, **kwargs): fpath = fn.__name__ + '.profile' prof = cProfile.Profile() ret = prof.runcall(fn, *args, **kwargs) prof.dump_stats(fpath) return ret return profiled_fn # Just use the following decorator to get a ps...
bsd-2-clause
Python
73479f2efe46623f40ea4a49edfc79de0725a291
Create cdbhelp.py
ChristinaHammer/Client_Database
cdbhelp.py
cdbhelp.py
"""cdbhelp.py This file will define a window which displays help information. """ from tkinter import * from tkinter import ttk class cdbHelp: def __init__(self, tag): self.bgcolor = 'lavender' self.helpwin = Tk() #self.frame=Frame(self.helpwin).grid() self.helpw...
mit
Python
426afb06904b2e4ebab380b6d5ea79c2f481cb44
add text encoder
ethereum/pyrlp,ethereum/pyrlp
rlp/sedes/text.py
rlp/sedes/text.py
from rlp.exceptions import SerializationError, DeserializationError from rlp.atomic import Atomic class Text: """A sedes object for encoded text data of certain length. :param min_length: the minimal length in encoded characters or `None` for no lower limit :param max_length: the maximal length in encode...
mit
Python
c83e946a2b5205c7246b1cfbde7b6e84759b3876
add potentiometer script
zpiman/golemScripts
potentiometer.py
potentiometer.py
#from pydcpf.appliances.quido import Device as QuidoDevice #from pydcpf.appliances.ad4xxx_drak4 import Device as AD4Device #from pydcpf.appliances.evr116 import Device as EVRDevice #from pydcpf.appliances.AC250Kxxx import Device as AC250KDevice TELNET = "telnet 192.168.2.243 10001" time_delay = 0.2 time_step = 0.001 ...
mit
Python
afa810d9b80a5a304395c588455fe421a4a02129
Add a simple script which monitors the paused domains on a host, checks them against the xapi database, logs anomalies, and optionally destroys the domain if it has been in an error state for longer than a threshold (currently 60s)
ravippandey/xen-api,koushikcgit/xen-api,cheng-z/xen-api,cheng--zhang/xen-api,djs55/xen-api,cheng-z/xen-api,ravippandey/xen-api,cheng--zhang/xen-api,jjd27/xen-api,jjd27/xen-api,simonjbeaumont/xen-api,cheng-z/xen-api,cheng-z/xen-api,thomassa/xen-api,salvocambria/xen-api,anoobs/xen-api,agimofcarmen/xen-api,cheng--zhang/xe...
scripts/examples/python/monitor-unwanted-domains.py
scripts/examples/python/monitor-unwanted-domains.py
#!/usr/bin/env python import subprocess, XenAPI, inventory, time, sys # Script which monitors the domains running on a host, looks for # paused domains which don't correspond to VMs which are running here # or are about to run here, logs them and optionally destroys them. # Return a list of (domid, uuid) tuples, one...
lgpl-2.1
Python
eb3510933b356c5b97e7a0cce9ebad563f21bf3c
Create BinTreeInTraversal_002.py
Chasego/cod,cc13ny/algo,Chasego/cod,Chasego/codi,cc13ny/Allin,Chasego/codirit,cc13ny/Allin,Chasego/codirit,Chasego/codi,Chasego/cod,Chasego/codi,cc13ny/Allin,Chasego/codirit,Chasego/codirit,cc13ny/algo,Chasego/codirit,Chasego/cod,Chasego/codi,cc13ny/algo,cc13ny/Allin,Chasego/cod,cc13ny/algo,cc13ny/Allin,cc13ny/algo,Cha...
leetcode/094-Binary-Tree-Inorder-Traversal/BinTreeInTraversal_002.py
leetcode/094-Binary-Tree-Inorder-Traversal/BinTreeInTraversal_002.py
class Solution: # @param root, a tree node # @return a list of integers def iterative_inorder(self, root, list): stack = [] while root or stack: if root: stack.append(root) root = root.left else: root = stack.pop() ...
mit
Python
7ac77a2f95bebad6a13e1d538c366c8688c9d0a6
Create __init__.py
thegreathippo/crispy
crispy/localevents/__init__.py
crispy/localevents/__init__.py
import core
mit
Python
aafdd253bc818d605023dd2a22164d2ac3cdc911
Add first draft of outdoor map (for issue #3)
BHSPitMonkey/vmflib
examples/outdoor.py
examples/outdoor.py
#!/usr/bin/python """Example map generator: Outdoor This script demonstrates vmflib by generating a map with a 2D skybox and some terrain (a displacement map). """ from vmf import * from vmf.types import Vertex from vmf.tools import Block m = vmf.ValveMap() walls = [] # Floor floor = Block(Vertex(0, 0, -512), (102...
bsd-2-clause
Python
268eb8d8591a529c0ee67e6f37b287956b39eb1b
Copy kafka-patch-review.py from kafka trunk
evvers/kafka-dev-tools
kafka-patch-review.py
kafka-patch-review.py
#!/usr/bin/env python import argparse import sys import os import time import datetime import tempfile import commands from jira.client import JIRA def get_jira(): options = { 'server': 'https://issues.apache.org/jira' } # read the config file home=jira_home=os.getenv('HOME') home=home.rstrip('/') jir...
apache-2.0
Python
1c228a8de02c81df8d22bde75ac22b902ee39c77
Add oedb connection helper
openego/data_processing
data_processing/tools/io.py
data_processing/tools/io.py
from sqlalchemy import create_engine def oedb_session(section='oedb'): """Get SQLAlchemy session object with valid connection to OEDB""" # get session object by oemof.db tools (requires .oemof/config.ini try: from oemofof import db conn = db.connection(section=section) except: ...
agpl-3.0
Python
f7742c3ffcd86667e86e7cb80977f24eddc5444c
add wrapper for `gr1x` that circumvents entry point
johnyf/gr1experiments
examples/wrapper.py
examples/wrapper.py
#!/usr/bin/env python """Wrapper to circumvent the entry point. Because, if development versions of dependencies are installed, but `install_requires` contains no local identifiers, then the entry point raises a `VersionConflict` for its context. """ import sys from tugs import solver if __name__ == '__main__': ...
bsd-3-clause
Python
00c8c165e3f9a136a8950ca1fb0f2d9ade6731d6
Add a regression test for whitespace normalization in the BibTeX parser.
chbrown/pybtex,andreas-h/pybtex,andreas-h/pybtex,chbrown/pybtex
pybtex/tests/bibtex_parser_test.py
pybtex/tests/bibtex_parser_test.py
from pybtex.database import BibliographyData from pybtex.core import Entry from pybtex.database.input.bibtex import Parser from cStringIO import StringIO test_data = [ ( ''' ''', BibliographyData(), ), ( '''@ARTICLE{ test, title={Polluted ...
mit
Python
337928d30d96146cb8033e3ccb15d7d6d0c85d5a
add managed_layer_test
google/neuroglancer,google/neuroglancer,google/neuroglancer,janelia-flyem/neuroglancer,google/neuroglancer,google/neuroglancer,janelia-flyem/neuroglancer,google/neuroglancer,janelia-flyem/neuroglancer,janelia-flyem/neuroglancer,google/neuroglancer,google/neuroglancer,janelia-flyem/neuroglancer
python/tests/managed_layer_test.py
python/tests/managed_layer_test.py
import neuroglancer def test_visible(): layer = neuroglancer.ManagedLayer('a', {'type': 'segmentation', 'visible': False}) assert layer.name == 'a' assert layer.visible == False assert layer.to_json() == {'name': 'a', 'type': 'segmentation', 'visible': False} layer.visible = True assert layer.t...
apache-2.0
Python
38903c6b6e4dec9fd2fe73b0c468a8b3f2ab870a
Add multi np array
jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm
python_practice/numpy_exercise2.py
python_practice/numpy_exercise2.py
import numpy as np Matrix_A = np.array( [[1,1],[0,1]] ) Matrix_B = np.array( [[2,0],[3,4]] ) print Matrix_A*Matrix_B print Matrix_A.dot(Matrix_B) print np.dot(Matrix_A, Matrix_B)
mit
Python
46393dca28abe0df421066e76b26f198ad790690
Create NimGame_001.py
cc13ny/algo,Chasego/codirit,Chasego/codi,Chasego/cod,Chasego/codirit,Chasego/codirit,Chasego/codirit,Chasego/codi,Chasego/codi,cc13ny/algo,Chasego/cod,Chasego/cod,Chasego/cod,Chasego/codirit,cc13ny/Allin,cc13ny/algo,cc13ny/Allin,Chasego/codi,cc13ny/Allin,Chasego/codi,cc13ny/algo,cc13ny/Allin,Chasego/cod,cc13ny/algo,cc1...
leetcode/NimGame_001.py
leetcode/NimGame_001.py
class Solution(object): def canWinNim(self, n): """ :type n: int :rtype: bool """ return not (n % 4 == 0)
mit
Python
0aa078c8beb6bad3dd0f30463f2925f01282e353
add merge script
tobiasrausch/alfred,tobiasrausch/alfred,tobiasrausch/alfred,tobiasrausch/alfred,tobiasrausch/alfred,tobiasrausch/alfred
scripts/merge.py
scripts/merge.py
#! /usr/bin/env python import gzip import json import sys ret = { "samples": [] } def opn(fn): if fn.endswith('.gz'): return gzip.open(fn) return open(fn) for file_name in sys.argv[1:]: with opn(file_name) as f: file_content = json.load(f) ret["samples"].extend(file_content["samples"]) print(json...
bsd-3-clause
Python
9a045ac0c5cfe39689d8e1446674193e8862d269
add IPLookup
Naught0/qtbot
cogs/ip.py
cogs/ip.py
#!/bin/env python import discord from discord.ext import commands from utils import aiohttp_wrap as aw class IPLookup: def __init__(self, bot): self.bot = bot self.aio_session = bot.aio_session self.api_uri = 'http://ip-api.com/json/{}' @commands.command(aliases=['ip']) async def ...
mit
Python
2d53172748f1dc7c8462fa79a6a158e4689b2363
Add ThermalDisplacements test
atztogo/phonopy,atztogo/phonopy,atztogo/phonopy,atztogo/phonopy
test/phonon/test_thermal_displacement.py
test/phonon/test_thermal_displacement.py
import numpy as np temps = [0.000000, 100.000000, 200.000000, 300.000000, 400.000000, 500.000000, 600.000000, 700.000000, 800.000000, 900.000000] td_ref = [ [0.00571624, 0.00571624, 0.00571624, 0.00403776, 0.00403776, 0.00403776], [0.00877353, 0.00877353, 0.00877353, 0.00654962, 0.00654962, 0.00654962...
bsd-3-clause
Python
314fcab1904cd0c5e434789bef09766d33e2d6ef
add synth.py for generation
googleapis/google-cloud-node,googleapis/google-cloud-node,googleapis/google-cloud-node,googleapis/google-cloud-node
packages/google-cloud-asset/synth.py
packages/google-cloud-asset/synth.py
# copyright 2018 google LLC # # licensed under the apache license, version 2.0 (the "license"); # you may not use this file except in compliance with the license. # you may obtain a copy of the license at # # http://www.apache.org/licenses/license-2.0 # # unless required by applicable law or agreed to in writing, s...
apache-2.0
Python
37f7ab9435939a144b08fdbb52e1e519ad139318
add some field definitions
chronossc/django-ldapdb,UGentPortaal/django-ldapdb-archived,UGentPortaal/django-ldapdb
ldapdb/models/fields.py
ldapdb/models/fields.py
# -*- coding: utf-8 -*- # # django-ldapdb # Copyright (C) 2009 Bolloré telecom # See AUTHORS file for a full list of contributors. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either vers...
bsd-2-clause
Python
24dbbd880142ed0925c30083cd3926b47c7ba90c
add mobilenet
analysiscenter/dataset
dataset/models/tf/mobilenet.py
dataset/models/tf/mobilenet.py
''' Contains class for MobileNet ''' import numpy as np import tensorflow as tf from . import TFModel from .layers import conv_block _DEFAULT_BODY = {'strides': [1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 2], 'double_filters': [True, True, False, T...
apache-2.0
Python
c4e83d80a9600b9059619c73bc5756ce7b2a1d6d
add extract images module
nontas/menpo3d,grigorisg9gr/menpo3d,grigorisg9gr/menpo3d,nontas/menpo3d
menpo3d/extractimage.py
menpo3d/extractimage.py
import numpy as np from menpo3d.rasterize import GLRasterizer, model_to_clip_transform from menpo.shape import PointCloud def render_hi_res_shape_image(mesh, render_width=3000): h, w = mesh.range()[:2] aspect_ratio = w / h height = render_width * aspect_ratio r = GLRasterizer( projection_matr...
bsd-3-clause
Python
c5fd2a7bccb45325acdf7f0800843ddb9ad82b64
split Natura2000 pdf files
eaudeweb/natura2000db,eaudeweb/natura2000db,eaudeweb/natura2000db,eaudeweb/natura2000db
migrations/split_pdf.py
migrations/split_pdf.py
#use http://pybrary.net/pyPdf/ from pyPdf import PdfFileWriter, PdfFileReader import re pattern = re.compile(r"RO(SCI|SPA)\d{4}") source_path = "/Users/cornel/Downloads/2011-10-20_protectia_naturii_RO_SPA_SDF_2011.pdf" pdf = PdfFileReader(file(source_path, "rb")) def save_pdf(output, name): outputStream = file...
bsd-3-clause
Python
8ffcf96b5b270fa77026c8c62ee267363ae2e7b1
Add virtualenv plugin: build python environment.
liwushuo/fapistrano
fapistrano/plugins/virtualenv.py
fapistrano/plugins/virtualenv.py
# -*- coding: utf-8 -*- """ virtualenv plugin provide 2 virtualenv environment: 1. virtualenvwrapper in /home/depploy/.virtulaenvs/%(project_name)s 2. virtualenv in each release directory 2 pip install: 1. pip 2. pip wheel """ from fabric.api import run, env, prefix, cd from fabric.contrib.files import exists from...
mit
Python
4987e1722f8b55e99fbc9455eafe0210b5973060
create server bootstrap script
hertzwhenip/virtual-hammond,hertzwhenip/virtual-hammond,hertzwhenip/virtual-hammond,hertzwhenip/virtual-hammond
server/server.py
server/server.py
#! /usr/bin/python # encoding=utf-8 import os import cherrypy from http.router import Router def bootstrap(): api_config = os.path.abspath(os.path.join(os.getcwd(), 'config/api.conf')) router = Router() cherrypy.tools.CORS = cherrypy.Tool('before_handler', router.cors) cherrypy.tree.mount(router, '/a...
mit
Python
45c81e268df7f01fdeb64b053583b2946739eebe
add pactest with pacparser lib
aulphar/gfw_whitelist,aulphar/gfw_whitelist,blog2i2j/gfw_whitelist,amoxicillin/gfw_whitelist,felixonmars/gfw_whitelist,breakwa11/gfw_whitelist,faynwol/gfw_whitelist,zhaiyusci/youknowwhatitis,zhaiyusci/youknowwhatitis,breakwa11/gfw_whitelist,amoxicillin/gfw_whitelist,breakwa11/gfw_whitelist,amoxicillin/gfw_whitelist,fel...
pactest.py
pactest.py
#!/usr/bin/python #-*- coding: utf-8 -*- ''' You have to install pacparser before runing this script. You can get pacparser from https://code.google.com/p/pacparser. ''' import pacparser import time def get_pac_result(filename, url, host): pacparser.init() pacparser.parse_pac(filename) ret_str = pacparser.find_pr...
mit
Python
a68d89a4f351f8df2bfceeac77540b23e29827be
Add failing test for bug #1375 -- no out-of-bounds error for token.nbor()
honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,aikramer2/spaCy,explosion/spaCy,aikramer2/spaCy,aikramer2/spaCy,spacy-io/spaCy,explosion/spaCy,recognai/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,recognai/spaCy,recognai/spaCy,recognai/spaCy,explosion/spaCy,aikramer2/spaCy,recognai/spaCy,honnibal/spaCy,honnibal/s...
spacy/tests/regression/test_issue1375.py
spacy/tests/regression/test_issue1375.py
from __future__ import unicode_literals import pytest from ...vocab import Vocab from ...tokens.doc import Doc @pytest.mark.xfail def test_issue1375(): '''Test that token.nbor() raises IndexError for out-of-bounds access.''' doc = Doc(Vocab(), words=['0', '1', '2']) with pytest.raises(IndexError): ...
mit
Python
6418326667f0819a028606dee1683965a0092e0a
add functions to find the data dir
StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit
cs251tk/specs/dirs.py
cs251tk/specs/dirs.py
import os def get_specs_dir(): return os.path.join(get_data_dir(), 'cs251tk', 'specs') def get_data_dir(): return os.getenv('XDG_DATA_HOME', os.path.join(os.getenv('HOME'), '.local', 'share'))
mit
Python
4af8e31da47b321cfbd84223619379167c9c7d3b
Add config file with list of programs
njbbaer/unicorn-remote,njbbaer/unicorn-remote,njbbaer/unicorn-remote
app/config.py
app/config.py
programs = { "ascii_text": { "title": "ASCII Text", "path": "programs/ascii_text.py", }, "blink_sun": { "title": "Blink Sun", "path": "programs/blink_sun.py" }, "cheertree": { "title": "Cheertree", "path": "programs/cheertree.py" }, "cross": { ...
mit
Python
7749a3531cc2985112b7ef60421dd9c07e742bcb
Add fabfile.py file to project
korniichuk/jupyterhub
fabfile.py
fabfile.py
#! /usr/bin/env python2 # -*- coding: utf-8 -*- """The jupyterhub stack fabric file""" from fabric.api import local def git(): """Setup Git""" local("git remote rm origin") local("git remote add origin https://korniichuk@github.com/korniichuk/jupyterhub.git") local("git remote add bitbucket https://...
unlicense
Python
fcea7c42c7b793a84febd29112b50fc89b5fd6f4
Add fabfile to generate documentation
tarunbhardwaj/trytond-prestashop,prakashpp/trytond-prestashop
fabfile.py
fabfile.py
# -*- coding: utf-8 -*- """ fabfile Fab file to build and push documentation to github :copyright: © 2013 by Openlabs Technologies & Consulting (P) Limited :license: BSD, see LICENSE for more details. """ import time from fabric.api import local, lcd def upload_documentation(): """ Build an...
bsd-3-clause
Python
1d19208600c137cc4b27fd4c046d424982c6e4f5
Rename base class DakotaBase
csdms/dakota,csdms/dakota
dakota/dakota_base.py
dakota/dakota_base.py
#! /usr/bin/env python """A base class for all Dakota experiments.""" from abc import ABCMeta, abstractmethod class DakotaBase(object): """Describe features common to all Dakota experiments.""" __metaclass__ = ABCMeta @abstractmethod def __init__(self): """Create a set of default experiment ...
mit
Python
1e82283cc85b2eb449969849d23c4ffa2c090426
Add script to batch convert a directory recursively
kinow/pccora
scripts/directory_batch_convert.py
scripts/directory_batch_convert.py
import os import sys import re from pathlib import Path import argparse from convert2netcdf4 import parseandconvert parser = argparse.ArgumentParser(description='Recursively batch convert Vaisala old-binary format to NetCDF files. Keeps directory structure.') parser.add_argument('--from', dest='fromdir', help='Input...
mit
Python
8a3caf06f146ff9d3cf20d0d739c78cb93c16325
Add migrations
rapidpro/ureport,Ilhasoft/ureport,rapidpro/ureport,rapidpro/ureport,rapidpro/ureport,Ilhasoft/ureport,Ilhasoft/ureport,Ilhasoft/ureport
ureport/polls/migrations/0049_auto_20160810_1823.py
ureport/polls/migrations/0049_auto_20160810_1823.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('polls', '0048_populate_age_and_gender_on_poll_results'), ] operations = [ migrations.AlterField( model_name='pol...
agpl-3.0
Python
b69643de7f9ec207949e0054d2b1e98dbb81d898
Add new package: librelp (#18779)
LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack
var/spack/repos/builtin/packages/librelp/package.py
var/spack/repos/builtin/packages/librelp/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 Librelp(AutotoolsPackage): """Librelp is an easy to use library for the RELP protocol. REL...
lgpl-2.1
Python
860f8224bf8ef2f1553a17842d1389491f43bfa5
Add missing migration for wagtail.tests
inonit/wagtail,janusnic/wagtail,chrxr/wagtail,FlipperPA/wagtail,nrsimha/wagtail,benjaoming/wagtail,jordij/wagtail,taedori81/wagtail,takeshineshiro/wagtail,mephizzle/wagtail,hanpama/wagtail,darith27/wagtail,gogobook/wagtail,gasman/wagtail,wagtail/wagtail,timorieber/wagtail,rsalmaso/wagtail,FlipperPA/wagtail,mjec/wagtail...
wagtail/tests/migrations/0008_auto_20141113_2125.py
wagtail/tests/migrations/0008_auto_20141113_2125.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('tests', '0007_registerdecorator'), ] operations = [ migrations.AlterField( model_name='pagechoosermodel', ...
bsd-3-clause
Python
78420caaac5c5055d9264e9905c5e14e9756a064
Add Cli_server_tcp, just like Cli_server_local, but using TCP socket.
sippy/b2bua,AVOXI/b2bua,AVOXI/b2bua,sippy/b2bua
sippy/Cli_server_tcp.py
sippy/Cli_server_tcp.py
# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved. # Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved. # # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistrib...
bsd-2-clause
Python
057173c48a56c0c858212233ee60dcbb88e22838
Add tests.py, including one failure
openhatch/oh-mainline,willingc/oh-mainline,jledbetter/openhatch,mzdaniel/oh-mainline,ehashman/oh-mainline,vipul-sharma20/oh-mainline,Changaco/oh-mainline,openhatch/oh-mainline,jledbetter/openhatch,sudheesh001/oh-mainline,campbe13/openhatch,vipul-sharma20/oh-mainline,onceuponatimeforever/oh-mainline,ehashman/oh-mainline...
mysite/profile/tests.py
mysite/profile/tests.py
import django.test from search.models import Project import twill from twill import commands as tc from twill.shell import TwillCommandLoop from django.test import TestCase from django.core.servers.basehttp import AdminMediaHandler from django.core.handlers.wsgi import WSGIHandler from StringIO import StringIO # FIXM...
agpl-3.0
Python
bfc386c1a894811532ccfc65ce45339a964c5ac0
Create batch_clip.py
jamaps/open_geo_scripts,jamaps/gdal_and_ogr_scripts,jamaps/open_geo_scripts,jamaps/fun_with_gdal,jamaps/shell_scripts,jamaps/shell_scripts,jamaps/gdal_and_ogr_scripts,jamaps/open_geo_scripts,jamaps/fun_with_gdal
batch_clip.py
batch_clip.py
# clips all .shps in folder to a boundary polygon from subprocess import call import os # in dir of to be clipped shps and boundary file shp_folder = "nrn_rrn_on_shp_en" clip_poly = "clip_bound.shp" #output dir name # os.mkdir("clipped") c = 0 for subdir, dirs, files in os.walk(shp_folder): for file in files: i...
mit
Python
d1e403fce1affd0c7da1753fda441dd9a9c1d9ff
copy ISON settings for BBC
olebole/astrometry.net,olebole/astrometry.net,olebole/astrometry.net,olebole/astrometry.net,olebole/astrometry.net,olebole/astrometry.net,olebole/astrometry.net,olebole/astrometry.net
net/settings_bbc.py
net/settings_bbc.py
# settings_ison.py from settings_common import * TEMPDIR = '/data2/tmp' DATABASES['default']['NAME'] = 'an-ison' LOGGING['loggers']['django.request']['level'] = 'WARN' SESSION_COOKIE_NAME = 'IsonAstrometrySession' ssh_solver_config = 'an-ison' sitename = 'ison'
bsd-3-clause
Python
f20ed3b4941fef84e95afce4db0349ed8da3070e
Create Hour_Rain_Map.py
bryansandw/Rain_Gauges
Hour_Rain_Map.py
Hour_Rain_Map.py
############################################################################# # Name: Elizabeth Rentschlar # # Assistantce from: # # Purpose: Use Hourly rain totals condensed in Hours.py to create a series # # ...
mit
Python
d8ad74b80f214ca313d01533ea6f15082cbb3af2
Add tests for calibration procedure (draft)
matteobachetti/srt-single-dish-tools
srttools/core/tests/test_calibration.py
srttools/core/tests/test_calibration.py
from ..calibration import CalibratorTable from ..read_config import read_config from ..scan import list_scans import numpy as np import matplotlib.pyplot as plt import unittest from astropy.table import Table from ..imager import ScanSet import os import glob class Test2_Calibration(unittest.TestCase): @classmeth...
bsd-3-clause
Python
427f4562dc2a4fa7b805154e3ffd732381ed6e8d
Add dbwriter.py
bcanvural/thesis,bcanvural/thesis
dbwriter.py
dbwriter.py
from pymongo import MongoClient import os from pathlib import Path def main(): client = MongoClient('localhost', 27017) db = client['thesis-database'] #tfidf-cv-category collection = db['tfidf-cv-category'] path = 'Calculated/tfidf/cv-category' for filename in os.listdir(path): if filena...
mit
Python
ac8fdf7dc902caed2757ea40483fff951af93ac8
add cu2qu.cli module exporting a main() function for console script
googlefonts/cu2qu,googlefonts/fonttools,googlei18n/cu2qu,fonttools/fonttools
Lib/cu2qu/cli.py
Lib/cu2qu/cli.py
import os import argparse import logging import shutil import multiprocessing as mp from contextlib import closing from functools import partial import cu2qu from cu2qu.ufo import font_to_quadratic, fonts_to_quadratic import defcon logger = logging.getLogger("cu2qu") def _cpu_count(): try: return mp.cp...
apache-2.0
Python
afcd636772952c8b6d2cca51e1851af29f5b6707
Create PostForm.
jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8
blog/forms.py
blog/forms.py
from django import forms from .models import Post class PostForm(forms.ModelForm): class Meta: model = Post fields = '__all__' def clean_slug(self): return self.cleaned_data['slug'].lower()
bsd-2-clause
Python
e39290b71299843eff858fb51543b99a06178a1d
Add a simple 8x benchmark script
YosysHQ/nextpnr,SymbiFlow/nextpnr,SymbiFlow/nextpnr,YosysHQ/nextpnr,YosysHQ/nextpnr,YosysHQ/nextpnr,SymbiFlow/nextpnr,SymbiFlow/nextpnr
ice40/picorv32_benchmark.py
ice40/picorv32_benchmark.py
#!/usr/bin/env python3 import os, sys, threading from os import path import subprocess import re num_runs = 8 if not path.exists("picorv32.json"): os.remove("picorv32.json") subprocess.run(["wget", "https://raw.githubusercontent.com/cliffordwolf/picorv32/master/picorv32.v"], check=True) subprocess.run(["y...
isc
Python
30081b470fc3522afc4af3a4fc33eb28bc85d6d6
Add project config manager
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
polyaxon_cli/managers/project.py
polyaxon_cli/managers/project.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from polyaxon_schemas.project import ProjectConfig from polyaxon_cli.managers.base import BaseConfigManager class ProjectConfigManager(BaseConfigManager): """Manages access token configuration .plxprojectconfig file.""" ...
apache-2.0
Python
aec80109daf855f64f666f998aa2a96755e653f5
add rpython-compatible implementation of load_resource() for win32
Darkman/esky,timeyyy/esky,ccpgames/esky,datalytica/esky,kinnarr/esky
esky/bdist_esky/pypy_winres.py
esky/bdist_esky/pypy_winres.py
""" esky.bdist_esky.pypy_winres: access win32 exe resources in rpython This module provides some functions for accessing win32 exe resources from rpython code. It's a trimmed-down version of the esky.winres module with just enough functionality to get the py2exe compiled bootstrapper working. """ from pypy.r...
bsd-3-clause
Python
8e1a117c0d0bf3614beed0410862d1dc1a91b306
Create shp2zip.py
datawagovau/fme-workbenches
upload-geospatial-data/python/shp2zip.py
upload-geospatial-data/python/shp2zip.py
import os import shutil import zipfile # Creates a zip file containing the input shapefile # inShp: Full path to shapefile to be zipped # Delete: Set to True to delete shapefile files after zip def ZipShp (inShp, Delete = True): #List of shapefile file extensions extensions = [".shp",".shx",".dbf",".sbn","...
mit
Python
06804460f2b0e70b7b08d6657353c1c172a0df4c
add examples/tube-stream-private.py
PabloCastellano/telepathy-python,detrout/telepathy-python,detrout/telepathy-python,max-posedon/telepathy-python,PabloCastellano/telepathy-python,epage/telepathy-python,max-posedon/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,epage/t...
examples/tube-stream-private.py
examples/tube-stream-private.py
import sys from stream_tube_client import StreamTubeJoinerPrivateClient, \ StreamTubeInitiatorPrivateClient def usage(): print "Usage:\n" \ "Offer a stream tube to [contact] using the trivial stream server:\n" \ "\tpython %s [account-file] [contact]\n" \ "Accept a strea...
lgpl-2.1
Python
d304c1cd9b35f92a6f5bb1c739402b8f3a6c22c8
Create cigar_party.py
dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey
Python/CodingBat/cigar_party.py
Python/CodingBat/cigar_party.py
# http://codingbat.com/prob/p195669 def cigar_party(cigars, is_weekend): if is_weekend and cigars >= 40: return True elif not is_weekend and (cigars >= 40 and cigars <= 60): return True else: return False
mit
Python
dbf1d68fd3c3681b1aa7673b1cfd8a2cc3417edf
Create problem5.py
CptDemocracy/Python
Project-Euler/Problem5/problem5.py
Project-Euler/Problem5/problem5.py
""" [ref.href] https://projecteuler.net/problem=5 Smallest multiple. 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? """ EPS = 1e-6 def IsDivisibleByAll(n, di...
mit
Python
d441cfd92cd8d843f22f181d485786fe1ed8948f
Add herokustatus plugin
Cyanogenoid/smartbot,tomleese/smartbot,Muzer/smartbot,thomasleese/smartbot-old
plugins/herokustatus.py
plugins/herokustatus.py
import urllib.parse import requests class Plugin: def __call__(self, bot): bot.on_respond(r"heroku st(atus)?$", self.on_respond) bot.on_help("herokustatus", self.on_help) def on_respond(self, bot, msg, reply): url = "https://status.heroku.com/api/v3/current-status" headers = { ...
mit
Python
0af447c0371bd157c03fc5097ac8c0e0a5873ff7
Add temporary satellites analysis example.
probcomp/bayeslite,probcomp/bayeslite
examples/satellites_analyze.py
examples/satellites_analyze.py
assert __name__ == '__main__' import bayeslite.bql as bql import bayeslite.core as core import bayeslite.parse as parse import crosscat.LocalEngine as localengine import getopt import sys # XXX This is wrong -- should be part of bayesdb proper. But it, and # copypasta of it, will do for now until internals are restr...
apache-2.0
Python
034cb3a0fe2a2c0c8b47fd631ca28bbfa7091902
add recursive preOrder BST
Daetalus/Algorithms
BST/bst.py
BST/bst.py
#!/usr/bin/env python # -*- coding:utf-8 -*- from __future__ import division from __future__ import unicode_literals from __future__ import print_function class Node(object): def __init__(self, value): self.left = None self.right = None self.value = value # recursive def preOrderRecur(ro...
#!/usr/bin/env python # -*- coding:utf-8 -*- from __future__ import division from __future__ import unicode_literals from __future__ import print_function class Node(object): def __init__(self, value): self.left = None self.right = None self.value = value # iterative def preOrder(root): ...
unlicense
Python
022ab3e18660a310545d59a467f6eb9703fb5422
Add dummy settings for database (which hopefully work).
campovski/beernburger,campovski/beernburger,campovski/beernburger
beernburger/my_settings.py
beernburger/my_settings.py
""" Django settings for beernburger project. Generated by 'django-admin startproject' using Django 1.11. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import ...
mit
Python
1d48cbd2a9882d20b71fe26841a8c8575fbb3ba9
Add script to generate all attention plots for dataset
google/seq2seq,chunfengh/seq2seq,google/seq2seq,shashankrajput/seq2seq,liyi193328/seq2seq,liyi193328/seq2seq,liyi193328/seq2seq,chunfengh/seq2seq,chunfengh/seq2seq,chunfengh/seq2seq,google/seq2seq,liyi193328/seq2seq,shashankrajput/seq2seq,shashankrajput/seq2seq,liyi193328/seq2seq,google/seq2seq,kontact-chan/seq2seq,sha...
bin/visualize_attention.py
bin/visualize_attention.py
#! /usr/bin/env python """ Generates model predictions. """ import os import tensorflow as tf from tensorflow.python.platform import gfile import numpy as np from matplotlib import pyplot as plt from seq2seq import graph_utils from seq2seq.inference import create_inference_graph, create_predictions_iter tf.flags.D...
apache-2.0
Python
aa52332d622e16b3d1524eb2dc12047cec02fb33
Create calculator.py
Anurag842/my-first-calculator
calculator.py
calculator.py
# my-first-calculator #Description is in the name #calculator print "For addition press 1" print "For subtraction press 2" print "For multiplication press 3" print "For division press 4" print "If you're all done press 5" cmd=float(int(raw_input("Enter operation number:"))) #Addition if cmd==1: print "Ok begi...
mit
Python
069a5758b16624ac2b547ede44123b64c89baf96
Add simple script mapping YTID to KA URLs.
danielhollas/AmaraUpload,danielhollas/AmaraUpload
map_ytids_to_ka_urls.py
map_ytids_to_ka_urls.py
#!/usr/bin/env python3 from kapi import * from utils import * import argparse, sys import time def read_cmd(): """Function for reading command line options.""" desc = "Program for mapping YouTube IDs to KA URLs to Crowdin WYSIWYG editor." parser = argparse.ArgumentParser(description=desc) parser.add_argu...
mit
Python
41265e02f47a55d11dcc921aeeebebba290ed61f
Fix Dee.
CelineBoudier/rapid-router,mikebryant/rapid-router,mikebryant/rapid-router,CelineBoudier/rapid-router,mikebryant/rapid-router,mikebryant/rapid-router,CelineBoudier/rapid-router,CelineBoudier/rapid-router
game/migrations/0008_fix_dee.py
game/migrations/0008_fix_dee.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations def fix_dee(apps, schema_editor): Character = apps.get_model('game', 'Character') dee = Character.objects.get(name='Dee') dee.en_face = 'characters/front_view/Dee.svg' dee.save() class Migrati...
agpl-3.0
Python
31af59fdfa988924da8a6b02b191ae9ba8ab5f02
Add initial SDS011 sensor reader script
aapris/VekotinVerstas,aapris/VekotinVerstas
RpiAir/sds011.py
RpiAir/sds011.py
# coding=utf-8 """ TODO: check sleep command from here! http://www.codegists.com/snippet/python/sds011_kadamski_python """ from __future__ import print_function import serial import struct, sys import sys import datetime class Sds011Reader: def __init__(self, port, baudrate=9600): self.ser = serial....
mit
Python
6d0f78ccdb8587d5a35ee297198a664274598747
Create run_test.py
dschreij/staged-recipes,mariusvniekerk/staged-recipes,chrisburr/staged-recipes,conda-forge/staged-recipes,mcs07/staged-recipes,patricksnape/staged-recipes,shadowwalkersb/staged-recipes,scopatz/staged-recipes,larray-project/staged-recipes,chrisburr/staged-recipes,sodre/staged-recipes,pmlandwehr/staged-recipes,petrushy/s...
recipes/pytest-sugar/run_test.py
recipes/pytest-sugar/run_test.py
import django from django.conf import settings settings.configure(INSTALLED_APPS=['pytest_sugar', 'django.contrib.contenttypes', 'django.contrib.auth']) django.setup() import pytest_sugar
bsd-3-clause
Python
e50dc18525e0e4cbbef56cd16ba4e2d9690464f1
Add solution for problem 34
cifvts/PyEuler
euler034.py
euler034.py
#!/usr/bin/python from math import factorial, log values = [0]*10 for i in range(10): values[i] = factorial(i) total = 0 for i in range(10, factorial(9) * 7): target = 0 test = i while test != 0: x = test % 10 target += values[x] test = test // 10 if i == target: t...
mit
Python
427752b4ee3d63d1bf29a9a2a9be011662df8556
add login handler
SandstoneHPC/sandstone-spawner
jupyterhub_login.py
jupyterhub_login.py
from sandstone.lib.handlers.base import BaseHandler import requests import os class JupyterHubLoginHandler(BaseHandler): def get(self): api_token = os.environ['JUPYTERHUB_API_TOKEN'] url = '{protocol}://{host}/hub/api/authorizations/token/{token}'.format( protocol=self.request.protocol...
mit
Python
8bd8ae1daa432bce9881214c4d326ac8a38e2046
Correct MAPE loss
MagicSen/keras,xiaoda99/keras,pthaike/keras,OlafLee/keras,DLlearn/keras,tencrance/keras,gavinmh/keras,brainwater/keras,yingzha/keras,nzer0/keras,llcao/keras,xurantju/keras,meanmee/keras,zhangxujinsh/keras,bottler/keras,cvfish/keras,jbolinge/keras,jiumem/keras,jalexvig/keras,kemaswill/keras,zxsted/keras,nehz/keras,navyj...
keras/objectives.py
keras/objectives.py
from __future__ import absolute_import import theano import theano.tensor as T import numpy as np from six.moves import range epsilon = 1.0e-9 def mean_squared_error(y_true, y_pred): return T.sqr(y_pred - y_true).mean(axis=-1) def mean_absolute_error(y_true, y_pred): return T.abs_(y_pred - y_true).mean(axis=...
from __future__ import absolute_import import theano import theano.tensor as T import numpy as np from six.moves import range epsilon = 1.0e-9 def mean_squared_error(y_true, y_pred): return T.sqr(y_pred - y_true).mean(axis=-1) def mean_absolute_error(y_true, y_pred): return T.abs_(y_pred - y_true).mean(axis=...
mit
Python
29aa26f553633fbe4a5ae37721e1da0ecca4139c
Create MyaiBot-Pictures.py
MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab
home/moz4r/MyaiBot-Pictures.py
home/moz4r/MyaiBot-Pictures.py
#PICTURE FIND AND DISPLAY BOT #LONK AT http://www.myai.cloud/ #FOR SERVER NAME AND BOT STATUS #IT S A SMALL COMPUTER FOR NOW SORRY IF PROBLEMS from java.lang import String import random import threading import itertools http = Runtime.createAndStart("http","HttpClient") Runtime.createAndStart("chatBot", "ProgramAB") R...
apache-2.0
Python
147374971ad21406d61beb1512b5a702298fc3dc
add a generic seach module (relies on sqlalchemy)
mapfish/mapfish,mapfish/mapfish,mapfish/mapfish
cartoweb/plugins/search.py
cartoweb/plugins/search.py
from sqlalchemy.sql import select from sqlalchemy.sql import and_ from sqlalchemy.sql import func from shapely.geometry.point import Point from shapely.geometry.polygon import Polygon class Search: EPSG = 4326 UNITS = 'degrees' def __init__(self, idColumn, geomColumn, epsg=EPSG, units=UNITS): sel...
bsd-3-clause
Python
6078617684edbc7f264cfe08d60f7c3d24d2898f
add test for handle_conversation_before_save
SkygearIO/chat,lakoo/chat,lakoo/chat,rickmak/chat,lakoo/chat,SkygearIO/chat
plugin/test/test_handle_conversation_before_save.py
plugin/test/test_handle_conversation_before_save.py
import unittest import copy from unittest.mock import Mock import chat_plugin from chat_plugin import handle_conversation_before_save class TestHandleConversationBeforeSave(unittest.TestCase): def setUp(self): self.conn = None chat_plugin.current_user_id = Mock(return_value="user1") def rec...
apache-2.0
Python
943e162eee203f05b5a2d5b19bcb4a9c371cc93b
Add new script to get comet velocity from kymograph
hadim/fiji_tools,hadim/fiji_scripts,hadim/fiji_scripts,hadim/fiji_scripts,hadim/fiji_tools
plugins/Scripts/Plugins/Kymograph_Comet_Velocity.py
plugins/Scripts/Plugins/Kymograph_Comet_Velocity.py
# @Float(label="Time Interval (s)", value=1) dt # @Float(label="Pixel Length (um)", value=1) pixel_length # @Boolean(label="Do you want to save results files ?", required=False) save_results # @Boolean(label="Do you want to save ROI files ?", required=False) save_roi # @ImageJ ij # @ImagePlus img # @Dataset data # @Sta...
bsd-3-clause
Python
9934db8d079cf283f177daa55cb9e21e3f12dae2
add sunburst graph python module
Etsukata/d3js_trace,Etsukata/d3js_trace
sbgraph.py
sbgraph.py
#!/usr/bin/python import sys import re stack_traces = [] stack_trace = [] stack_samples = [] def stack_sample_to_dict(sample): ret = {} if len(sample['stack_trace']) == 1: ret['name'] = sample['stack_trace'][0] ret['size'] = sample['count'] return ret ret['name'] = sample['stac...
apache-2.0
Python
c426c773ee36d2872f79ff01d3bed615245e61b3
add nbconvert.utils.pandoc
ipython/ipython,ipython/ipython
IPython/nbconvert/utils/pandoc.py
IPython/nbconvert/utils/pandoc.py
"""Utility for calling pandoc""" #----------------------------------------------------------------------------- # Copyright (c) 2013 the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #--------------...
bsd-3-clause
Python
5b951c91a7d054958d819bf19f97a5b33e21ff2d
add in some forms
muffinresearch/solitude,muffinresearch/solitude
lib/buyers/forms.py
lib/buyers/forms.py
from django import forms from .models import Buyer class BuyerValidation(forms.ModelForm): class Meta: model = Buyer class PreapprovalValidation(forms.Form): start = forms.DateField() end = forms.DateField() return_url = forms.URLField() cancel_url = forms.URLField()
bsd-3-clause
Python
4d47d14e2f630652c36765abf5907d6800a8012d
Revert "Revert "Initial python to find public APIs in Hadoop and compare them to outp…"" (#73) (cherry picked from commit a24236206b35744835781d42ff1dededbc685721)
mbalassi/bigtop,apache/bigtop,panagiotisl/bigtop,youngwookim/bigtop,sekikn/bigtop,youngwookim/bigtop,juju-solutions/bigtop,welikecloud/bigtop,welikecloud/bigtop,Guavus/bigtop,apache/bigtop,sekikn/bigtop,apache/bigtop,Guavus/bigtop,welikecloud/bigtop,youngwookim/bigtop,JunHe77/bigtop,panagiotisl/bigtop,mbalassi/bigtop,y...
bigtop-tests/spec-tests/runtime/src/test/python/find-public-apis.py
bigtop-tests/spec-tests/runtime/src/test/python/find-public-apis.py
#!/usr/bin/python ''' Licensed to the Apache Software Foundation (ASF) 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"); yo...
apache-2.0
Python
e63d18f9ef70e7a42344cf13322676efa2226fa2
Create largest_rectangle_in_histogram.py
py-in-the-sky/challenges,py-in-the-sky/challenges,py-in-the-sky/challenges
largest_rectangle_in_histogram.py
largest_rectangle_in_histogram.py
""" https://www.youtube.com/watch?v=VNbkzsnllsU """ def largest_rectangle_in_histogram(histogram): "Return area of largest rectangle under histogram." assert all(height >= 0 for height in histogram) # Use stacks to keep track of how long a rectangle of height h # extends to the right. largest = ...
mit
Python
f2854aff3dde6439d990f8fd7d69e70dd4664b93
Add tags app admin
opps/opps,opps/opps,jeanmask/opps,YACOWS/opps,YACOWS/opps,opps/opps,williamroot/opps,jeanmask/opps,opps/opps,williamroot/opps,YACOWS/opps,williamroot/opps,jeanmask/opps,YACOWS/opps,jeanmask/opps,williamroot/opps
opps/core/tags/admin.py
opps/core/tags/admin.py
# -*- encoding: utf-8 -*- from django.contrib import admin from .models import Tag class TagAdmin(admin.ModelAdmin): list_display = ('name', 'date_insert') search_fields = ('name',) prepopulated_fields = {"slug": ["name"]} fieldsets = [(None, {'fields': ('name', 'slug',)})] class Meta: ...
mit
Python
c3d37914777ee9e2356bfa691361351423b0615a
make a nova server instance return it's host's hostname
luos/nova-latency-scheduler,luos/nova-latency-scheduler
heat/network_aware_resources.py
heat/network_aware_resources.py
from heat.engine.resources.openstack.nova.server import Server as NovaServer from oslo_log import log as logging import traceback LOG = logging.getLogger(__name__) class NetworkAwareServer(NovaServer): OS_EXT_HOST_KEY = 'OS-EXT-SRV-ATTR:host' def get_attribute(self, key, *path): if key == "host": ...
mit
Python
425363751244d5ff75e61126fd1481094c941129
Create luhn.py for pypi package
garwoodpr/LuhnAlgorithmProof,garwoodpr/LuhnAlgorithmProof
luhn/luhn.py
luhn/luhn.py
#!/usr/bin/env python3 # Python 3.4 Implementation of the Luhn Algorithm # Checks to see if 14, 15 or 16 digit account number is Luhn Compliant. # See https://en.wikipedia.org/wiki/Luhn_algorithm for formula details. # This file is suitable for unittest testing # CardNumber is an account number (for example) recei...
mit
Python
be271f41103efdc26aadbc2cf3e39446bf2a05bc
Define Application class.
soasme/axe
taxe/__init__.py
taxe/__init__.py
# -*- coding: utf-8 -*- from functools import wraps from werkzeug.wrappers import Request, Response class Application(object): def route(self, url): def deco(function): @wraps(function) def _(*args, **kwargs): print self, url return function(*args, ...
mit
Python
d0c7dfad3e7769b6f89828733414a4a68677696a
Create UnorderedList.py
prashantas/MyDataScience
Python/GenPythonProblems/UnorderedList.py
Python/GenPythonProblems/UnorderedList.py
## http://interactivepython.org/runestone/static/pythonds/BasicDS/ImplementinganUnorderedListLinkedLists.html class Node: def __init__(self,initdata): self.data = initdata self.next = None def getData(self): return self.data def getNext(self): return self.next def setD...
bsd-2-clause
Python
6ac4db0b9bfc638d708fd7341b0f3e1437ce8f97
add dir cmmbbo to hold code for docker scheduler
zam121118/mao-mbbo,zam121118/mao-mbbo,zam121118/mao-mbbo,zam121118/mao-mbbo
cmbbo/main.py
cmbbo/main.py
#coding: utf-8
bsd-2-clause
Python
4ab45fc2dee8676566467706c0a433315c8fe3c8
Add test
corburn/scikit-bio,colinbrislawn/scikit-bio,SamStudio8/scikit-bio,averagehat/scikit-bio,colinbrislawn/scikit-bio,anderspitman/scikit-bio,johnchase/scikit-bio,xguse/scikit-bio,johnchase/scikit-bio,kdmurray91/scikit-bio,demis001/scikit-bio,Achuth17/scikit-bio,Achuth17/scikit-bio,gregcaporaso/scikit-bio,jairideout/scikit-...
skbio/util/tests/test_testing.py
skbio/util/tests/test_testing.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # --------------------------------------------...
bsd-3-clause
Python
81032ffdae2d4bd02f3e9a6460b022079bf3cee8
Create about.py
MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab
home/hairygael/GESTURES/about.py
home/hairygael/GESTURES/about.py
def about(): sleep(2) ear.pauseListening() sleep(2) i01.setArmSpeed("right", 0.1, 0.1, 0.2, 0.2); i01.setArmSpeed("left", 0.1, 0.1, 0.2, 0.2); i01.setHeadSpeed(0.2,0.2) i01.moveArm("right", 64, 94, 10, 10); i01.mouth.speakBlocking("I am the first life si...
apache-2.0
Python