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
e61d70de5d01e5a40a4c693386a45151db3d08c8
Add demo test module
depp/idiotest,depp/idiotest
selftest/demo.py
selftest/demo.py
# This test always passes @test def test_1(): if True == False: fail() # This test is always skipped @test("Test #2") def test_2(): skip() # Any callable object can be a test class MyTest(object): def __init__(self, message): self.message = message def __call__(self): fail(self...
bsd-2-clause
Python
bb326cfc8662055808c464d16cf844a850248555
add url file
resmio/django-sendgrid
sendgrid/urls.py
sendgrid/urls.py
from django.conf.urls import url import views urlpatterns = [ url(r'^sendgrid_callback/$', views.SendgridHook.as_view()), ]
bsd-2-clause
Python
df5919a375d85c8379ad0cee6c3c80c0bc2146ad
Add profiling script.
grollins/calm
scripts/profile_jump_penalty.py
scripts/profile_jump_penalty.py
import cProfile import pstats import os.path from calm.pandas_time_series import PandasTimeSeries from calm.pandas_calculator import PandasCalculator from calm.jump_penalty_denoiser import JumpPenaltyDenoiser def main(): noisy_ts = PandasTimeSeries() input_csv_path = os.path.join("..", "calm", "test_data", ...
bsd-2-clause
Python
4dce831c77e01e249a61dd82b371e94720b7a115
Create binding.gyp
cyrhla/tester,cyrhla/tester,cyrhla/tester
binding.gyp
binding.gyp
{ "targets": [ { "target_name": "type", "sources": [ "type.cc" ] } ] }
mit
Python
8f97a104bf988a277453bf70043829c45a394919
Add script attach device rbd
skylost/heap,skylost/heap,skylost/heap
libvirt/libvirt_attach_device_rbd.py
libvirt/libvirt_attach_device_rbd.py
#!/usr/bin/env python __author__ = 'weezhard' __license__ = 'GPL' __version__ = '1.0.0' import sys import argparse import libvirt import subprocess parser = argparse.ArgumentParser() parser.add_argument('-d','--domain', help='Domain libvirt',required=True) parser.add_argument('-p','--pool',help='Pool ceph', require...
apache-2.0
Python
1424918dad5d70bc3bba3dfb0b45fe03c4b23625
Add Flask-WTForms
jamesthechamp/HitchHike-1,mayank-agarwal-96/HitchHike,jamesthechamp/HitchHike-1,mayank-agarwal-96/HitchHike
HitchHike/User/forms.py
HitchHike/User/forms.py
from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, TextField, TextAreaField from wtforms.validators import DataRequired, Email, Length, EqualTo class LoginForm(FlaskForm): email = StringField('Email Address', validators=[DataRequired(), Email()]) password = PasswordField('Password'...
mit
Python
a20a1cc4ff34185fa1badf812f292c007f9f3d05
Add example for using Python in JS
zoofIO/flexx,JohnLunzer/flexx,JohnLunzer/flexx,zoofIO/flexx,jrversteegh/flexx,JohnLunzer/flexx,jrversteegh/flexx
flexx/ui/examples/using_python_in_js.py
flexx/ui/examples/using_python_in_js.py
# doc-export: UsingPython """ This example demonstrates what things from Python land can be used in JS. Flexx detects what names are used in the transpiled JS of a Model (or Widget class, and tries to look these up in the module, converting the used objects if possible. Check out the source of the generated page to s...
bsd-2-clause
Python
55271f54e12a14ef0d19238d0df07ab1d103f60c
add test for clipboard, closes #3360
MiyamotoAkira/kivy,tony/kivy,matham/kivy,rafalo1333/kivy,jffernandez/kivy,viralpandey/kivy,KeyWeeUsr/kivy,xiaoyanit/kivy,kived/kivy,andnovar/kivy,VinGarcia/kivy,bhargav2408/kivy,kivy/kivy,manthansharma/kivy,andnovar/kivy,LogicalDash/kivy,manthansharma/kivy,iamutkarshtiwari/kivy,rnixx/kivy,mSenyor/kivy,jegger/kivy,youpr...
kivy/tests/test_clipboard.py
kivy/tests/test_clipboard.py
import unittest class ClipboardTestCase(unittest.TestCase): def setUp(self): from kivy.core.clipboard import Clipboard self._clippy = Clipboard clippy_types = Clipboard.get_types() cliptype = clippy_types[0] if 'UTF8_STRING' in clippy_types: cliptype = 'UTF8_ST...
mit
Python
1d57715278f67a31c2dbff08cd890b1f89a573bb
Create nn.py
AndysDeepAbstractions/deep-learning,AndysDeepAbstractions/deep-learning,AndysDeepAbstractions/deep-learning
Miniflow/nn.py
Miniflow/nn.py
""" Have fun with the number of epochs! Be warned that if you increase them too much, the VM will time out :) """ import numpy as np from sklearn.datasets import load_boston from sklearn.utils import shuffle, resample from miniflow import * # Load data data = load_boston() X_ = data['data'] y_ = data['target'] # No...
mit
Python
36b5bb80ee91f99480146f2c7c96d27c051fac63
Add script to load 2018 candidates
softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat
lowfat/management/commands/load2018applications.py
lowfat/management/commands/load2018applications.py
import sys import traceback import urllib.request import pandas as pd from django.contrib.auth.models import User from django.core.files import File from django.core.management.base import BaseCommand from lowfat.models import Claimant class Command(BaseCommand): help = "Import CSV with 2018 applications." ...
bsd-3-clause
Python
a7afbf0099e5568b67984bef8bd5d9db9cd07557
Create ****ELECTION***.py
oranebeast/Homeguard
****ELECTION***.py
****ELECTION***.py
election=input
mit
Python
d5ec46b2a07e5365d4e753a90db160dddc8aab93
Copy from gist
langner/wok_search
wok_soap.py
wok_soap.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from suds.client import Client from suds.transport.http import HttpTransport import urllib2 class HTTPSudsPreprocessor(urllib2.BaseHandler): def __init__(self, SID): self.SID = SID def http_request(self, req): req.add_header('cookie', 'SID="'+self...
mit
Python
07fc7363b7709e71585e3450792dbb84d2cdb170
Add PNG display to simple server
wildtreetech/CRUMBS
server/simple.py
server/simple.py
"""Simple temperature data endpoint.""" import json import shelve import base64 from io import BytesIO from os import path from cPickle import HIGHEST_PROTOCOL import numpy as np import matplotlib.pyplot as plt import flask from flask import Flask from flask import request from flask import render_template_string ...
bsd-3-clause
Python
f9437777b8126b15e0e303b192c921935c594d29
Create server_primes.py
schollz/beowulf_ssh_cluster
server_primes.py
server_primes.py
import shlex from subprocess import Popen, PIPE import logging import threading import time import json import pickle ''' 1. On server computer: ssh-keygen 2. Then ssh-copy-id user@address 3. For each address, add it to the "cluster" variable below ''' cluster = {} cluster['this computer']={'address':'bitnami@127....
mit
Python
0a06072572a9c7a317ab6edd98a16989209bf1c1
Add simple checks that the system does not fail in terms of errors. Work toward issue 45
HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core
test/test_hybra_methods.py
test/test_hybra_methods.py
# coding=UTF8 import os, sys import pytest sys.path.append('../core/') import hybra class TestUM: def setup(self): self.g = hybra.data( 'news', data_folder = '', terms = ['yle.json'] ) self.l = list( hybra.data( 'news', data_folder = '', terms = ['yle.json'] ) ) def test_describe_generator...
mit
Python
199df322946cec91eb3f7fd2813077d5e7ef1b8a
add regression tests
branning/euler,branning/euler
test.py
test.py
#!/usr/bin/env python ''' Run all the solutions for which we know the ansewr, and check them. ''' import subprocess answer = { 1 : 233168, 2 : 4613732, 3 : 6857, 4 : 906609, 5 : 232792560, 6 : 25164150, 7 : 104743, 8 : 40824, 10 :...
mit
Python
0088619d3fc11470b06d0764c6f6c6f30ec83b90
Implement multiprocessing
tranlyvu/findLink,tranlyvu/find-link
test.py
test.py
from wikilink import wiki_link model = wiki_link.WikiLink() model.setup_db("mysql", "root", "13061990", "127.0.0.1", "3306") source_url = "https://en.wikipedia.org/wiki/Cristiano_Ronaldo" dest_url = "https://en.wikipedia.org/wiki/Software_engineer" print(model.min_link(source_url, dest_url, 6, 2))
apache-2.0
Python
fba9b8e8bb4fc38c58c2a6ae2a3a64569aefc48d
add test.py
Zuckonit/QPS
test.py
test.py
#!/usr/bin/env python # encoding: utf-8 from qps import QPS def add(a, b): return a + b with QPS(1000, add, 1, 2) as qps: pass
mit
Python
9f987c0cfbb09c2a1555ca28b5ecca06b86067c4
Add test for issue #125
pitrou/numba,stefanseefeld/numba,pombredanne/numba,GaZ3ll3/numba,numba/numba,pombredanne/numba,numba/numba,gdementen/numba,gmarkall/numba,GaZ3ll3/numba,shiquanwang/numba,jriehl/numba,pombredanne/numba,ssarangi/numba,numba/numba,IntelLabs/numba,seibert/numba,stuartarchibald/numba,numba/numba,GaZ3ll3/numba,pitrou/numba,n...
numba/tests/issues/test_issue_125.py
numba/tests/issues/test_issue_125.py
import numpy as np from numba import autojit, jit, double, void, uint32, npy_intp, typeof def uint_int_div_ary(elts, normdist, seed): for i in xrange(elts.shape[0]): # Problem with using sext instead of zext for uint32 elt = (seed[i] // normdist.shape[0]) elts[i] = elt def test_uint_int_di...
bsd-2-clause
Python
36547227f5694410dfe86b84831c354d22b00d6f
Add migration
uw-it-aca/myuw,uw-it-aca/myuw,uw-it-aca/myuw,uw-it-aca/myuw
myuw/migrations/0014_intl_stud_links.py
myuw/migrations/0014_intl_stud_links.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.10 on 2018-07-17 18:48 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('myuw', '0013_known_instructors'), ] operations = [ migrations.AddField( ...
apache-2.0
Python
1a17921fa5d6820a822058c35ef0ebbf31eb3cd7
Add new package: sparse (#18264)
iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack
var/spack/repos/builtin/packages/sparse/package.py
var/spack/repos/builtin/packages/sparse/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 * import glob class Sparse(MakefilePackage): """An open source sparse linear equation solver.""" ...
lgpl-2.1
Python
2eceebdd1eb052b81b6563e7bd58c275c4f74592
Add script to find malformed rules
scitran/core,scitran/api,scitran/core,scitran/core,scitran/api,scitran/core
bin/check_rule_algs.py
bin/check_rule_algs.py
# Print list of rules with invalid algs from api import config from api.dao import APINotFoundException from api.jobs.gears import get_gear_by_name if __name__ == '__main__': for rule in config.db.project_rules.find({}): alg = rule.get('alg') if not alg: print 'Rule {} has no alg.'.f...
mit
Python
114922ba8e8e834ee075aee111ac06e3ad148cb2
Test request construction (#91)
tableau/server-client-python,Talvalin/server-client-python,Talvalin/server-client-python,tableau/server-client-python
test/test_requests.py
test/test_requests.py
import unittest import requests import requests_mock import tableauserverclient as TSC class RequestTests(unittest.TestCase): def setUp(self): self.server = TSC.Server('http://test') # Fake sign in self.server._site_id = 'dad65087-b08b-4603-af4e-2887b8aafc67' self.server._auth_t...
mit
Python
7dd28cd3f9617f37e5dce9eca0889a76b72cce57
Add QueueSender tests
darkfeline/pymsmtpq,project-mir/mir.msmtpq
tests/test_queue_sender.py
tests/test_queue_sender.py
# Copyright (C) 2016 Allen Li # # 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,...
apache-2.0
Python
dad7009a0012a8a58f69581d659caac9d470164f
add user.py
jacktomcat/python-lesson-study,jacktomcat/python-lesson-study
user.py
user.py
from modules.employee import Employee #继承关系,可以多继承 User(Employee,Parent) class User(Employee): def __init__(self, id, email, username): self.id = id self.email = email self.username = username #调用本类的方法和调用父类的方法 def getNames(self): print ("子类调用父类方法...",self.getList(),self.shows(),"........") d...
apache-2.0
Python
b5b2d74e13cc4d44d5bb82b5dac4238ad5e3747b
Remove Rsvg required version
amolenaar/gaphor,amolenaar/gaphor
gaphor/__init__.py
gaphor/__init__.py
"""Gaphor is the simple modeling tool written in Python.""" import gi gi.require_version("PangoCairo", "1.0") gi.require_version("Gtk", "3.0") gi.require_version("Gdk", "3.0")
"""Gaphor is the simple modeling tool written in Python.""" import gi gi.require_version("PangoCairo", "1.0") gi.require_version("Gtk", "3.0") gi.require_version("Gdk", "3.0") gi.require_version("Rsvg", "2.0")
lgpl-2.1
Python
bf415bee02358f06f2ae70d9f4fd1b87868d7ff5
Add tests.
NiGhTTraX/hackernews-scraper
tests/test_scraper.py
tests/test_scraper.py
import unittest import httpretty import factory import json from endpoints import AlgoliaEndpoint from hnscraper import Scraper, TooManyItemsException class ItemFactory(factory.Factory): FACTORY_FOR = dict objectID = 21 created_at_i = 42 title = "Test item" class ResponseFactory(factory.Factory): FACTORY...
bsd-2-clause
Python
15b53aa90e8046b759fc283153d1b64869c006ea
Add basic movie selection
simon-andrews/movieman2,simon-andrews/movieman2
moviemanager/select_movie.py
moviemanager/select_movie.py
import random def select_movie(movie_list): """Selects a movie from the database""" return random.choice(movie_list)
mit
Python
9b657c27d56d13485839c9d83a86413626e47a2f
add time's up handling
v0y/ketchuporo,v0y/ketchuporo
ketchuporo/main.py
ketchuporo/main.py
from datetime import timedelta from kivy.app import App from kivy.clock import Clock from kivy.event import EventDispatcher from kivy.properties import StringProperty from kivy.uix.widget import Widget class Timer(timedelta, object): def tick(self): seconds = self.seconds - 1 if seconds == 0: ...
from datetime import timedelta from kivy.app import App from kivy.clock import Clock from kivy.event import EventDispatcher from kivy.properties import StringProperty from kivy.uix.widget import Widget class Timer(timedelta, object): def tick(self): seconds = self.seconds - 1 return Timer(seconds=...
mit
Python
74bb767c093567efacbd3ee9bfe39a38a6f7e440
Add list of release and screenshot locales. (#1470)
mastizada/focus-android,layely/focus-android,layely/focus-android,mozilla-mobile/focus-android,jonalmeida/focus-android,liuche/focus-android,mastizada/focus-android,layely/focus-android,jonalmeida/focus-android,ekager/focus-android,pocmo/focus-android,Benestar/focus-android,mozilla-mobile/focus-android,liuche/focus-and...
tools/l10n/locales.py
tools/l10n/locales.py
#!/usr/bin/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/. """This file contains various locale lists consumed by other tools""" # Sorted list of locales that...
mpl-2.0
Python
d8c953877bad27e896e0930e3c49d59573242aaa
Add extensions module
alexandermendes/pybossa-discourse
pybossa_discourse/extensions.py
pybossa_discourse/extensions.py
# -*- coding: utf8 -*- """Extensions module for pybossa-discourse.""" from pybossa_discourse.client import DiscourseClient from pybossa_discourse.sso import DiscourseSSO __all__ = ['discourse_client', 'discourse_sso'] discourse_client = DiscourseClient() discourse_sso = DiscourseSSO()
bsd-3-clause
Python
a715d344b72d598d06d8aaba4f82687e0657bd60
Add one-off script to convert a list of programming languages to JSON
bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile
python/one-offs/list-to-json.py
python/one-offs/list-to-json.py
''' One-off junk code to convert a list of programming languages with some extra information in the comments to JSON ''' from collections import OrderedDict languages = [] for line in t.split('\n'): language = OrderedDict() slashes = line.find('//') if slashes != -1: language_name, language_etc =...
mit
Python
4a46f43d1d3854584be1bab29ecbee3b3e023de9
Move export functionality to it's own file. Tidy up a lot of code. Add some extra documentation and functionality for pywind app. Catch more common errors and improve conversions. Update some tests. Progress :-)
zathras777/pywind,zathras777/pywind
pywind/export.py
pywind/export.py
unlicense
Python
46dce3e59f47127691f8ddb9156f22bd4501260d
add another not valid example
AlanCoding/Ansible-inventory-file-examples,AlanCoding/Ansible-inventory-file-examples
not_valid/invalid_script2.py
not_valid/invalid_script2.py
#!/usr/bin/env python # ^ different python raise Exception("this is a python exception")
mit
Python
2e7241471aad9edde7cf20843d41a71840d5b0fd
add minimal ws node test script
pyaiot/pyaiot,pyaiot/pyaiot,pyaiot/pyaiot,pyaiot/pyaiot
utils/ws/ws_test_client.py
utils/ws/ws_test_client.py
"""One shot Websocket test client.""" import argparse import json import websocket def main(args): """Main function.""" ws = websocket.create_connection("ws://{}:{}/node".format(args.host, args.port)) ws.send(json.dumps({'type': 'new', ...
bsd-3-clause
Python
bcd3077474b14c8321f453039d35deb0c016965e
add python proxy for withlist script
cap10morgan/mailmanager,cap10morgan/mailmanager,dnclabs/mailmanager,dnclabs/mailmanager
lib/mailmanager/listproxy.py
lib/mailmanager/listproxy.py
import json from Mailman import MailList class MailingListEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, MailList.MailList): return {'name': obj.internal_name()} return json.JSONEncoder.default(self, obj) def dumplist(mlist): print json.dumps(mlist, True, cls=MailingListEncode...
bsd-3-clause
Python
b966647378ae2dee8ea9e293bbb53c3d75627959
Create chess_linux.py
Niceboy5275/PythonChess,Niceboy5275/PythonChess
classes/chess_linux.py
classes/chess_linux.py
import sys, traceback import tableau import tour import fou import cavalier import pion import roi import reine from piece import piece tableau = tableau.tableau() possible = set() def openFile(filename): global curPlayer for X in range(0, 8): for Y in range(0, 8): tableau.setPion(X, Y, N...
mit
Python
4bbacdf2e000c9d725842c26f731684397bfbe5a
use lshw to provide machine info
fishinbox/CompassDiscovery,fishinbox/CompassDiscovery
client/compass/lshw.py
client/compass/lshw.py
from lxml import etree from subprocess import Popen,PIPE from pprint import pprint def describeSize(size): return '%s (%s)' % (calculateSize(size), calculateSize(size, True)) def calculateSize(size, isSi=False, level=0): unit = ['B', 'KiB', 'MiB', 'GiB', 'TiB'] siUnit = ['B', 'KB', 'MB', 'GB', 'TB'] ...
apache-2.0
Python
8027af94f19e1a3f6327652fb56a72ba44df2cc6
Update reordered-power-of-2.py
tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode
Python/reordered-power-of-2.py
Python/reordered-power-of-2.py
# Time: O((logn)^2) = O(1) due to n is a 32-bit number # Space: O(logn) = O(1) # Starting with a positive integer N, # we reorder the digits in any order (including the original order) # such that the leading digit is not zero. # # Return true if and only if we can do this in a way # such that the resulting number is...
# Time: O((logn)^2) # Space: O(logn) # Starting with a positive integer N, # we reorder the digits in any order (including the original order) # such that the leading digit is not zero. # # Return true if and only if we can do this in a way # such that the resulting number is a power of 2. # # Example 1: # # Input: 1...
mit
Python
3e5d3980c617fe31398d05e56f4f37298fbfc6eb
add hasLayer tester
sol-ansano-kim/medic,sol-ansano-kim/medic,sol-ansano-kim/medic
python/medic/plugins/Tester/hasLayer.py
python/medic/plugins/Tester/hasLayer.py
from medic.core import testerBase from maya import OpenMaya class hasLayer(testerBase.TesterBase): Name = "hasLayer" def __init__(self): super(hasLayer, self).__init__() def Match(self, m_object): return m_object.hasFn(OpenMaya.MFn.kDisplayLayer) or m_object.hasFn(OpenMaya.MFn.kAnimLayer...
mit
Python
0475c42fe7bdb1b6c66d3c4ca88aacf7c1352bae
Create leetcode-10.py
jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm
python_practice/leetCode/leetcode-10.py
python_practice/leetCode/leetcode-10.py
class Solution: def isMatch(self, s, p): """ :type s: str :type p: str :rtype: bool """ sIndex = 0 pIndex = 0 sLength = len(s) pLength = len(p) res = true startTrigger = 0 while res and sIndex < sLength and pIndex < pLe...
mit
Python
62ae670a4e351defe54f997b2ec102c7b6c0df7e
add test file
chrox/RealTimeElectrophy,chrox/RealTimeElectrophy,chrox/RealTimeElectrophy
Experimenter/test_dsp_plasticity.py
Experimenter/test_dsp_plasticity.py
# This is the main script to run disparity plasticity experiment. # # Copyright (C) 2010-2011 Huang Xin # # See LICENSE.TXT that came with this file. import numpy as np #from StimControl.LightStim.LightData import dictattr from Experiments.Experiment import ExperimentConfig,Experiment from Experiments.Experiment impor...
bsd-2-clause
Python
082fbf2759a4471163c0b7f8dfbab306864fe99e
Add CTCI 1.7
WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox
ctci/1/7/main.py
ctci/1/7/main.py
#!/usr/bin/env python3 def rotate(arr): new_arr = [] for i in range(len(arr)-1, -1, -1): new_arr.append([arr[x][i] for x in range(len(arr))]) return new_arr #TODO(Wesley) inplace version if __name__ == "__main__": i = [[1,2,3], [4,5,6], [7,8,9]] assert rotate(i) == [[3,6...
mit
Python
6b1f487f2ceb64b6b024b9d959a8ed5a0cd4d713
Add file for Rule.rule tests
PatrikValkovic/grammpy
tests/rules_tests/FromRuleComputeTest.py
tests/rules_tests/FromRuleComputeTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import main, TestCase from grammpy import Rule class FromRuleComputeTest(TestCase): pass if __name__ == '__main__': main()
mit
Python
b9af43c2d23961af1b0f99358eecd39a48371cc7
Load all pdbs script
dvillega/scripts,dvillega/scripts,dvillega/scripts,dvillega/scripts
load_all_pdbs.py
load_all_pdbs.py
import os from pymol import cmd cwd = os.getcwd() files = os.listdir(cwd) targets = [x for x in files if x[-3:] == 'pdb'] for target in targets: cmd.load(target)
mit
Python
79e72bca684353f0f6d25392064ee1babdcbfdca
Create http_checker.py
amazpyel/sqa_training,amazpyel/sqa_training,amazpyel/sqa_training
python/http_checker.py
python/http_checker.py
import unittest import requests import lxml.html class TestHtmlTask(unittest.TestCase): def setUp(self): self.ulr_google = "https://www.google.com.ua/" self.url_habr = "http://habrahabr.ru/hub/gdev/" def test_1(self): expected_response_1 = 200 r = requests.get(self.ulr_google)...
mit
Python
e5910bb15db7b71de544595e89f99b141ee0856c
add problem0007.py
Furisuke/ProjectEuler,Furisuke/ProjectEuler,Furisuke/ProjectEuler
python3/problem0007.py
python3/problem0007.py
from problem0003 import primes from itertools import islice def nth(iterable, n): '''return n-th element from given iterable >>> nth([1, 2, 3, 4], 2) 2 ''' return next(islice(iterable, n-1, None)) if __name__ == '__main__': print(nth(primes(), 10001))
mit
Python
1e0599f2c90403b7989758de4711665a9145b7bd
check for potential adapters
linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab,linsalrob/EdwardsLab
kmers/count_leading_kmers.py
kmers/count_leading_kmers.py
""" Count the leading k-mers in a fastq file. This is useful to see if the k-mers should be trimmed """ import os import sys import argparse from roblib import bcolors,stream_fastq __author__ = 'Rob Edwards' k = {"A" : 0, "G" : 1, "C" : 2, "T" : 3, "a" : 0, "g" : 1, "c" : 2, "t" : 3} def count_kmers(fqf, kmer, ver...
mit
Python
f3c0b8dd64a4653cdbb2e30ce6ecf9549d92fcb2
Create Braid.py
jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random
Braid.py
Braid.py
puzzleMaps = [[ [1,1,3,1], [3,2,0,0], [1,0,1,3] ],[ [0,1,1,3], [3,1,2,2], [2,0,0,2] ],[ [2,1,3,2], [0,3,0,1], [2,2,3,1] ],[ [3,0,3,2], [1,2,0,1], [1,3,2,0] ],[ [2,2,0,1], [3,0,0,1], [3,1,2,0] ]] for puzzleMap in puzzleMaps: minRotation = 999 minBuffer = '' for i in range(4): for...
apache-2.0
Python
ce68386732bfdc899614f7a027dbd7f445813bb9
add a python script that can detect nondescript images
thevash/vash,thevash/vash
util/filter/isflat.py
util/filter/isflat.py
#!/usr/bin/python2 import sys import png if len(sys.argv) < 2: print("No Input!") sys.exit(0) threshold=8 def diff(a, b): return abs(a-b) > threshold def average(values): return sum(values, 0.0) / len(values) png_pixels=png.Reader(filename=sys.argv[1]).read_flat()[2] current = [] pixels = [] fo...
agpl-3.0
Python
7da5ef49b6681adb4cf6bc205c595871fcdf28ae
Add module for generating uid with specific prefix
MGHComputationalPathology/highdicom
src/highdicom/uid.py
src/highdicom/uid.py
import logging from typing import Optional import pydicom logger = logging.getLogger(__name__) def generate_uid() -> str: '''Generates a unique DICOM identifier using a highdicom specific UID prefix. Returns ------- str unique identifier ''' prefix = '1.2.826.0.1.3680043.10.511...
mit
Python
e7a88a6f9f84dd86347e929bd16f5dbca93efa87
Create Hello.py
VannKraft/ConfinedAI
Hello.py
Hello.py
print ("Hello world!")
mit
Python
eae7c9734ab0490774d16ff0b6475aaaf2b14f7e
Create two-sum-iv-input-is-a-bst.py
tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/Le...
Python/two-sum-iv-input-is-a-bst.py
Python/two-sum-iv-input-is-a-bst.py
# Time: O(n) # Space: O(h) # Given a Binary Search Tree and a target number, # return true if there exist two elements in the BST such that their sum is equal to the given target. # # Example 1: # Input: # 5 # / \ # 3 6 # / \ \ # 2 4 7 # # Target = 9 # # Output: True # Example 2: # Input: # 5 ...
mit
Python
76f868137d1ee98f148032269251116887db38d5
Create script to execute Marcotti ETL
soccermetrics/marcotti
loader.py
loader.py
from interface import Marcotti from models.config.local import LocalConfig from etl import get_local_handles, ingest_feeds from etl.csv import CSV_ETL_CLASSES if __name__ == "__main__": settings = LocalConfig() marcotti = Marcotti(settings) with marcotti.create_session() as sess: for group in ['Ov...
mit
Python
5dacda9f9247e52823563ce243bea3190c1b2718
add the python3 script that Jarrod wrote to clean up the syntax in the vignettes
statlab/permuter,statlab/permuter,kellieotto/permuter,kellieotto/permuter
vignettes/tidy_Rdm.py
vignettes/tidy_Rdm.py
# Python 3 script to tidy format for vignettes in # https://github.com/statlab/permuter from fileinput import FileInput import subprocess from rpy2.robjects import r as R files = ('autofluorescence.Rmd', 'botulinum.Rmd', 'chrom17m.Rmd', 'confocal.Rmd', 'examples_chapters1_4.Rmd',...
bsd-2-clause
Python
3a3899331c97e128f355e7cc37e1975bea45c8dd
Fix workflow migrations
j0gurt/ggrc-core,jmakov/ggrc-core,selahssea/ggrc-core,andrei-karalionak/ggrc-core,jmakov/ggrc-core,josthkko/ggrc-core,VinnieJohns/ggrc-core,kr41/ggrc-core,NejcZupec/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,NejcZupec/ggrc-core,AleksNeStu/ggrc-core,NejcZupec/ggrc-core,AleksNeStu/ggrc-core,edofic/ggrc-core,plamut/ggrc-...
src/ggrc_workflows/migrations/versions/20150403101250_4f9f00e4faca_fill_object_types_table_with_workflow_.py
src/ggrc_workflows/migrations/versions/20150403101250_4f9f00e4faca_fill_object_types_table_with_workflow_.py
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com """fill object types table with workflow models Revision ID: 4f9f00e4faca Revis...
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com """fill object types table with workflow models Revision ID: 4f9f00e4faca Revis...
apache-2.0
Python
d171364b32c0f42c9134f29e86eb8bb538d6bcfb
Add depdupe fiddle.
feluxe/very_hungry_pi
dedupe/dedupe_fiddle.py
dedupe/dedupe_fiddle.py
import os from glob import iglob kb = 1000 mb = 1000 * kb gb = 1000 * mb root_dir = "/home/felix/**/*" for path1 in iglob(root_dir, recursive=True): try: fstat1 = os.stat(path1) except OSError: continue if fstat1.st_size >= 100 * mb: f1_path = path1 f1_size = fstat1.st_...
agpl-3.0
Python
bd717b8056a69ee7074a94b3234d840dd431dd1f
Use stack to solve the problem
zhuxiang/LeetCode-Python
src/341_flatten_nested_list_iterator.py
src/341_flatten_nested_list_iterator.py
""" This is the interface that allows for creating nested lists. You should not implement it, or speculate about its implementation """ class NestedInteger(object): def isInteger(self): """ @return True if this NestedInteger holds a single integer, rather than a nested list. :rtype bool "...
apache-2.0
Python
e9ccd709c3e7d3f675a66bba5adbd8a34b373f1b
Create lookup.py
tnsk/subdomain-lookup
lookup.py
lookup.py
# -*- coding: utf-8 -*- import urllib import urllib2 import os import subprocess import sys print "##############################################################" print u"[+] Yahya Tanışık [Subdomain Lookup]" print u"[!] iletisim : yahyatanisik[at]gmail.com" print "#####################################...
bsd-2-clause
Python
cfe603f34288ec9fe38eb6c57cb2e80675d4ddb2
Make manage.py use root checking from zulip_tools.
rht/zulip,andersk/zulip,rht/zulip,brainwane/zulip,punchagan/zulip,rht/zulip,tommyip/zulip,zulip/zulip,kou/zulip,punchagan/zulip,hackerkid/zulip,hackerkid/zulip,eeshangarg/zulip,rht/zulip,showell/zulip,andersk/zulip,brainwane/zulip,jackrzhang/zulip,dhcrzf/zulip,rishig/zulip,synicalsyntax/zulip,synicalsyntax/zulip,shubha...
manage.py
manage.py
#!/usr/bin/env python3 import os import sys import types BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) import scripts.lib.setup_path_on_import from scripts.lib.zulip_tools import script_should_not_be_root if __name__ == "__main__": script_should_not_be_root() if (os.access('/...
#!/usr/bin/env python3 import os import sys import types BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) import scripts.lib.setup_path_on_import if __name__ == "__main__": if 'posix' in os.name and os.geteuid() == 0: print("manage.py should not be run as root. Use `su zuli...
apache-2.0
Python
fa6ad1745518142f2a7e5c58a70e2cd937048d64
improve auto accept
jeromecc/doctoctocbot
src/request/utils.py
src/request/utils.py
import logging from request.models import Queue logger = logging.getLogger(__name__) def accept_delete_queue(uid, community): state = Queue.ACCEPT delete_queue(uid, community, state) def decline_delete_queue(uid, community): state = Queue.DECLINE delete_queue(uid, community, state) def delete_...
mpl-2.0
Python
c0ef584902709aa45f5559faf4a48142e96c5b00
test native proto2 metrics
vimeo/graph-explorer,dbirchak/graph-explorer,vimeo/graph-explorer,dbirchak/graph-explorer,vimeo/graph-explorer,vimeo/graph-explorer,dbirchak/graph-explorer,dbirchak/graph-explorer
test_structured_metrics_native_proto2.py
test_structured_metrics_native_proto2.py
import structured_metrics def test_native_proto2(): ''' for now, SM should ignore native proto2 metrics, ie as soon as they contain a space assume that we index them straight away with carbon-tagger. later we may add a plugin for them too. ''' s_metrics = structured_metrics.StructuredMetrics()...
apache-2.0
Python
88199432dfbb235aab26786878dd61aea03e0887
Add Spider to #155
iandees/all-the-places,iandees/all-the-places,iandees/all-the-places
locations/spiders/coastal.py
locations/spiders/coastal.py
# -*- coding: utf-8 -*- import scrapy import json from locations.items import GeojsonPointItem class CoastalFarmSpider(scrapy.Spider): name = "coastalfarm" allowed_domains = ["www.coastalfarm.com"] start_urls = ( 'https://www.coastalfarm.com/wp-admin/admin-ajax.php?action=store_search&lat=45.5230...
mit
Python
56221f91615c2b4479f5e92fada421e766a43872
add a package used in tests for months now...
jelmer/pydoctor,chevah/pydoctor,chevah/pydoctor,jelmer/pydoctor,hawkowl/pydoctor,hawkowl/pydoctor,jelmer/pydoctor
pydoctor/test/codeininit/__init__.py
pydoctor/test/codeininit/__init__.py
def functionInInit(self): "why do people put code here?"
isc
Python
466b8a8fb2bdf7ca8f74316fac3e483c3ba763b5
Make Pepper WebSocket UtilityGetProtocol test less flaky by making the wsh wait for close
TheTypoMaster/chromium-crosswalk,dednal/chromium.src,Pluto-tv/chromium-crosswalk,M4sse/chromium.src,bright-sparks/chromium-spacewalk,ondra-novak/chromium.src,chuan9/chromium-crosswalk,Jonekee/chromium.src,axinging/chromium-crosswalk,krieger-od/nwjs_chromium.src,chuan9/chromium-crosswalk,PeterWangIntel/chromium-crosswal...
net/data/websocket/protocol-test_wsh.py
net/data/websocket/protocol-test_wsh.py
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import cgi from mod_pywebsocket import msgutil def web_socket_do_extra_handshake(request): r = request.ws_resource.split('?', 1) if len(r) == 1: ...
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import cgi from mod_pywebsocket import msgutil def web_socket_do_extra_handshake(request): r = request.ws_resource.split('?', 1) if len(r) == 1: ...
bsd-3-clause
Python
d66b7ecad80d21d613dca2ad19e2b96eaa8e0503
Add Solver/Beginner/YellowFaceSolver.py
Wiston999/python-rubik
Solver/Beginner/YellowFaceSolver.py
Solver/Beginner/YellowFaceSolver.py
from .. import Solver from Move import Move class YellowCrossSolver(Solver): def apply_algorithm(self, solution): for move in ["F", "R", "U", "R'", "U'", "F'"]: self.move(move, solution) def move(self, m, solution): self.cube.move(Move(m)) solution.append(m) def soluti...
mit
Python
1401aa0138a0ee805855b3a7a7870a57a1da283c
add files
iYefeng/traits,iYefeng/traits,iYefeng/traits,iYefeng/traits,iYefeng/traits,iYefeng/traits,iYefeng/traits,iYefeng/traits,iYefeng/traits
python/scripts/matplotlib_scripts.py
python/scripts/matplotlib_scripts.py
# coding: utf-8 # In[35]: get_ipython().magic(u'matplotlib inline') from sklearn import datasets from sklearn.cross_validation import cross_val_predict from sklearn import linear_model import matplotlib.pyplot as plt lr = linear_model.LinearRegression() boston = datasets.load_boston() y = boston.target # cross_val...
mit
Python
1b068297bf56677101bca5c6b30fd07ee7140507
add function to auto check file input from user
HuimingCheng/AutoGrading,HuimingCheng/AutoGrading,HuimingCheng/AutoGrading,Hubert51/AutoGrading,Hubert51/AutoGrading,Hubert51/AutoGrading,HuimingCheng/AutoGrading,Hubert51/AutoGrading,Hubert51/AutoGrading,HuimingCheng/AutoGrading
Test_code/test_upload/autoUpload.py
Test_code/test_upload/autoUpload.py
# coding=utf-8 import requests import os import time import platform import atexit # global variable for exit function global FILENUMBER # print the number of files uplaod in this time, and give a reminder for user that the # the file will be deleted after Monday before exit the script. '''把时间戳转化为时间: 1479264792 t...
mit
Python
fdac8873750eaaac4846024819e8b121b1274dcc
Write generator pentru lipsa
palcu/infooltenia,palcu/infooltenia,palcu/infooltenia,palcu/infooltenia,palcu/infooltenia,palcu/infooltenia
lipsa/generator.py
lipsa/generator.py
from random import shuffle n = 10 m = 2 print("{0} {1}".format(n, m)) for i in range(m): v = range(1, n+1) shuffle(v) print(" ".join([str(x) for x in v[1:]]))
mit
Python
43996dfff06161c7cd15dbb5c533bf828b028242
add a script to create mean spectra from each map field
adamginsburg/APEX_CMZ_H2CO,keflavich/APEX_CMZ_H2CO,keflavich/APEX_CMZ_H2CO,adamginsburg/APEX_CMZ_H2CO
reduction/each_map_field_spectrum.py
reduction/each_map_field_spectrum.py
import numpy as np import make_apex_cubes import os import pyspeckit from pyspeckit.spectrum.readers import read_class from astropy.time import Time def make_spectra(dataset, maps): cl = read_class.ClassObject(os.path.join(make_apex_cubes.april2014path, dataset)+".apex") for map in maps: spectra = cl....
bsd-3-clause
Python
9b5beb92cde087acbd0306f70f92f736e1009f05
Add deploy script
jarnoln/mitasny,jarnoln/mitasny
deploy_tools/fabfile.py
deploy_tools/fabfile.py
# Usage: # Localhost: # fab -f deploy_tools/fabfile.py provision:host=jln@localhost # fab -f deploy_tools/fabfile.py deploy:host=jln@localhost import time from fabric.contrib.files import append, exists, sed from fabric.api import env, local, run, settings, abort REPO_URL = 'https://github.com/jarnoln/mitasny.git' S...
mit
Python
c6a86ada0b3115b31380e41c79b18433ec17065c
add Scenario and Country models
jantoniomartin/condottieri_scenarios,jantoniomartin/condottieri_scenarios
models.py
models.py
## Copyright (c) 2012 by Jose Antonio Martin <jantonio.martin AT gmail DOT 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 ## a...
agpl-3.0
Python
b7103939c58860d87f414b90fd5133b738e0637f
Create Conexao.py
MateusJFabricio/ProjVeiculoMapeamentoAutomatico,MateusJFabricio/ProjVeiculoMapeamentoAutomatico
Database/Conexao.py
Database/Conexao.py
import sqlite3 #conn = sqlite3.connect("banco.db") conn = sqlite3.connect(":testando:") conn.row_factory = sqlite3.Row cursor = conn.cursor() #sql = "CREATE TABLE USUARIO(nome varchar(50))" #cursor.execute(sql) #sql = "ALTER TABLE USUARIO ADD idade integer" #cursor.execute(sql) sql = "INSERT INTO USUARIO(nome, ida...
unlicense
Python
88955f22ee2a8154e5445e94e23f348d7f544db9
Add qisrc grep
dmerejkowsky/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,aldebaran/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild
python/qisrc/actions/grep.py
python/qisrc/actions/grep.py
## Copyright (c) 2012 Aldebaran Robotics. All rights reserved. ## Use of this source code is governed by a BSD-style license that can be ## found in the COPYING file. """Run git grep on every project Options are the same as in git grep """ import sys import logging import qisrc import qibuild def configure_parser...
bsd-3-clause
Python
a3afac53b9e8665051086babf09b80c4238c1f64
Add QtNetwork module to Qt API selector.
pankajp/pyface,geggo/pyface,geggo/pyface,brett-patterson/pyface
pyface/qt/QtNetwork.py
pyface/qt/QtNetwork.py
from . import qt_api if qt_api == 'pyqt': from PyQt4.QtNetwork import * else: from PySide.QtNetwork import *
bsd-3-clause
Python
a15dacc777163398e796f2cc2151fff41c28a877
raise an error if user tried to set wdi_property_store
sebotic/WikidataIntegrator,SuLab/WikidataIntegrator
wikidataintegrator/wdi_property_store.py
wikidataintegrator/wdi_property_store.py
raise ValueError("This file is deprecated. See: wdi_core.WDItemEngine.core_props")
mit
Python
56052dfd9161430d8dcb34deaafe22d2e121f14c
add functionality for creating data storage directory
Astrohackers-TW/IANCUPyData
data_download.py
data_download.py
import os data_dir = os.path.expanduser('~/astro_data') if not os.path.exists(data_dir): os.mkdir(data_dir) else: print('The directory "' + data_dir + '" already exists.')
mit
Python
ff9bbddd16380e0888dfcabd9c8968bc60fb3599
Create scraper.py
iradche/Data-Expedition-in-EU
scaffolding/scraper.py
scaffolding/scraper.py
# From DataCamp course "Importing Data in Python (Part 2)" import requests from bs4 import BeautifulSoup # Specify url: url url = 'https://www.python.org/~guido/' # Package the request, send the request and catch the response: r = requests.get(url) # Extract the response as html: html_doc html_doc = r.text # Creat...
mit
Python
de802c22865e4369cb938be7d7931b7e53374059
Add one-off script to fix nodes with no creator
brianjgeiger/osf.io,baylee-d/osf.io,cslzchen/osf.io,Johnetordoff/osf.io,icereval/osf.io,chennan47/osf.io,aaxelb/osf.io,HalcyonChimera/osf.io,pattisdr/osf.io,leb2dg/osf.io,laurenrevere/osf.io,felliott/osf.io,aaxelb/osf.io,aaxelb/osf.io,CenterForOpenScience/osf.io,adlius/osf.io,baylee-d/osf.io,leb2dg/osf.io,binoculars/os...
scripts/fix_nodes_with_no_creator.py
scripts/fix_nodes_with_no_creator.py
import logging import sys from django.db import transaction from website.app import setup_django setup_django() from osf.models import AbstractNode from scripts import utils as script_utils logger = logging.getLogger(__name__) def main(): dry = '--dry' in sys.argv if not dry: # If we're not running ...
apache-2.0
Python
e3634ee731a47996d0fb53ec025768ced37e834d
Check for alignment
andrew0harney/EEG-Multi-Channel-Utility
photoDiodeCorrelation.py
photoDiodeCorrelation.py
import numpy as np import pandas as pd import matplotlib.pyplot as plt from Grid import Grid from GRID import show_events_on_chan,photodiode_signal import cProfile #Script to check that events are aligned with some independent measurement (e.g pulsing photodiode in this case) #This is useful for checking that log time...
mit
Python
4220c243329bec6860d96993589607dcbaf006fd
add a client test program
kangic/eznetpp
test/simple_client.py
test/simple_client.py
import sys import socket import time server_addr = ("localhost", 6666) client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client_socket.connect(server_addr) time.sleep(30)
mit
Python
cd2c0f6111221990c3838a64961d24208c310a1d
Add printing of color codes in matplotlib
nathanielng/code-templates,nathanielng/code-templates,nathanielng/code-templates
snippets/python/matplotlib-colors.py
snippets/python/matplotlib-colors.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import matplotlib def create_color_list(): color_names = matplotlib.colors.cnames color_list = [] for key,val...
apache-2.0
Python
05ddc249c344a9e6e9f10100ca92f83eec4226e9
add test of externals
salilab/rmf,salilab/rmf,salilab/rmf,salilab/rmf
test/test_external.py
test/test_external.py
import RMF import os.path import unittest class GenericTest(unittest.TestCase): def _create(self, name): rmf= RMF.create_rmf_file(name) rt= rmf.get_root_node() # now make hierarchy rff= RMF.ReferenceFrameFactory(rmf) ef= RMF.ExternalFactory(rmf) # add a couple t...
apache-2.0
Python
27e52e909bfd4a800668cb144a01ab707909dd71
Add test
codertx/lightil
test/test_jwt_auth.py
test/test_jwt_auth.py
from django.test import TestCase, Client from django.contrib.auth.models import User from jwt_auth.views import AuthViews import json class JwtAuthTestCase(TestCase): def setUp(self): u = User.objects.create_user(username="codert", password="87654321") u.save() def test_token_request(self): ...
mit
Python
0df55bb5a20b21fe5f0984bb30fc8aa679363449
Create docuSignForumScraper.py
megansquire/stackpaper2015
docuSignForumScraper.py
docuSignForumScraper.py
import os import re import urllib2 import datetime import numpy alllinks = [] timelist = [] for filename in os.listdir(os.getcwd()): if filename.endswith(".rss"): f=open(filename, 'r') linktext = '' linkurl = '' for line in f: linktext = re.search('(<guid>)(.+?)(<\/guid>...
artistic-2.0
Python
806145f67e3cff0b079e83a54cd457c126f22222
Add the parser.
dmbaturin/ply-example
parser.py
parser.py
#!/usr/bin/env python import sys import pprint import ply.yacc as yacc from lexer import tokens def p_config(p): ''' config : sections ''' p[0] = p[1] def p_sections(p): ''' sections : sections section | section ''' if len(p) == 2: p[0] = [p[1]] else: p[0] = p...
cc0-1.0
Python
23336c48a1dafcea47dab68b8915add1c7ff9f4f
Fix formatting of API error message
mvaled/sentry,gencer/sentry,gencer/sentry,ifduyue/sentry,ifduyue/sentry,ifduyue/sentry,mvaled/sentry,looker/sentry,beeftornado/sentry,looker/sentry,looker/sentry,beeftornado/sentry,mvaled/sentry,mvaled/sentry,beeftornado/sentry,gencer/sentry,ifduyue/sentry,looker/sentry,mvaled/sentry,mvaled/sentry,gencer/sentry,gencer/...
src/sentry/api/serializers/rest_framework/origin.py
src/sentry/api/serializers/rest_framework/origin.py
from __future__ import absolute_import from rest_framework import serializers from sentry.utils.http import parse_uri_match class OriginField(serializers.CharField): # Special case origins that don't fit the normal regex pattern, but are valid WHITELIST_ORIGINS = ('*') def from_native(self, data): ...
from __future__ import absolute_import from rest_framework import serializers from sentry.utils.http import parse_uri_match class OriginField(serializers.CharField): # Special case origins that don't fit the normal regex pattern, but are valid WHITELIST_ORIGINS = ('*') def from_native(self, data): ...
bsd-3-clause
Python
2475333bb65ff5f1289bbf47790772087a801996
add simple test for file_list(pkg).
cournape/Bento,abadger/Bento,abadger/Bento,cournape/Bento,abadger/Bento,cournape/Bento,abadger/Bento,cournape/Bento
tests/test_package.py
tests/test_package.py
import unittest import os import tempfile from nose.tools import \ assert_equal from toydist import PackageDescription from toydist.core.package import file_list from toydist.core.pkg_objects import DataFiles def create_file(file, makedirs=True): if makedirs: dirname = os.path.dirname(file) i...
bsd-3-clause
Python
2a0544bf399dbfbdb8e6d4ef4faf91e19a3c0a15
Add new file to test kernel efficiency warnings
cpcloud/numba,seibert/numba,seibert/numba,cpcloud/numba,cpcloud/numba,numba/numba,stuartarchibald/numba,seibert/numba,stuartarchibald/numba,cpcloud/numba,seibert/numba,IntelLabs/numba,IntelLabs/numba,seibert/numba,stonebig/numba,cpcloud/numba,stuartarchibald/numba,stonebig/numba,stuartarchibald/numba,stonebig/numba,num...
numba/cuda/tests/cudapy/test_warning.py
numba/cuda/tests/cudapy/test_warning.py
import numpy as np from numba import cuda from numba.cuda.testing import CUDATestCase, skip_on_cudasim from numba.tests.support import override_config from numba.core.errors import NumbaPerformanceWarning import warnings def numba_dist_cuda(a, b, dist): len = a.shape[0] for i in range(len): dist[i] = ...
bsd-2-clause
Python
49179fa0fba59e1f857304bc206387e5f73e8380
Create values_per_area.py
clld/recipes
Grambank/values_per_area.py
Grambank/values_per_area.py
from __future__ import print_function, unicode_literals from itertools import groupby from collections import Counter, defaultdict from pycldf.dataset import Dataset def areality(metadata, feature_id): # Read the CLDF Dataset specified by a metadata file: grambank = Dataset.from_metadata(metadata) for fe...
apache-2.0
Python
a61d5fa6bbe47ff8340fb3b70737d946cd939890
Add import_park.py
centrahackathon2017/bdvis,centrahackathon2017/bdvis,centrahackathon2017/bdvis
scripts/import_park.py
scripts/import_park.py
from sodapy import Socrata from datetime import datetime DRY_RUN = True client = Socrata("data.cityofgainesville.org", None) counter = 0 for i in range(1): offset = i * 1000 data = client.get("fyxq-xtpn", offset=offset, limit=1000) for row in data: try: park = row["park"] ...
mit
Python
a2927df6d936537760673cb63da8cfb5450d09e3
add tests for bokeh __init__
KasperPRasmussen/bokeh,carlvlewis/bokeh,phobson/bokeh,satishgoda/bokeh,muku42/bokeh,phobson/bokeh,htygithub/bokeh,matbra/bokeh,justacec/bokeh,azjps/bokeh,evidation-health/bokeh,rothnic/bokeh,philippjfr/bokeh,aavanian/bokeh,sahat/bokeh,ericmjl/bokeh,bokeh/bokeh,maxalbert/bokeh,abele/bokeh,mindriot101/bokeh,timsnyder/bok...
bokeh/tests/test_bokeh_init.py
bokeh/tests/test_bokeh_init.py
import unittest , sys , platform , os import mock #would use stringIO but flush is called by bokeh.test which wipes it! class CaptureString(): value = "" def write(self,string): self.value += string def flush(self): pass def CaptureStdOut(): #replace stdout with something we can capture out = CaptureString()...
bsd-3-clause
Python
fd9b0225ce61079c65f89865050cb4bda1947d70
Create py-日志.py
ganmk/python-prctice
py-日志.py
py-日志.py
import logging from logging.handlers import TimedRotatingFileHandler log = logging.getLogger() file_name = "./test.log" logformatter = logging.Formatter('%(asctime)s [%(levelname)s]|%(message)s') loghandle = TimedRotatingFileHandler(file_name, 'midnight', 1, 2) loghandle.setFormatter(logformatter) loghandle.suffix = '%...
mit
Python
216a87e6ce3c9658848339d8ef4bb327176a8276
Create Assignment10.py
WUSTL-GIS-Programming-spring-2014/classinfo,WUSTL-GIS-Programming-spring-2014/classinfo
Assignments/Assignment10.py
Assignments/Assignment10.py
# (Place your name here in a comment) # Assignment 10: NDVI with rasterio # Note: NDVI = (IR - R)/(IR + R) # Use the same data as Assignmetn 5 at https://www.dropbox.com/s/lo91vpjlh7c0a5i/Assignment5.gdb.zip # You can convert to whatever image format you would like, or I will provide a sample tif on Monday. import os i...
unlicense
Python
cd0a80883c5740cff5ae1377930dd1e551df3dd6
adjust interface to sasview
SasView/sasmodels,SasView/sasmodels,SasView/sasmodels,SasView/sasmodels
sasmodels/custom/__init__.py
sasmodels/custom/__init__.py
""" Custom Models ------------- This is a place holder for the custom models namespace. When models are loaded from a file by :func:`generate.load_kernel_module` they are loaded as if they exist in *sasmodels.custom*. This package needs to exist for this to occur without error. """ import os from os.path import bas...
bsd-3-clause
Python
512ab87b1786f8c3d003a62337eee75beff9d960
Add a helper script to dump tags to a file
czcorpus/vert-tagextract,czcorpus/vert-tagextract
scripts/postag2file.py
scripts/postag2file.py
# Copyright 2018 Tomas Machalek <tomas.machalek@gmail.com> # Copyright 2018 Charles University, Faculty of Arts, # Institute of the Czech National Corpus # # 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...
apache-2.0
Python
0721d6129da01c693d8a28c12d66e6b55d37f964
Add code for extracting best pivot features from saved neural model.
tmills/uda,tmills/uda
scripts/extract_pivots_from_model.py
scripts/extract_pivots_from_model.py
#!/usr/bin/env python import sys import numpy as np import torch from learn_pivots_tm import PivotLearnerModel, StraightThroughLayer def main(args): if len(args) < 1: sys.stderr.write("Required arguments: <model file> [num pivots (100)]\n") sys.exit(-1) num_pivots = 100 if len(args) > 1:...
apache-2.0
Python
89bd674ddbb5d7d68d3be1a95f07a49c8d1f4354
Create barkingMad.py
NendoTaka/CodeForReference,NendoTaka/CodeForReference,NendoTaka/CodeForReference
CodeWars/8kyu/barkingMad.py
CodeWars/8kyu/barkingMad.py
class Dog (): def __init__(self, breed): self.breed = breed def bark(self): return "Woof" snoopy = Dog("Beagle") scoobydoo = Dog("Great Dane")
mit
Python
f7051df9187fa824c68b6d481b4f6b13613f2fc9
Update app/extensions/resolver/__init__.py
apipanda/openssl,apipanda/openssl,apipanda/openssl,apipanda/openssl
app/extensions/resolver/__init__.py
app/extensions/resolver/__init__.py
import re from connexion.resolver import Resolver class InformResolver(Resolver): def __init__(self, default_module_name, collection_endpoint_name='search'): Resolver.__init__(self) self.default_module_name = default_module_name self.collection_endpoint_name = collection_endpoint_name ...
mit
Python
4b25a7d34ea17c86c4b40a09f85898ea4769b22b
Add file to GCS operator
dmitry-r/incubator-airflow,r39132/airflow,ledsusop/airflow,spektom/incubator-airflow,yk5/incubator-airflow,wndhydrnt/airflow,dmitry-r/incubator-airflow,subodhchhabra/airflow,juvoinc/airflow,zodiac/incubator-airflow,lyft/incubator-airflow,sdiazb/airflow,zoyahav/incubator-airflow,DEVELByte/incubator-airflow,adrpar/incuba...
airflow/contrib/operators/file_to_gcs.py
airflow/contrib/operators/file_to_gcs.py
# -*- coding: utf-8 -*- # # 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