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
5a12137c3e766451d83e6598ba93d16e0a8cbde8
Add test for accessing attribute of inherited native type.
noahchense/micropython,matthewelse/micropython,micropython/micropython-esp32,Vogtinator/micropython,danicampora/micropython,adafruit/micropython,warner83/micropython,emfcamp/micropython,MrSurly/micropython-esp32,noahwilliamsson/micropython,mpalomer/micropython,kostyll/micropython,EcmaXp/micropython,drrk/micropython,MrS...
tests/basics/subclass-native3.py
tests/basics/subclass-native3.py
class MyExc(Exception): pass e = MyExc(100, "Some error") print(e) # TODO: Prints native base class name #print(repr(e)) print(e.args)
mit
Python
c963310123765baddf638c8d08b8fdb2f73b6ba6
Add test for calling inherited native method on subclass.
drrk/micropython,ryannathans/micropython,MrSurly/micropython-esp32,warner83/micropython,redbear/micropython,noahchense/micropython,AriZuu/micropython,martinribelotta/micropython,toolmacher/micropython,martinribelotta/micropython,jlillest/micropython,oopy/micropython,feilongfl/micropython,mhoffma/micropython,vitiral/mic...
tests/basics/subclass-native4.py
tests/basics/subclass-native4.py
# Test calling non-special method inherited from native type class mylist(list): pass l = mylist([1, 2, 3]) print(l) l.append(10) print(l)
mit
Python
15a655e490b0f0d035edd4f772f126146959e531
Add example to show how to create dom hit statistics
tamasgal/km3pipe,tamasgal/km3pipe
examples/plot_dom_hits.py
examples/plot_dom_hits.py
""" ================== DOM hits. ================== This example shows how to create DOM hits statistics to estimate track distances. """ from collections import defaultdict, Counter import km3pipe as kp import pandas as pd import matplotlib.pyplot as plt from matplotlib.colors import LogNorm from km3modules impor...
mit
Python
c3ffe59763b6f4aa7ce0476ad0d75b2bd43a6f52
Improve anonymous behavior
getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus
zeus/api/resources/auth_index.py
zeus/api/resources/auth_index.py
import json from zeus import auth from zeus.api import client from zeus.exceptions import ApiError from zeus.models import Email, Identity from .base import Resource from ..schemas import EmailSchema, IdentitySchema, UserSchema emails_schema = EmailSchema(many=True, strict=True) identities_schema = IdentitySchema(ma...
import json from flask import session from sqlalchemy.orm import subqueryload_all from zeus import auth from zeus.api import client from zeus.models import Email, Identity, User from .base import Resource from ..schemas import EmailSchema, IdentitySchema, UserSchema emails_schema = EmailSchema(many=True, strict=Tru...
apache-2.0
Python
e859047d7aaf65c63e425b297093a9cbebdda494
remove PICNIK KEY
ricktaylord/django-filebrowser,michalwerner/django-filebrowser,UGentPortaal/django-filebrowser-no-grappelli-django14,michalwerner/django-filebrowser-tinymce4,yakky/django-filebrowser-no-grappelli,michalwerner/django-filebrowser-tinymce4,VishvajitP/django-filebrowser,SebasSBM/django-filebrowser,adamrt/django-filebrowser...
fb_settings.py
fb_settings.py
import os from django.conf import settings PATH_SERVER = os.path.join(settings.MEDIA_ROOT, 'uploads') PATH_WWW = settings.MEDIA_URL + 'uploads/' PATH_ADMIN = '/admin/filebrowser/' # extensions / lower case (important) EXTENSIONS = { 'Folder':[''], 'Image':['.jpg', '.jpeg', '.gif','.png','.tif','.tiff'], '...
import os from django.conf import settings PATH_SERVER = os.path.join(settings.MEDIA_ROOT, 'uploads') PATH_WWW = settings.MEDIA_URL + 'uploads/' PATH_ADMIN = '/admin/filebrowser/' # extensions / lower case (important) EXTENSIONS = { 'Folder':[''], 'Image':['.jpg', '.jpeg', '.gif','.png','.tif','.tiff'], '...
bsd-3-clause
Python
36110dde6e01ba99cea5dff27a9a4658262621a3
add scratchpad_async module
Shir0kamii/py3status,Spirotot/py3status,Andrwe/py3status,ultrabug/py3status,tobes/py3status,ultrabug/py3status,guiniol/py3status,tobes/py3status,Andrwe/py3status,valdur55/py3status,alexoneill/py3status,valdur55/py3status,docwalter/py3status,valdur55/py3status,guiniol/py3status,vvoland/py3status,ultrabug/py3status
py3status/modules/scratchpad_async.py
py3status/modules/scratchpad_async.py
# -*- coding: utf-8 -*- """ Display the amount of windows and indicate urgency hints on scratchpad (async). Configuration parameters: - always_show: whether the indicator should be shown if there are no scratchpad windows (default False) - color_urgent: color to use if a scratchpad window is urgent (defaul...
bsd-3-clause
Python
b1681144b660f931633bc6d70d50b4185a2e17d8
tag for modelform
michaelkuty/horizon-contrib,michaelkuty/horizon-contrib,michaelkuty/horizon-contrib
horizon_contrib/templatetags/utils.py
horizon_contrib/templatetags/utils.py
from django import template from horizon_contrib.forms import SelfHandlingModelForm register = template.Library() @register.filter def isinstance(form): return isinstance(form, SelfHandlingModelForm)
bsd-3-clause
Python
b3cbf179371c289121126d0cb66d9873d740f202
Add post_only and get_only decorators
Nikola-K/django_reddit,Nikola-K/django_reddit,Nikola-K/django_reddit
utils/helpers.py
utils/helpers.py
from django.http import HttpResponseNotAllowed def post_only(func): def decorated(request, *args, **kwargs): if request.method != 'POST': return HttpResponseNotAllowed(['GET']) return func(request, *args, **kwargs) return decorated def get_only(func): def decorated(request, *ar...
apache-2.0
Python
7345caefb7b87615b25c0a2219a56aeaa01bc824
Test operational errors
thusoy/porridge,thusoy/porridge,thusoy/porridge
tests/test_operational_errors.py
tests/test_operational_errors.py
import resource import pytest from porridge import Porridge, PorridgeError def test_operational_error_memory_allocation_error_on_boil(): '''Tries to allocate 1TB for password hashing, which is hopefully more than what is available on any machine that tries to run the tests, or this test will take a long...
mit
Python
b8cbe593a61aa6151c8b0945870866ace1fb3dbc
Add the conn_join module which allows forcibly joining clients to a channel on connect
DesertBus/txircd,ElementalAlchemist/txircd,Heufneutje/txircd
txircd/modules/conn_join.py
txircd/modules/conn_join.py
from txircd.channel import IRCChannel from txircd.modbase import Module class Autojoin(Module): def joinOnConnect(self, user): if "client_join_on_connect" in self.ircd.servconfig: for channel in self.ircd.servconfig["client_join_on_connect"]: user.join(self.ircd.channels[channel] if channel in self.ircd.chan...
bsd-3-clause
Python
56013a00179c095af405ae6b347013be5ea5ae73
add benchmarks
RaRe-Technologies/smart_open,RaRe-Technologies/smart_open,piskvorky/smart_open
integration-tests/test_s3_readline.py
integration-tests/test_s3_readline.py
import sys from smart_open import open def read_lines(url, limit): lines = [] with open(url, 'r', errors='ignore') as fin: for i, l in enumerate(fin): if i == limit: break lines.append(l) return lines def test(benchmark): # # This file is around 8...
mit
Python
5647f0b2a2c3a8f0a3bd085ab5bd5ec18b55fcdc
Add application file
patrickspencer/lytics,patrickspencer/lytics,patrickspencer/lytics,patrickspencer/lytics
lytics/application.py
lytics/application.py
from flask import Flask from lytics import settings from flask_restful import Resource, Api, reqparse from lytics.db import queries def create_app(config_filename): """ Returns a Flask app given a configuration object :param config_object: a string which points to a class holding the configuration set...
apache-2.0
Python
91036e769ae2b875765af5ff48c196e144363593
add related-view
chronossc/django-grappelli,chronossc/django-grappelli
views/related.py
views/related.py
# -*- coding: utf-8 -*- from django.http import HttpResponse from django.db import models def related_lookup(request): if request.method == 'GET': if request.GET.has_key('object_id') and request.GET.has_key('app_label') and request.GET.has_key('model_name'): object_id = request.GET.get('...
bsd-3-clause
Python
f4b5659c4c58ddba434509f5d470b46907772289
Add code to generate window file for fast rcnn training.
myfavouritekk/TPN
tools/data/generate_window_file_for_fast_rcnn.py
tools/data/generate_window_file_for_fast_rcnn.py
#!/usr/bin/env python # -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2016 CUHK # Written by Wang Kun # Modified by Kang Kai for ImageNet VID # -------------------------------------------------------- """Generate txt file as the input to craft::frcnn_train_data_layer""" import...
mit
Python
6622896296ad72672f15484404e89851af59f83e
Create loginSimple.py
debuggers-370/awesomeprojectnumberone,debuggers-370/awesomeprojectnumberone,debuggers-370/awesomeprojectnumberone
flaskstuff/loginSimple.py
flaskstuff/loginSimple.py
from flask import Flask, render_template, flash, request from wtforms import Form, TextField, TextAreaField, validators, StringField, SubmitField, PasswordField, BooleanField # App config. DEBUG = True app = Flask(__name__) app.config.from_object(__name__) app.config['SECRET_KEY'] = '7d441f27d441f27567d441f2b6176a' ...
agpl-3.0
Python
30b62364aedfa56726fce57f106830276a0ec177
Convert bytes to integer
TheShellLand/pies,TheShellLand/pies
v3/Libraries/builtin/int/from_bytes/Bytes2Int.py
v3/Libraries/builtin/int/from_bytes/Bytes2Int.py
int.from_bytes(b'y\xcc\xa6\xbb', byteorder='big') # Default byte ordering # 2043455163 int.from_bytes(b'y\xcc\xa6\xbb', byteorder='little') # 3148270713
mit
Python
65e9e1aa380429128fb70501720cec55909ebb96
Add python example how to use Handle.download_packages()
cgwalters/librepo,bgamari/librepo,Conan-Kudo/librepo,bgamari/librepo,rpm-software-management/librepo,Conan-Kudo/librepo,rpm-software-management/librepo,rholy/librepo,cgwalters/librepo,cgwalters/librepo,cgwalters/librepo,Tojaj/librepo,Tojaj/librepo,rholy/librepo,Conan-Kudo/librepo,rholy/librepo,rpm-software-management/l...
examples/python/download_packages.py
examples/python/download_packages.py
#!/usr/bin/env python """ librepo - download packages """ import librepo if __name__ == "__main__": # Setup logging def debug_function(msg, _): print msg librepo.set_debug_log_handler(debug_function) # Prepare handle h = librepo.Handle() h.url = "http://beaker-project.org/yum/client...
lgpl-2.1
Python
b20305889166f9354a7bb8a146d695e5d98a28f3
Fix zlib %pgi build (#3436)
TheTimmy/spack,iulian787/spack,skosukhin/spack,TheTimmy/spack,TheTimmy/spack,mfherbst/spack,krafczyk/spack,LLNL/spack,krafczyk/spack,LLNL/spack,EmreAtes/spack,tmerrick1/spack,EmreAtes/spack,krafczyk/spack,matthiasdiener/spack,mfherbst/spack,lgarren/spack,skosukhin/spack,EmreAtes/spack,EmreAtes/spack,TheTimmy/spack,tmer...
var/spack/repos/builtin/packages/zlib/package.py
var/spack/repos/builtin/packages/zlib/package.py
############################################################################## # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
############################################################################## # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
lgpl-2.1
Python
0433837c615381890df8d80929d8ad5e8b231ab6
Fix unicode handling in listdir.
crawln45/Flexget,cvium/Flexget,ratoaq2/Flexget,jacobmetrick/Flexget,jacobmetrick/Flexget,jawilson/Flexget,ibrahimkarahan/Flexget,vfrc2/Flexget,drwyrm/Flexget,Danfocus/Flexget,LynxyssCZ/Flexget,jawilson/Flexget,Flexget/Flexget,LynxyssCZ/Flexget,antivirtel/Flexget,dsemi/Flexget,LynxyssCZ/Flexget,Danfocus/Flexget,dsemi/Fl...
flexget/plugins/input/listdir.py
flexget/plugins/input/listdir.py
"""Plugin for filesystem tasks.""" from __future__ import unicode_literals, division, absolute_import import os import logging from path import path from flexget import plugin from flexget.entry import Entry from flexget.event import event from flexget.config_schema import one_or_more log = logging.getLogger('listdi...
"""Plugin for filesystem tasks.""" from __future__ import unicode_literals, division, absolute_import import os import logging from flexget import plugin from flexget.entry import Entry from flexget.event import event log = logging.getLogger('listdir') class Listdir(object): """ Uses local path content as a...
mit
Python
c5723be490b5baf953de71a6af778fe5663c70ed
Add the API available inside GenTests method for the raw_io module.
eunchong/build,eunchong/build,eunchong/build,eunchong/build
scripts/slave/recipe_modules/raw_io/test_api.py
scripts/slave/recipe_modules/raw_io/test_api.py
from slave import recipe_test_api class RawIOTestApi(recipe_test_api.RecipeTestApi): # pragma: no cover @recipe_test_api.placeholder_step_data @staticmethod def output(data, retcode=None): return data, retcode
bsd-3-clause
Python
bd24b2114276888afd86189fada7aa6b3e2716d7
Gather cpu infomation
henry-zhang/Cmdb_Puppet,sdgdsffdsfff/Cmdb_Puppet
gethostinfo/cpuinfo.py
gethostinfo/cpuinfo.py
#!/home/python/bin/python #-*- coding:utf-8 -*- from subprocess import PIPE,Popen import re def getCpuInfo(): p = Popen(['cat','/proc/cpuinfo'],shell=False,stdout=PIPE) stdout, stderr = p.communicate() return stdout.strip() def parserCpuInfo(cpudata): pd = {} model_name = re.compile(r'.*model nam...
epl-1.0
Python
3ea852ab7819593cc2daa870a0e631bfdddbdb23
Create bcadextract.py
alejandrorbraun/BCAD_Extract
src/bcadextract.py
src/bcadextract.py
mit
Python
101d265778633f5f4cbe15013ab8c5cc3c9f3789
Add stopwords
explosion/spaCy,spacy-io/spaCy,spacy-io/spaCy,spacy-io/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy
spacy/lang/ky/stop_words.py
spacy/lang/ky/stop_words.py
# encoding: utf8 from __future__ import unicode_literals # Tatar stopwords are from https://github.com/aliiae/stopwords-tt STOP_WORDS = set( """ ага адам айтты айтымында айтып ал алар алардын алган алуу алып анда андан аны анын ар бар басма баш башка башкы башчысы берген биз билдирген билдирди бир биринчи бирок бишк...
mit
Python
6644fe54292801587924ed80e50c299361b600df
Add PTB words dataset
chainer/chainer,hvy/chainer,cupy/cupy,wkentaro/chainer,hvy/chainer,niboshi/chainer,ktnyt/chainer,chainer/chainer,jnishi/chainer,ronekko/chainer,keisuke-umezawa/chainer,okuta/chainer,okuta/chainer,hvy/chainer,aonotas/chainer,kashif/chainer,cupy/cupy,kikusu/chainer,rezoo/chainer,niboshi/chainer,keisuke-umezawa/chainer,wk...
chainer/dataset/datasets/ptb.py
chainer/dataset/datasets/ptb.py
import os import numpy from chainer.dataset import download def get_ptb_words_training(): """Gets the Penn Tree Bank training dataset as one long word sequence. `Penn Tree Bank <https://www.cis.upenn.edu/~treebank/>`_ is originally a corpus of English sentences with linguistic structure annotations. Th...
mit
Python
f93a801a7951f2ee1a59b536608e13928aa60102
Add simple test for the createdb script
lorenzogil/yith-library-server,lorenzogil/yith-library-server,lorenzogil/yith-library-server
yithlibraryserver/scripts/tests/test_createdb.py
yithlibraryserver/scripts/tests/test_createdb.py
# Yith Library Server is a password storage server. # Copyright (C) 2015 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com> # # This file is part of Yith Library Server. # # Yith Library Server is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as publ...
agpl-3.0
Python
8ddd00a0c5986a95c84fe146540184b122de07fc
Add stub interpreter
uwescience/raco,uwescience/raco,uwescience/raco,uwescience/raco,uwescience/raco
raco/myrial/interpreter.py
raco/myrial/interpreter.py
#!/usr/bin/python import raco.myrial.parser as parser import raco.algebra import raco.catalog import collections import random import sys import types class ExpressionProcessor: '''Convert syntactic expressions into a relational algebra operation''' def __init__(self, symbols): self.symbols = symbols...
bsd-3-clause
Python
df5dbfa3dd7eeb4235dfdbf0ef9ad2da199232ce
Add task_handler.py
Samuel-L/cli-ws,Samuel-L/cli-ws
web_scraper/task_handler.py
web_scraper/task_handler.py
import os import sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import csv def _create_task_file(name): """Create a taskfile :param str name: the name of the taskfile """ with open(f'{name}.taskfile.csv', 'w', newline='') as taskfile: writer = csv.writer(taskfile, delimiter=...
mit
Python
da921528c170feb3f1fe66311e2ecf81a6606fd9
modify docstrings in __init__.py
k2kobayashi/sprocket
sprocket/speech/__init__.py
sprocket/speech/__init__.py
# -*- coding: utf-8 -*- from __future__ import division, print_function, absolute_import import pysptk import pyworld import numpy as np from .analyzer import WORLD from .parameterizer import spgram2npow class FeatureExtractor(object): """Analyze and synthesize acoustic features from a waveform Extract s...
mit
Python
b883aa66777bfccec5190c73c5287b3d29750dd6
Add a __main__.py to enable 'python -m pip' on Python 2.7+. Thanks Alexey Luchko.
Gabriel439/pip,willingc/pip,qbdsoft/pip,pjdelport/pip,zorosteven/pip,nthall/pip,wkeyword/pip,zorosteven/pip,mujiansu/pip,caosmo/pip,ChristopherHogan/pip,prasaianooz/pip,Gabriel439/pip,zenlambda/pip,minrk/pip,squidsoup/pip,sigmavirus24/pip,esc/pip,techtonik/pip,qbdsoft/pip,James-Firth/pip,fiber-space/pip,luzfcb/pip,rbtc...
__main__.py
__main__.py
if __name__ == '__main__': import sys from . import main exit = main() if exit: sys.exit(exit)
mit
Python
42216f3b4431a50feac7066fd77041cafac29aef
Create workyTracking.py
MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab
home/GroG/workyTracking.py
home/GroG/workyTracking.py
useVirtualArduino = True; xPin = 9; yPin = 6; arduinoPort = "COM5"; cameraIndex = 0; # using Sarxos for usb webcam, the other frame grabbers only worked on my integrated camera frameGrabberType = "org.myrobotlab.opencv.SarxosFrameGrabber"; Runtime.start("gui", "SwingGui"); if useVirtualArduino: virtual = Runtime.st...
apache-2.0
Python
08e97348bb23b7667916e3bfef88ffe8769db60b
Add nCloth menu
minoue/miExecutor
module/FX/nCloth.py
module/FX/nCloth.py
from maya import cmds from maya import mel class Commands(object): """ class name must be 'Commands' """ commandDict = {} def _createNcloth(self): mel.eval("doCreateNCloth 0") commandDict['createNcloth'] = "nClothCreate.png" def _createNclothOptions(self): cmds.nClothCreateOptio...
mit
Python
7f46b3801f641d6721644ec44d1c3f028f73959c
use stack
zhuxiang/LeetCode-Python
src/20-ValidParentheses.py
src/20-ValidParentheses.py
class Solution(object): def isValid(self, s): """ :type s: str :rtype: bool """ stack = [] for c in s: if c in ['(', '{', '[']: stack.append(c) continue elif c == ')': if len(stack) > 0 and stack[...
apache-2.0
Python
26d208806e76a14325ceb3e365baefbc05c79e49
add split_image_numpy
Akagi201/learning-opencv
image/split_image_numpy.py
image/split_image_numpy.py
#!/usr/bin/env python import cv2 import numpy img = cv2.imread("akhead.jpg") b = numpy.zeros((img.shape[0], img.shape[1]), dtype=img.dtype) g = numpy.zeros((img.shape[0], img.shape[1]), dtype=img.dtype) r = numpy.zeros((img.shape[0], img.shape[1]), dtype=img.dtype) b[:, :] = img[:, :, 0] g[:, :] = img[:, :, 1] r[:,...
mit
Python
836f23046a25edbdeafcbe487fa9f918a9bae5cb
Add py2exe setup file for creating windows executables
sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia
Sketches/JT/Jam/application/trunk/setup_py2exe.py
Sketches/JT/Jam/application/trunk/setup_py2exe.py
#!/usr/bin/env python # # (C) 2008 British Broadcasting Corporation and Kamaelia Contributors(1) # All Rights Reserved. # # You may only modify and redistribute this under the terms of any of the # following licenses(2): Mozilla Public License, V1.1, GNU General # Public License, V2.0, GNU Lesser General Pub...
apache-2.0
Python
72f1a3794d3aff57c804f21bcdca82d239e3e8c1
add script to populate db
AssuRFID/assurpid
src/createdb.py
src/createdb.py
#!/usr/bin/env python # A simple program to create a new db for assurpid and/or populate it with cards import sqlite3 import nfc # Function to wait for an return a single tag UID. Returns a string. def get_tag(): context = nfc.init() pnd = nfc.open(context) if pnd is None: print('ERROR: Unable to ...
bsd-2-clause
Python
f70110ae631b96762c04f3ce29d7eb5d7ed62d21
Update utils.py
Tendrl/commons,rishubhjain/commons,r0h4n/commons
tendrl/commons/central_store/utils.py
tendrl/commons/central_store/utils.py
import datetime from tendrl.commons.etcdobj import fields def to_etcdobj(cls_etcd, obj): for attr, value in vars(obj).iteritems(): if value is None: continue if attr.startswith("_"): continue if attr in ["attrs", "enabled", "obj_list", "obj_value", "atoms", ...
import datetime from tendrl.commons.etcdobj import fields def to_etcdobj(cls_etcd, obj): for attr, value in vars(obj).iteritems(): if value is None: continue if attr.startswith("_"): continue if attr in ["attrs", "enabled", "obj_list", "obj_value", "atoms", ...
lgpl-2.1
Python
df521799f05c99b0f79c0f8e014fa946439bdba6
Create vnet.py
pathakvaidehi2391/WorkSpace,pathakvaidehi2391/WorkSpace
azure/vnet.py
azure/vnet.py
######## # Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
apache-2.0
Python
93b9af641decff4e64f5c58eccac195eeae4836e
enable CMake build (with HTTP/3) -- take 2
facebook/folly,facebook/folly,facebook/folly,facebook/folly,facebook/folly
build/fbcode_builder/specs/proxygen_quic.py
build/fbcode_builder/specs/proxygen_quic.py
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import specs.folly as folly import specs.fizz as fizz import specs.mvfst as mvfst import specs.so...
apache-2.0
Python
4b769d21860556235e3df5d5dfffbdff3795fd80
Add decorators file
globality-corp/microcosm-flask,globality-corp/microcosm-flask
microcosm_flask/decorators/logging.py
microcosm_flask/decorators/logging.py
""" Audit log control decorators. """ from functools import wraps from flask import g def hide(*keys): """ Hide a set of request and/or response fields from logs. Example: @hide("id") def create_foo(): return Foo(id=uuid4()) """ def decorator(func): @wraps(...
apache-2.0
Python
bf0fa23e960486362e99dfa3f1b605f606933815
Create Trapping_Rain_Water.py
UmassJin/Leetcode
Array/Trapping_Rain_Water.py
Array/Trapping_Rain_Water.py
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. For example, Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6. The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain wate...
mit
Python
fecbaf30cadcf02b44f920116edea3c5de94ba4e
Add solution for exercise 4.3
igoroya/igor-oya-solutions-cracking-coding-interview
crackingcointsolutions/chapter4/exercisethree.py
crackingcointsolutions/chapter4/exercisethree.py
''' Created on 30 Aug 2017 @author: igoroya ''' import collections from chapter4 import utils def make_lists(root_node): stack = collections.deque() node_i = 1 lists = [] node = root_node stack.append(node) while len(stack) > 0: node = stack.pop() add_list(lists, node_i, nod...
mit
Python
b08bff9fdda4781adf07648448ecc6e9d71939ef
Add import_jms_articles journal command
BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway
src/utils/management/commands/import_jms_articles.py
src/utils/management/commands/import_jms_articles.py
from django.core.management.base import BaseCommand from utils import importer from django.core.management import call_command class Command(BaseCommand): """Takes a Ubiquity Press journal and lists articles in the backend.""" help = "List articles in the backend of a Ubiquity Press journal." def add_...
agpl-3.0
Python
5b61586925ce517bc31a02e58699c967f4d4d3be
Add missed migration
xdevelsistemas/taiga-back-community,xdevelsistemas/taiga-back-community,Rademade/taiga-back,dayatz/taiga-back,Rademade/taiga-back,Rademade/taiga-back,taigaio/taiga-back,Rademade/taiga-back,Rademade/taiga-back,taigaio/taiga-back,xdevelsistemas/taiga-back-community,dayatz/taiga-back,dayatz/taiga-back,taigaio/taiga-back
taiga/projects/migrations/0039_auto_20160322_1157.py
taiga/projects/migrations/0039_auto_20160322_1157.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-03-22 11:57 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('projects', '0038_auto_20160215_1133'), ] operations = [ migrations.AlterFiel...
agpl-3.0
Python
748e865c662f64f5c1e1448f5fbd35e1f02e408f
Add a bot using the MDL CSV updates feed, producing mdlrssbot style output. Name the bot independently of the source format (be it CSV or XML or whatever).
abusesa/abusehelper
abusehelper/contrib/malwaredomainlist/updates.py
abusehelper/contrib/malwaredomainlist/updates.py
import time import socket import urllib import idiokit from abusehelper.core import utils, bot, events def parse_valid(value, badset=frozenset(["", "-"])): if value.strip() in badset: return None return value def parse_timestamp(value, in_format="%Y/%m/%d_%H:%M", out_format="%Y-%m-%d %H:%M:%SZ"): ...
mit
Python
a01e6280ebcfda2d4c4e8b0df7cb80029599ff8c
Create bike_spark.py
cc3613/Spark_Fremont_Bridge_Analysis
bike_spark.py
bike_spark.py
import csv from StringIO import StringIO #use this nice library to find spark's location import findspark #import pyspark from pyspark import SparkConf, SparkContext #libs dealing with date format from datetime import datetime import dateutil.parser as dparser #for plotting import matplotlib.pyplot as plt spark_home=...
apache-2.0
Python
731cd919c168d17f8f495493a2870942177d9505
Add ipython config file.
jeffbuttars/env,jeffbuttars/env,jeffbuttars/env
src/dotfiles/.config/ipython/profile_default/ipython_config.py
src/dotfiles/.config/ipython/profile_default/ipython_config.py
c.InteractiveShellApp.exec_lines = [] c.InteractiveShellApp.exec_lines.append('%load_ext autoreload') c.InteractiveShellApp.exec_lines.append('%autoreload 2')
mit
Python
1dba6d3be1ce8e5f3b37239f3702dad92cb7ec97
add clean deplyment_settings for dist
avlach/univbris-ocf,avlach/univbris-ocf,avlach/univbris-ocf,avlach/univbris-ocf
src/python/openflow/optin_manager/deployment_settings_clean.py
src/python/openflow/optin_manager/deployment_settings_clean.py
# Django settings for OM project. from os.path import dirname, join import sys DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ('<your name>', '<your email>'), ) # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices m...
bsd-3-clause
Python
fad392fd67aa858f92659ab94ca1c190898d4951
Add a header to burp response
kelath/Burp-Extensions
add_csp_header.py
add_csp_header.py
# Burp extension to add CSP headers to responses __author__ = 'jay.kelath' # setup Imports from burp import IBurpExtender from burp import IHttpListener from burp import IHttpRequestResponse from burp import IResponseInfo # Class BurpExtender (Required) contaning all functions used to interact with Burp Suite API cla...
mit
Python
2346a224d2ab4aa781f3b40b708f5f03061bd2ba
Add back helper script
ruffsl/docker_images,ruffsl/docker_images
ros2/create_dockerfiles.py
ros2/create_dockerfiles.py
#!/usr/bin/env python3 import os import sys import yaml try: from cStringIO import StringIO except ImportError: from io import StringIO from em import Interpreter from docker_templates.argparse import DockerfileArgParser from docker_templates.create import create_files from docker_templates.collections impor...
apache-2.0
Python
5c8df62af8a2642d4956ac7dbaa69a3d7a4287eb
Add Chabelo's game
maumg1196/PythonRandomExercices
adivina_precio.py
adivina_precio.py
"""Codigo para el juego de Chabelo""" import random """Declaramos 3 listas La primera será la que le quitemos valores La segunda será nuestra guia y siempre tendrá el valor original Y la tercera será la que el usuario vaya armando""" sala = [5, 1, 8, 3, 'x'] sala_show = [5, 1, 8 ,3] sala_user = ['o', 'o', 'o'...
mit
Python
c475d3cd3370fa378608c3cd6c1c5a7aa950fb87
implement phrase_prob
kenkov/smt
jec_basic_sentence/test.py
jec_basic_sentence/test.py
#! /usr/bin/env python # coding:utf-8 from __future__ import division, print_function from pprint import pprint import sys sys.path.append("../") import decode if __name__ == '__main__': e = u"I" f = u"は" prob = decode.phrase_prob(e, f, trans="en2ja", db_name=":jec_basic:") pprint(prob)
mit
Python
29a9a8c84387b154391cab7203b69ac6cd73d9ab
Create RestToPython.py
sstocker46/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab
home/GroG/RestToPython.py
home/GroG/RestToPython.py
webgui = Runtime.start("webgui","WebGUI") def callBack(data) print("callBack was called with data=", data)
apache-2.0
Python
c53f64694346f33c25a1e12c5fcd182d2d18f89e
Add script to generate readable ragnarok deltas.
slamdata/slamengine,drostron/quasar,quasar-analytics/quasar,drostron/quasar,drostron/quasar,jedesah/Quasar,slamdata/quasar,quasar-analytics/quasar,drostron/quasar,slamdata/slamengine,quasar-analytics/quasar,jedesah/Quasar,djspiewak/quasar,jedesah/Quasar,jedesah/Quasar,slamdata/slamengine,quasar-analytics/quasar
scripts/delta.py
scripts/delta.py
import json import sys def main(): if len(sys.argv) > 1: f = open(sys.argv[1], "r") else: f = sys.stdin run = json.load(f) for test in run: if test[u'delta'] != 'insignificant' and u'query' in test: print u"-----------------------------------------------------------...
apache-2.0
Python
e142d7ec83d9b5896a741a84ff5148f300254d89
Add basic unit test for cubic interpolation
jrg365/gpytorch,jrg365/gpytorch,jrg365/gpytorch
test/util/test_cubic_interpolation.py
test/util/test_cubic_interpolation.py
import torch from gpytorch.utils.interpolation import Interpolation from gpytorch import utils def test_interpolation(): x = torch.linspace(0.01, 1, 100) grid = torch.linspace(-0.05, 1.05, 50) J, C = Interpolation().interpolate(grid, x) W = utils.index_coef_to_sparse(J, C, len(grid)) test_func_gri...
mit
Python
5467aaf6f52e68c07f2ea0faf624b40bc1ab9ae8
solve the_time_in_word.py
osamadel/Hacker-Rank
Implementation/the_time_in_words.py
Implementation/the_time_in_words.py
''' PROBLEM LINK: https://www.hackerrank.com/challenges/the-time-in-words/problem ''' import math import os import random import re import sys # Complete the timeInWords function below. def timeInWords(h, m): minute_numbers = ["o' clock", 'one', 'two', 'three', 'four', 'five', 'six', 'seven', ...
mit
Python
ba251567b18e61ee564c43bd5e926c64255d3932
Use absolute import for python2 compatibility
ivelum/django-dirtyfields,romgar/django-dirtyfields,public/django-dirtyfields,smn/django-dirtyfields,ActivKonnect/django-dirtyfields,jdotjdot/django-dirtyfields
src/dirtyfields/__init__.py
src/dirtyfields/__init__.py
from __future__ import absolute_import from dirtyfields.dirtyfields import DirtyFieldsMixin
from dirtyfields.dirtyfields import DirtyFieldsMixin
bsd-3-clause
Python
2ab45dd5bc256dfe597ec80b694fdcd190c9d16a
Create script.py
JohnLi2012/LitigationSupport,JohnLi2012/LitigationSupport
Scripts/identify_begbates/script.py
Scripts/identify_begbates/script.py
##Instruction of use ## ##Senario: you get a reference of a list of bates numbers with some information which happen to be page bates. ##You need to overlay the information into database being Relativity, Concordance or whatever. Since most system is document level, ##you will have to find out the corresponding begbate...
mit
Python
014096616d8263ea96b5b8a2b7926b498f02b425
Add script for writing defaults from a directory of patch dictionaries.
douglashill/OS-X-setup,douglashill/OS-X-setup
setupdefaults.py
setupdefaults.py
#! /usr/bin/python # Encoding: utf-8 import json import os import re import subprocess import sys class TypeMapping: def __init__(self, py_types, type_string, value_transformer): self.py_types = py_types self.type_string = type_string self.value_transformer = value_transformer def map_type(value): # Unsuppor...
mit
Python
4fb255cf41d367cd8cc16a0e2d090f1c0733aa84
add bash8 tool (like pep8, but way hackier)
vishnugonela/devstack,varunarya10/devstack,bigswitch/devstack,wenhuizhang/devstack,bigswitch/devstack,olivierlemasle/devstack,noironetworks/devstack,eharney/devstack,bswartz/devstack,Millnert/contrail-devstack,pczerkas/devstack,dirkmueller/devstack,thomasem/devstack,BSJAIN92/OpenStack,thomasem/devstack,atulpatil301/dev...
tools/bash8.py
tools/bash8.py
#!/usr/bin/env python # # 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, software...
apache-2.0
Python
7ac443caa010747d0e71d97630f4fd71ecb1638f
Add utilization reporting
stevelle/jenkins-meter
utilization.py
utilization.py
import requests import argparse PATH = '%s/computer/%s/api/json?depth=3' def main(args): r = requests.get(PATH % (args.host_url, args.node)) r.raise_for_status() body = r.json() busy_history = body['loadStatistics']['busyExecutors']['hour']['history'] total_history = body['loadStatistics']['tota...
apache-2.0
Python
ec9f2fe33b1b8590322ab189ba71eacc856b4cc0
Add example code.
kipe/miplant
example.py
example.py
# -*- encoding: utf-8 -*- from miplant import MiPlant for plant in MiPlant.discover(device='hci1', timeout=5): print('Address: %s' % plant.address) print('Temperature: %.02f °C' % plant.temperature) print('Light: %i lx' % plant.light) print('Moisture: %i%%' % plant.moisture) print('Conductivity: %i...
mit
Python
7d048519deac39b47d1a5212af6275047232005f
Add //third-party/boost
clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage
shipyard2/rules/third-party/boost/build.py
shipyard2/rules/third-party/boost/build.py
"""Build Boost from source.""" import json import logging from pathlib import Path import foreman from g1 import scripts from g1.bases.assertions import ASSERT import shipyard2.rules.bases LOG = logging.getLogger(__name__) shipyard2.rules.bases.define_archive( # pylint: disable=line-too-long url= 'htt...
mit
Python
2417504b065f4e1d90f8c76c53acbd243249545a
add missing file in joblib
simon-pepin/scikit-learn,raghavrv/scikit-learn,Adai0808/scikit-learn,0asa/scikit-learn,ephes/scikit-learn,r-mart/scikit-learn,lin-credible/scikit-learn,Akshay0724/scikit-learn,themrmax/scikit-learn,theoryno3/scikit-learn,LohithBlaze/scikit-learn,nrhine1/scikit-learn,jzt5132/scikit-learn,btabibian/scikit-learn,ldirer/sc...
sklearn/externals/joblib/test/test_disk.py
sklearn/externals/joblib/test/test_disk.py
""" Unit tests for the disk utilities. """ # Authors: Gael Varoquaux <gael dot varoquaux at normalesup dot org> # Lars Buitinck <L.J.Buitinck@uva.nl> # Copyright (c) 2010 Gael Varoquaux # License: BSD Style, 3 clauses. from __future__ import with_statement import os import shutil import array from tempfile ...
bsd-3-clause
Python
af2c9c5cc67297699c381f30d6273927a4c14867
solve 1 problem
Shuailong/Leetcode
solutions/binary-tree-inorder-traversal.py
solutions/binary-tree-inorder-traversal.py
#!/usr/bin/env python # encoding: utf-8 """ binary-tree-inorder-traversal.py Created by Shuailong on 2016-05-28. https://leetcode.com/problems/binary-tree-inorder-traversal/. """ '''Understand the iterative procedure.''' # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): ...
mit
Python
99ee6ecfa4bafbfd66a3cb2c2315a8daeeff3023
Add support for extracting a UFO from a UFO. It sounds silly, but it is useful.
typesupply/extractor,typemytype/extractor,anthrotype/extractor
Lib/extractor/formats/ufo.py
Lib/extractor/formats/ufo.py
import os from robofab.ufoLib import UFOReader # ---------------- # Public Functions # ---------------- def isUFO(pathOrFile): if not isinstance(pathOrFile, basestring): return False if os.path.splitext(pathOrFile)[-1].lower() != ".ufo": return False if not os.path.isdir(pathOrFile): ...
mit
Python
5a6759b131e4a61f9e7e4aaebb190a7e04b28b00
Update script to export colormaps
derherrg/js-colormaps,derherrg/js-colormaps
create-colormaps.py
create-colormaps.py
""" Export colormaps from Python / matplotlib to JavaScript. """ # ----------------------------------------------------------------------------- # IMPORTS # ----------------------------------------------------------------------------- import json from matplotlib.colors import Colormap import matplotlib.cm as cm imp...
mit
Python
95644cfa2efee2dbb678c4581d0185c780ba84e4
Create E_Atmospheric_conditions.py
Herpinemmanuel/Oceanography
Cas_4/E_Atmospheric_conditions.py
Cas_4/E_Atmospheric_conditions.py
import numpy as np import matplotlib.pyplot as plt import cartopy.crs as ccrs from xmitgcm import open_mdsdataset from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER dir0 = '/homedata/bderembl/runmit/test_southatlgyre3' ds0 = open_mdsdataset(dir0,iters='all',prefix=['cheapAML']) # Average of A...
mit
Python
2cdcff490f69e3b72b97e40e8390722745d37dd7
Add script to sync CWA borders
akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem
scripts/util/cwa_update.py
scripts/util/cwa_update.py
""" My purpose in life is to take the NWS AWIPS Geodata CWA Shapefile and dump them into the PostGIS database! I was bootstraped like so: """ from osgeo import ogr from osgeo import _ogr import psycopg2 import sys import os import datetime import pytz import urllib2 import zipfile POSTGIS = psycopg2.connect(database...
mit
Python
958d92b15525be0dc24c51adb7ce0fb84c95dc14
drop unused import
common-workflow-language/common-workflow-language,common-workflow-language/cwltool,SciDAP/cwltool,common-workflow-language/common-workflow-language,SciDAP/cwltool,chapmanb/cwltool,dleehr/cwltool,hmenager/common-workflow-language,hmenager/common-workflow-language,dleehr/cwltool,jeremiahsavage/cwltool,jeremiahsavage/cwlt...
draft-3/draft-3/search.py
draft-3/draft-3/search.py
#!/usr/bin/env python # Toy program to search inverted index and print out each line the term # appears. import sys mainfile = sys.argv[1] indexfile = sys.argv[1] + ".idx1" term = sys.argv[2] main = open(mainfile) index = open(indexfile) st = term + ": " for a in index: if a.startswith(st): n = [int(i...
#!/usr/bin/env python # Toy program to search inverted index and print out each line the term # appears. import sys import os mainfile = sys.argv[1] indexfile = sys.argv[1] + ".idx1" term = sys.argv[2] main = open(mainfile) index = open(indexfile) st = term + ": " for a in index: if a.startswith(st): ...
apache-2.0
Python
9556a19e9ec4533e56cb55243f2a6ec10c701d27
Create monitor.py
saycel/saycel,saycel/saycel,saycel/saycel,saycel/saycel,saycel/saycel
bin/monitor.py
bin/monitor.py
import sys from collections import Counter ar = [] with open(sys.argv[1]) as f: for line in f: if "Close Channel sofia/internal/sip:" in line: nl=line.split('301087') number = nl[1].split('@')[0] ar.append(number) print Counter(ar)
agpl-3.0
Python
c0a0300b91be2ecc3024d79728c954a0a9699455
Add Redis storage engine
prophile/jacquard,prophile/jacquard
jacquard/storage/redis.py
jacquard/storage/redis.py
from .base import KVStore, Retry class RedisStore(KVStore): def __init__(self, connection_string): # Lazily import Redis import redis self.redis = redis.StrictRedis.from_url(connection_string) self.prefix = 'jacquard:' def begin(self): pass def rollback(self): ...
mit
Python
0112ea282f540256bef9230b5a3ff58fe1a19f3c
add script to load users from csv file
yongwen/makahiki,jtakayama/ics691-setupbooster,jtakayama/ics691-setupbooster,yongwen/makahiki,justinslee/Wai-Not-Makahiki,csdl/makahiki,jtakayama/makahiki-draft,csdl/makahiki,yongwen/makahiki,jtakayama/makahiki-draft,jtakayama/ics691-setupbooster,csdl/makahiki,csdl/makahiki,jtakayama/makahiki-draft,jtakayama/makahiki-d...
apps/components/makahiki_base/management/commands/load_users.py
apps/components/makahiki_base/management/commands/load_users.py
from django.core import management from django.contrib.auth.models import User from apps.components.floors.models import Floor class Command(management.base.BaseCommand): help = 'load and create the users from a csv file containing lounge, name, and email' def handle(self, *args, **options): """ Resets th...
mit
Python
ccb156921a58b3e5f0a189a21fe2c3b853ffc59d
add kmer histogram plotter
tanghaibao/jcvi,sgordon007/jcvi_062915
assembly/kmers.py
assembly/kmers.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ Deals with K-mers and K-mer distribution from reads or genome """ import sys from optparse import OptionParser from jcvi.utils.iter import pairwise from jcvi.graphics.base import plt, _ from jcvi.apps.base import ActionDispatcher, debug debug() def main(): ac...
bsd-2-clause
Python
5fa630f7f599c733067f4e9ea19ee2ec06c24c06
move LeaveOneOutCrossValidator to PythonCommon
istb-mia/miapy
evaluation/validation.py
evaluation/validation.py
""" This module holds classes related to validation. """ class LeaveOneOutCrossValidator: """ Represents a leave-one-out cross-validation. """ def __init__(self, n: int): """ Initializes a new instance of the LeaveOneOutCrossValidator class. :param n: The number of samples. ...
apache-2.0
Python
5138a4c43955becf1682604591489d38ec6f3d6a
add auto-test
mick-d/nipype,mick-d/nipype,mick-d/nipype,mick-d/nipype
nipype/interfaces/afni/tests/test_auto_Undump.py
nipype/interfaces/afni/tests/test_auto_Undump.py
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from __future__ import unicode_literals from ..utils import Undump def test_Undump_inputs(): input_map = dict(args=dict(argstr='%s', ), coordinates_specification=dict(argstr='-%s', ), datatype=dict(argstr='-datum %s', ), default_value=d...
bsd-3-clause
Python
3c3d6063c75ccacbe6df398720bc8404157ddd5e
fix leftover from refs cleanup
clld/glottolog3,clld/glottolog3
migrations/versions/53f4e74ce460_fix_providers_str.py
migrations/versions/53f4e74ce460_fix_providers_str.py
# coding=utf-8 """fix providers_str Revision ID: 53f4e74ce460 Revises: 176e169bf976 Create Date: 2014-06-30 19:27:16.307718 """ # revision identifiers, used by Alembic. revision = '53f4e74ce460' down_revision = '176e169bf976' import datetime from alembic import op import sqlalchemy as sa def upgrade(): op.ex...
mit
Python
684519b5a3831406d0dc26b63ab7017eef6c87f2
Add tests file with passing model tests.
flegald/Gameini,flegald/Gameini,flegald/Gameini
gameini/game_app/test.py
gameini/game_app/test.py
"""Tests file.""" from django.test import TestCase from .models import GameModel import factory # Model Tests class GameFactory(factory.django.DjangoModelFactory): """Create test game model.""" class Meta: """Meta.""" model = GameModel title = factory.sequence(lambda n: 'title{}'.forma...
mpl-2.0
Python
bceb5d8fde72edb560efa9eaac0a3d96fce9c27c
Purge broadcast data
alphagov/notifications-api,alphagov/notifications-api
migrations/versions/0329_purge_broadcast_data.py
migrations/versions/0329_purge_broadcast_data.py
""" Revision ID: 0329_purge_broadcast_data Revises: 0328_international_letters_perm Create Date: 2020-09-07 16:00:27.545673 """ from alembic import op revision = '0329_purge_broadcast_data' down_revision = '0328_international_letters_perm' def upgrade(): # ### commands auto generated by Alembic - please adjus...
mit
Python
974651717968885fd766f17ce942e77a15011253
Add tests for get_poll and save_poll.
praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go
go/apps/dialogue/tests/test_dialogue_api.py
go/apps/dialogue/tests/test_dialogue_api.py
"""Tests for go.apps.dialogue.dialogue_api.""" from twisted.internet.defer import inlineCallbacks from twisted.trial.unittest import TestCase from go.apps.dialogue.dialogue_api import DialogueActionDispatcher from go.vumitools.api import VumiApi from go.vumitools.tests.utils import GoAppWorkerTestMixin class Dialog...
bsd-3-clause
Python
e274c17ac8bc61d5e96fcab579b8ad07c3a48403
Allow stopping of all queueing threads and respond to keyboard interrupt in main
mrbrowning/queueing
queueing/resources.py
queueing/resources.py
""" queueing.resources ================== Utilities and resources for queueing. :author: Michael Browning :copyright: (c) 2013 by Michael Browning. :license: BSD, see LICENSE for more details. """ import threading class StoppableThread(threading.Thread): """A thread that exposes a stop ...
bsd-3-clause
Python
d5080d8c5e9dd19a38cb27318c82e3a35e78bb0d
Add simple `setup.py` script.
deepmind/android_env
google3/third_party/py/android_env/setup.py
google3/third_party/py/android_env/setup.py
"""Simple package definition for using with `pip`.""" from setuptools import setup description = """AndroidEnv Read the README at https://github.com/deepmind/android_env for more information. """ setup( name='AndroidEnv', version='1.0.0', description='AndroidEnv environment and library for training agent...
apache-2.0
Python
21522a2390e9eb204a81d6af41c90e26e66a1355
Create picubes.py
Cube-Controls/PiCubesPython
Python/picubes.py
Python/picubes.py
mit
Python
bd316bcd36fe73b2f2163b61ccadeea08dfa566c
document problematic data function lifetime
pymor/dune-gdt
python/test/segfault_laplace_integrand.py
python/test/segfault_laplace_integrand.py
from dune.xt.grid import Dim, Cube, make_cube_grid grid = make_cube_grid(Dim(1), [0], [1], [2]) d = grid.dimension from dune.xt.functions import ConstantFunction, GridFunction from dune.xt.la import Istl from dune.gdt import ContinuousLagrangeSpace, MatrixOperator, LocalElementIntegralBilinearForm, LocalLaplaceIntegr...
bsd-2-clause
Python
c90b73ff9b1b402275befd5301b6db2d1dfd789d
Create Intersection_of_Two_Linked_Lists.py
UmassJin/Leetcode
Array/Intersection_of_Two_Linked_Lists.py
Array/Intersection_of_Two_Linked_Lists.py
''' Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: A: a1 → a2 ↘ c1 → c2 → c3 ↗ B: b1 → b2 → b3 begin to intersect at node c1. Notes: If th...
mit
Python
475a573731de50695a12b8376d6f01ab155f5893
UPDATE Post model, published boolea field added
semitki/semitki,semitki/semitki,semitki/semitki,semitki/semitki
api/sonetworks/migrations/0029_post_published.py
api/sonetworks/migrations/0029_post_published.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-05-10 23:46 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('sonetworks', '0028_auto_20170509_0231'), ] operations = [ migrations.AddFie...
mit
Python
263cd80a16f44e900d939322e3e6e1ce0cea31b7
Add check_mk swift proxy diagnostic
rdo-management/tripleo-image-elements,radez/tripleo-image-elements,radez/tripleo-image-elements,rdo-management/tripleo-image-elements,openstack/tripleo-image-elements,openstack/tripleo-image-elements
elements/swift-proxy/check_mk_checks/swift_proxy_healthcheck.py
elements/swift-proxy/check_mk_checks/swift_proxy_healthcheck.py
#!/usr/bin/python # 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, software # dis...
apache-2.0
Python
0f88d80519a4efde0983115906cc78c59bd339e1
Add media type http negotiation utils
bameda/monarch.old,bameda/monarch.old,bameda/monarch.old,bameda/monarch.old
monarch/base/http/negotiation.py
monarch/base/http/negotiation.py
# Copyright (C) 2015 David Barragán <bameda@dbarragan.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # ...
agpl-3.0
Python
05faa84cc393320da6b3fba26cc7ac3bfe216b5e
add source
xeno1991/gflags2argparse
gflags2argparse.py
gflags2argparse.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import re import argparse PATTERN = re.compile("([^\s]+)\s+\((.+)\)\s+type: (.+)\s+default: (.+)") BOOL_CHOICES = ["y", "n", "1", "0", "true", "false"] def ParseFlag(flag): flag = flag.replace("\n", " ").strip() m = PATTERN.search(flag) return {k...
mit
Python
fe9146dfbdc99f90c385a77fbcc96b6e51b8dce9
Add back-propagation neural network
curiousily/ml,curiousily/ml
neural-network/neural_network.py
neural-network/neural_network.py
import numpy as np class NeuralNetwork: """Neural network using back-propagation algorithm""" layer_count = 0 shape = None weights = [] def __init__(self, layer_size): self.layer_count = len(layer_size) - 1 self.shape = layer_size self._layer_input = [] self._lay...
mit
Python
bcd4c97b58993233e5279eb8d5d3d0ac78fd28ea
add small test py.
ypochien/TaiwanStockBSR
TestGetOTCDate.py
TestGetOTCDate.py
# -*- coding: utf-8 -*- import urllib2,urllib import re def getOTCDate(Code): baseUrl = "http://www.gretai.org.tw/web/stock/aftertrading/broker_trading/brokerBS.php" postDataDict = { 'stk_code' : Code } postData = urllib.urlencode( postDataDict) req = urllib2.Request( baseUrl , postData) ...
mit
Python
1db91d6be7bc8a9e354ea605cf3588a4666addf2
Add brute force solution
lemming52/white_pawn,lemming52/white_pawn
leetcode/q015/solution.py
leetcode/q015/solution.py
""" Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: The solution set must not contain duplicate triplets. """ from typing import Dict, List class Solution: def threeSum(self, nums: ...
mit
Python
d34dad32170e53f49e14611f5bfbfcb4eb7b8d4d
Add script to generate fake data
H0neyBadger/cmdb,H0neyBadger/cmdb
extra/create_rand_host.py
extra/create_rand_host.py
import requests import json import random import uuid login="test" password="P@ssword" with open("dict", 'r', encoding="latin-1") as words : a = words.readlines() headers = { 'Content-type': 'application/json', 'Accept': 'application/json' } def gen_ip(): a = random.randint(1, 254) b = rando...
mit
Python
3feea0fab158555e24b47dc089c30761af87185e
Copy arp_probe.py to arp_announcement.py.
bluhm/arp-regress
arp_announcement.py
arp_announcement.py
#!/usr/local/bin/python2.7 # send Address Resolution Protocol probe # expect Address Resolution Protocol response and check all fields import os from addr import * from scapy.all import * arp=ARP(op='who-has', hwsrc=SRC_MAC, psrc="0.0.0.0", hwdst="00:00:00:00:00:00", pdst=DST_IN) eth=Ether(src=SRC_MAC, dst="ff:ff...
isc
Python
ef55dda353b497a8d7be3b81b37ca7547f56414b
Create acg_gamer_link_from_anime.py
Xi-Plus/Xiplus-Wikipedia-Bot,Xi-Plus/Xiplus-Wikipedia-Bot
my-ACG/import-claims/acg_gamer_link_from_anime.py
my-ACG/import-claims/acg_gamer_link_from_anime.py
# -*- coding: utf-8 -*- import argparse import importlib import os import sys os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__)) import pywikibot sys.path.append('..') animeSite = (importlib.import_module('util.ani_gamer_com_tw_animeVideo', 'AniGamerComTwAnimeVideo') .AniGamerComT...
mit
Python
0f2ef5a0eae40a24e50c10187606aa884faff728
Solve the Trailing String challenge
TommyN94/CodeEvalSolutions,TommyN94/CodeEvalSolutions
TrailingString.py
TrailingString.py
# Trailing String # # https://www.codeeval.com/open_challenges/32/ # # Challenge Description: There are two strings: A and B. Print 1 if string B # occurs at the end of string A. Otherwise, print 0. import sys def is_trailing_string(x, y): return x[-len(y):] == y if __name__ == '__main__': input_f...
mit
Python
b6495a68dd6e6f21f8cd61f8c0e06cfa0e976924
Add MongoStore class for #5 (collections in memory as dicts)
n8v-guy/slag,n8v-guy/slag,n8v-guy/slag,n8v-guy/slag
mongo_store.py
mongo_store.py
"""Just a converter from mongo collection to dictionary with _id as the key""" import collections import werkzeug.datastructures as datastruct PRIMARY_KEY = '_id' class MongoStore(collections.MutableMapping): """gets collection, creates dictionary, commit on changes""" @staticmethod def _make_dict(value)...
mit
Python
2986ca3ebd7562d9cb84f33598e17b3b9627f3a2
Add some unit tests for the diagonals.
amandersillinois/landlab,landlab/landlab,cmshobe/landlab,cmshobe/landlab,cmshobe/landlab,landlab/landlab,amandersillinois/landlab,landlab/landlab
landlab/grid/tests/test_diagonals.py
landlab/grid/tests/test_diagonals.py
#! /usr/bin/env python import numpy as np from nose.tools import assert_is, assert_is_instance from numpy.testing import assert_array_equal from landlab.grid.diagonals import create_nodes_at_diagonal def test_nodes_at_diagonal(): """Test tail and head nodes of diagonals.""" diagonals = create_nodes_at_diago...
mit
Python
5b74daf871be2f2a6628cb0d52e327fd722f9223
Add Alternate3 actor
EricssonResearch/calvin-base,EricssonResearch/calvin-base,les69/calvin-base,les69/calvin-base,les69/calvin-base,EricssonResearch/calvin-base,les69/calvin-base,EricssonResearch/calvin-base
calvin/actorstore/systemactors/std/Alternate3.py
calvin/actorstore/systemactors/std/Alternate3.py
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ericsson AB # # 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 ...
apache-2.0
Python
b13931e8f3bfdb5fc07172d8637a1944724440a1
Create challenge_0_pygame.py (#71)
DakRomo/2017Challenges,DakRomo/2017Challenges,mindm/2017Challenges,mindm/2017Challenges,erocs/2017Challenges,erocs/2017Challenges,DakRomo/2017Challenges,DakRomo/2017Challenges,erocs/2017Challenges,DakRomo/2017Challenges,DakRomo/2017Challenges,erocs/2017Challenges,DakRomo/2017Challenges,mindm/2017Challenges,popcornanach...
challenge_0/python/zanetti/challenge_0_pygame.py
challenge_0/python/zanetti/challenge_0_pygame.py
import pygame, sys #this part is to import the important modules from pygame.locals import * #To simplificate the functions on the code. WIth this, I can call functions from the module without writing the whole path/name pygame.init() #begins the game. This part is in all pygame codes. DISPLAYSURF = pygame.display.se...
mit
Python
bf9212f460879557977f4389e6b44e4cbd107c90
Create plot.py
doolanshire/Combat-Models
instructions1921/plot.py
instructions1921/plot.py
import seaborn as sns import matplotlib.pyplot as plt def strength_plot(side_a, side_b): """A simple line plot of the fighting strength of both sides of a naval engagement. Attributes: - sidedA / sideB: lists detailing the hit points of each side at every consecutive time pulse.""" sns.set_theme(...
mit
Python