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 |
|---|---|---|---|---|---|---|---|---|
02371d2ace7c366f0b0b6332010323d478bc7652 | Add new package nlopt (#6499) | tmerrick1/spack,matthiasdiener/spack,LLNL/spack,mfherbst/spack,iulian787/spack,matthiasdiener/spack,tmerrick1/spack,EmreAtes/spack,mfherbst/spack,krafczyk/spack,tmerrick1/spack,mfherbst/spack,iulian787/spack,krafczyk/spack,mfherbst/spack,iulian787/spack,tmerrick1/spack,matthiasdiener/spack,EmreAtes/spack,EmreAtes/spack... | var/spack/repos/builtin/packages/nlopt/package.py | var/spack/repos/builtin/packages/nlopt/package.py | ##############################################################################
# Copyright (c) 2013-2017, 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 | |
152bf235721c5b6c8ba61da4d8521733a2842885 | Send script | alexfalcucc/crawler_mapsofworld | extract_norcal_table.py | extract_norcal_table.py | import urllib2
from bs4 import BeautifulSoup
url = "http://www.mapsofworld.com/usa/states/california/map-of-northern-
california.html"
page = urllib2.urlopen(url)
soup = BeautifulSoup(page)
tables = soup.findAll("table")
tables[3].find_all('td')
for td in tables[3].find_all('td'):
print ... | mit | Python | |
32c95175538b4324f1cf6b21a2c3bd5d2cb29413 | Add product type test | rackerlabs/django-DefectDojo,OWASP/django-DefectDojo,rackerlabs/django-DefectDojo,OWASP/django-DefectDojo,OWASP/django-DefectDojo,rackerlabs/django-DefectDojo,OWASP/django-DefectDojo,OWASP/django-DefectDojo,rackerlabs/django-DefectDojo | tests/Product_type_unit_test.py | tests/Product_type_unit_test.py | from selenium import webdriver
from selenium.webdriver.support.ui import Select
import unittest
import re
import sys
class ProductTest(unittest.TestCase):
def setUp(self):
# change path of chromedriver according to which directory you have chromedriver.
self.driver = webdriver.Chrome('/home/dr3dd/... | bsd-3-clause | Python | |
b80e52ecf09f96e84625eb6fff9aa7a20059c0f8 | Add new top level script to ease running of individual unittests. | tskisner/pytoast,tskisner/pytoast | test_single.py | test_single.py |
import sys
import unittest
from toast.mpirunner import MPITestRunner
file = sys.argv[1]
loader = unittest.TestLoader()
runner = MPITestRunner(verbosity=2)
suite = loader.discover('tests', pattern='{}'.format(file), top_level_dir='.')
runner.run(suite)
| bsd-2-clause | Python | |
2ae235215d33555b077fbd9e2f0c42d52ccce8c4 | add listener | omgapuppy/le-dyn-postback | dyn-listener.py | dyn-listener.py | #!/usr/bin/env python
from logentries import LogentriesHandler
import logging
from flask import Flask, jsonify, request
listener = Flask(__name__)
# Configure the port your postback URL will listen on and provide your
# LOGENTRIES_TOKEN
PORT = 5000
LOGENTRIES_TOKEN = "your-log-token-here"
log = logging.getLogger('l... | mit | Python | |
abc32403d85c536f38a2072941f1864418c55b4f | Create editdistance.py | vikramraman/algorithms,vikramraman/algorithms | editdistance.py | editdistance.py | # Author: Vikram Raman
# Date: 09-12-2015
import time
# edit distance between two strings
# e(i,j) = min (1 + e(i-1,j) | 1 + e(i,j-1) | diff(i,j) + e(i-1,j-1))
def editdistance(s1, s2):
m = 0 if s1 is None else len(s1)
n = 0 if s2 is None else len(s2)
if m == 0:
return n
elif n == 0:
... | mit | Python | |
f79e0782235943e0ace543db754cca232682f6ad | Add some basic tests | tamasgal/km3pipe,tamasgal/km3pipe | km3pipe/io/tests/test_aanet.py | km3pipe/io/tests/test_aanet.py | # Filename: test_aanet.py
# pylint: disable=locally-disabled,C0111,R0904,C0301,C0103,W0212
from km3pipe.testing import TestCase, patch, Mock
from km3pipe.io.aanet import AanetPump
import sys
sys.modules['ROOT'] = Mock()
sys.modules['aa'] = Mock()
__author__ = "Tamas Gal"
__copyright__ = "Copyright 2018, Tamas Gal and... | mit | Python | |
9f39ed48b6f745a96b5874bc87e306c01d3f016f | add 0.py | bm5w/pychal | 0.py | 0.py | if __name__ == "__main__":
print 2**38
| mit | Python | |
0575be4316e930de71dce8c92d7be428d4565470 | Add c.py | tanacasino/test | c.py | c.py |
class C(object):
def c(self):
print("c")
C().c()
| apache-2.0 | Python | |
61cfa59b7881f8658a8eab13ba4bc50ac17ba6ce | Add sample plugin used by functional tests | ptthiem/nose2,ezigman/nose2,leth/nose2,little-dude/nose2,ojengwa/nose2,leth/nose2,little-dude/nose2,ezigman/nose2,ojengwa/nose2,ptthiem/nose2 | nose2/tests/functional/support/lib/plugin_a.py | nose2/tests/functional/support/lib/plugin_a.py | from nose2 import events
class PluginA(events.Plugin):
configSection = 'a'
def __init__(self):
self.a = self.config.as_int('a', 0)
| bsd-2-clause | Python | |
2e6c7235c555799cc9dbb9d1fa7faeab4557ac13 | Add stubby saved roll class | foxscotch/foxrollbot | db.py | db.py | import sqlite3
connection = sqlite3.connect('data.db')
class SavedRoll:
@staticmethod
def save(user, name, args):
pass
@staticmethod
def get(user, name):
pass
@staticmethod
def delete(user, name):
pass
| mit | Python | |
85044ad914029d9b421b3492e828ad89a85b62a3 | Create ept.py | mthbernardes/EternalProxyTor | ept.py | ept.py | # -*- coding: utf-8 -*-
from TorCtl import TorCtl
import requests,json
proxies = {'http': 'socks5://127.0.0.1:9050','https': 'socks5://127.0.0.1:9050'}
class TorProxy(object):
def __init__(self,):
pass
def connect(self, url, method):
r = getattr(requests, method)(url,proxies=proxies)
return r
def new_ip(s... | mit | Python | |
062473c20e59f259d38edcd79e22d0d215b8f52f | Add file to store API Access keys | sgregg85/QuoteBot | key.py | key.py | consumer_key = '' # Enter your values here
consumer_secret = '' # Enter your values here
access_token = '' # Enter your values here
access_token_secret = '' # Enter your values here
| unlicense | Python | |
49b8f4b50ea1ff8c62977699c8e568a6d8d14887 | Create obs.py | spmls/pydelft,spmls/pydelft | obs.py | obs.py | import numpy as np
from pydelft.read_griddep import grd, dep
from PyQt4 import QtGui
import mpl_toolkits.basemap.pyproj as pyproj
import mpl_toolkits.basemap as Basemap
#------------------------------------------------------------------------------
# OBS SAVE FILE DIALOG
class SaveObsFileDialog(QtGui.QMainWindow):
... | mit | Python | |
7f3411268e153c47edc77c681e14aef5747639de | use the subdir /httplib2, follow up for 10273 | TridevGuha/pywikibot-core,jayvdb/pywikibot-core,VcamX/pywikibot-core,darthbhyrava/pywikibot-local,hasteur/g13bot_tools_new,h4ck3rm1k3/pywikibot-core,npdoty/pywikibot,magul/pywikibot-core,h4ck3rm1k3/pywikibot-core,PersianWikipedia/pywikibot-core,wikimedia/pywikibot-core,npdoty/pywikibot,Darkdadaah/pywikibot-core,magul/p... | pwb.py | pwb.py | import sys,os
sys.path.append('.')
sys.path.append('externals/httplib2')
sys.path.append('pywikibot/compat')
if "PYWIKIBOT2_DIR" not in os.environ:
os.environ["PYWIKIBOT2_DIR"] = os.path.split(__file__)[0]
sys.argv.pop(0)
if len(sys.argv) > 0:
if not os.path.exists(sys.argv[0]):
testpath = ... | import sys,os
sys.path.append('.')
sys.path.append('externals')
sys.path.append('pywikibot/compat')
if "PYWIKIBOT2_DIR" not in os.environ:
os.environ["PYWIKIBOT2_DIR"] = os.path.split(__file__)[0]
sys.argv.pop(0)
if len(sys.argv) > 0:
if not os.path.exists(sys.argv[0]):
testpath = os.path.j... | mit | Python |
81c722316d75e929d120f4d7139c499052a4e2fb | add cli program | TakeshiTseng/Dragon-Knight,TakeshiTseng/ryu-dynamic-loader,John-Lin/ryu-dynamic-loader,Ryu-Dragon-Knight/Dragon-Knight,pichuang/Dragon-Knight | cli.py | cli.py | #!/usr/bin/env python
# -*- codeing: utf-8 -*-
import socket
import logging
import json
LOG = logging.getLogger('DynamicLoadCmd')
def main():
sc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sc.connect(('127.0.0.1', 10807))
while True:
line = raw_input('(ryu) ')
if line == 'e... | mit | Python | |
4f08f057c7e4cc8230a996d853892ab3eef36065 | Add simple terminal-based version of rock-paper-scissors. | kubkon/ee106-additional-material | rps.py | rps.py | from random import choice
class RPSGame:
shapes = ['rock', 'paper', 'scissors']
draws = [('rock', 'rock'), ('paper', 'paper'), ('scissors', 'scissors')]
first_wins = [('rock', 'scissors'), ('scissors', 'paper'), ('paper', 'rock')]
def _evaluate(self, player_move, computer_move):
if (player... | mit | Python | |
024b9dbfb3e34b5ff092ad86a1bec1e82ccfb9f9 | Convert tests/test_elsewhere_twitter.py to use Harness & TestClient. | eXcomm/gratipay.com,studio666/gratipay.com,bountysource/www.gittip.com,studio666/gratipay.com,eXcomm/gratipay.com,bountysource/www.gittip.com,bountysource/www.gittip.com,mccolgst/www.gittip.com,gratipay/gratipay.com,eXcomm/gratipay.com,mccolgst/www.gittip.com,bountysource/www.gittip.com,gratipay/gratipay.com,mccolgst/w... | tests/test_elsewhere_twitter.py | tests/test_elsewhere_twitter.py | from gittip.elsewhere import twitter
from gittip.models import Elsewhere
from gittip.testing import Harness
class TestElsewhereTwitter(Harness):
def test_twitter_resolve_resolves(self):
alice = self.make_participant('alice')
alice_on_twitter = Elsewhere(platform='twitter', user_id="1",
... | from gittip.testing import tip_graph
from gittip.elsewhere import twitter
def test_twitter_resolve_resolves():
with tip_graph(('alice', 'bob', 1, True, False, False, "twitter", "2345")):
expected = 'alice'
actual = twitter.resolve(u'alice')
assert actual == expected, actual
| cc0-1.0 | Python |
3739819ed85a03520ad3152a569ad6cfb3dd7fb5 | Add a used test. | kbrose/article-tagging,chicago-justice-project/article-tagging,chicago-justice-project/article-tagging,kbrose/article-tagging | lib/tagnews/tests/test_crimetype_tag.py | lib/tagnews/tests/test_crimetype_tag.py | import tagnews
class TestCrimetype():
@classmethod
def setup_method(cls):
cls.model = tagnews.CrimeTags()
def test_tagtext(self):
self.model.tagtext('This is example article text')
def test_tagtext_proba(self):
article = 'Murder afoul, someone has been shot!'
probs =... | mit | Python | |
edc335e68d44c6a0c99499bc4416c55a6072232e | add proper test for govobj stuff | thelazier/sentinel,thelazier/sentinel,dashpay/sentinel,ivansib/sentinel,ivansib/sentinel,dashpay/sentinel | test/test_governance_methods.py | test/test_governance_methods.py | import pytest
import os
os.environ['SENTINEL_ENV'] = 'test'
import sys
sys.path.append( os.path.join( os.path.dirname(__file__), '..', 'lib' ) )
# NGM/TODO: setup both Proposal and Superblock, and insert related rows,
# including Events
def setup():
pass
#this is doog.
def teardown():
pass
#you SON O... | mit | Python | |
8c49123ccaf16a4513f8096475dd2b865cfee66f | Revert of Re-enable mobile memory tests. (https://codereview.chromium.org/414473002/) | markYoungH/chromium.src,PeterWangIntel/chromium-crosswalk,Pluto-tv/chromium-crosswalk,hgl888/chromium-crosswalk-efl,TheTypoMaster/chromium-crosswalk,ondra-novak/chromium.src,Chilledheart/chromium,krieger-od/nwjs_chromium.src,jaruba/chromium.src,ondra-novak/chromium.src,TheTypoMaster/chromium-crosswalk,littlstar/chromiu... | tools/perf/benchmarks/memory.py | tools/perf/benchmarks/memory.py | # Copyright 2013 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.
from measurements import memory
import page_sets
from telemetry import benchmark
@benchmark.Disabled('android') # crbug.com/370977
class MemoryMobile(benc... | # Copyright 2013 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.
from measurements import memory
import page_sets
from telemetry import benchmark
class MemoryMobile(benchmark.Benchmark):
test = memory.Memory
page_set... | bsd-3-clause | Python |
baff0200dfbe5ac33949f2fa3cddca72912b3b09 | add results.py | neurospin/pylearn-epac,neurospin/pylearn-epac | epac/results.py | epac/results.py | # -*- coding: utf-8 -*-
"""
Created on Fri May 17 16:37:54 2013
@author: edouard.duchesnay@cea.fr
"""
class Results(dict):
TRAIN = "tr"
TEST = "te"
SCORE = "score"
PRED = "pred"
TRUE = "true"
SEP = "_"
def __init__(self, **kwargs):
if kwargs:
self.add(**kwargs)
d... | bsd-3-clause | Python | |
553ba87b8858c11b2c2778d35a3c6e3694304278 | create the Spider of Turkey of McDonalds | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/mcdonalds_tr.py | locations/spiders/mcdonalds_tr.py | # -*- coding: utf-8 -*-
import scrapy
import json
import re
from locations.items import GeojsonPointItem
class McDonaldsTRSpider(scrapy.Spider):
name = 'mcdonalds_tr'
allowed_domains = ['www.mcdonalds.com.tr']
def start_requests(self):
url = 'https://www.mcdonalds.com.tr/Content/WebService... | mit | Python | |
0c100408bce925392ee1cae3b5b201ab4eb15112 | Add tests for VirHostNet processor | bgyori/indra,sorgerlab/belpy,sorgerlab/indra,sorgerlab/indra,sorgerlab/belpy,johnbachman/belpy,sorgerlab/belpy,johnbachman/belpy,johnbachman/indra,sorgerlab/indra,bgyori/indra,johnbachman/indra,bgyori/indra,johnbachman/indra,johnbachman/belpy | indra/tests/test_virhostnet.py | indra/tests/test_virhostnet.py | from indra.statements import Complex
from indra.sources import virhostnet
from indra.sources.virhostnet.api import data_columns
from indra.sources.virhostnet.processor import parse_psi_mi, parse_source_ids, \
parse_text_refs, get_agent_from_grounding, process_row
def test_get_agent_from_grounding():
ag = get_... | bsd-2-clause | Python | |
fab191fa1c490e8fb494417ba33e8f41c8ae4fec | Add a slice viewer widget class. | berendkleinhaneveld/Registrationshop,berendkleinhaneveld/Registrationshop | ui/widgets/SliceViewerWidget.py | ui/widgets/SliceViewerWidget.py | """
SliceViewerWidget
:Authors:
Berend Klein Haneveld
"""
from vtk import vtkRenderer
from vtk import vtkInteractorStyleUser
from vtk import vtkImagePlaneWidget
from vtk import vtkCellPicker
from PySide.QtGui import QGridLayout
from PySide.QtGui import QWidget
from PySide.QtCore import Signal
from ui.QVTKRenderWindo... | mit | Python | |
0fef9ab4e7a70a5e53cf5e5ae91d7cc5fd8b91da | Create xml_grabber.py | agusmakmun/Some-Examples-of-Simple-Python-Script,agusmakmun/Some-Examples-of-Simple-Python-Script | grabbing/xml_grabber.py | grabbing/xml_grabber.py | """XML TYPE
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>Q Blog</title>
<link>http://agus.appdev.my.id/feed/</link>
<description>Latest Posts of Q</description>
<atom:link href="http://agus.appdev.my.id/feed/" rel="self"></atom:link>
<la... | agpl-3.0 | Python | |
8fded9a735f40c4d4503ae01f1f5bb9592226bf6 | Add script to synchronize photos and poses from the 2019 porto IR dataset | fire-rs-laas/fire-rs-saop,fire-rs-laas/fire-rs-saop,fire-rs-laas/fire-rs-saop,fire-rs-laas/fire-rs-saop | python/fire_rs/neptus_mission_analysis.py | python/fire_rs/neptus_mission_analysis.py | # Copyright (c) 2019, CNRS-LAAS
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the... | bsd-2-clause | Python | |
6b6f7d225633e9c6bd406de695a1e52ce830a14e | Create feature_util.py | CSC591ADBI-TeamProjects/Product-Search-Relevance,CSC591ADBI-TeamProjects/Product-Search-Relevance | feature_util.py | feature_util.py | '''
Contains methods to extract features for training
'''
| mit | Python | |
88ff76fbc9275a327e016e9aef09d4ab2c3647e9 | test setup | nickmarton/Vivid | Classes/test_Classes/test_State.py | Classes/test_Classes/test_State.py | """Attribute System unit tests."""
import pytest
from ..State import State
| mit | Python | |
ae86eb3f7a3d7b2a8289f30c8d3d312c459710fb | update code laplacian article | Tulip4attoo/Tulip4attoo.github.io,Tulip4attoo/Tulip4attoo.github.io,Tulip4attoo/Tulip4attoo.github.io,Tulip4attoo/Tulip4attoo.github.io | assets/codes/laplacian_filter.py | assets/codes/laplacian_filter.py | import cv2
import numpy as np
from PIL import Image
image = cv2.imread("output.jpg")
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
laplacian0 = np.array(([0, 1, 0],
[1, -4, 1],
[0, 1, 0]), dtype="int")
laplacian1 = np.array(([1, 1, 1],
[1, -8, 1],
... | mit | Python | |
d892914381a3067fdd04d6d0af0aceda0c092039 | test staff | jscott1989/happening,happeninghq/happening,jscott1989/happening,jscott1989/happening,jscott1989/happening,happeninghq/happening,happeninghq/happening,happeninghq/happening | staff/tests/test_staff.py | staff/tests/test_staff.py | """Test sending emails."""
from happening.tests import TestCase
from model_mommy import mommy
from django.conf import settings
class TestStaff(TestCase):
"""Test staff views."""
def setUp(self):
"""Set up users."""
self.user = mommy.make(settings.AUTH_USER_MODEL, is_staff=True)
self... | mit | Python | |
a193f1d9b1816f72661254bba69c2c4a1e2c1b30 | Add tests for google menu | EndPointCorp/appctl,EndPointCorp/appctl | tests/extensions/functional/tests/test_google_menu.py | tests/extensions/functional/tests/test_google_menu.py | """
Google Menu tests
"""
from base import BaseTouchscreenTest
import time
from base import MAPS_URL, ZOOMED_IN_MAPS_URL, Pose
from base import screenshot_on_error, make_screenshot
import re
class TestGoogleMenu(BaseTouchscreenTest):
@screenshot_on_error
def test_google_menu_is_visible(self):
self.b... | apache-2.0 | Python | |
26df96a0c772c70013cc7a027022e84383ccaee2 | Add a helper script for converting -print-before-all output into a file based equivelent | llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm | utils/chunk-print-before-all.py | utils/chunk-print-before-all.py | #!/usr/bin/env python
# Given a -print-before-all -print-module-scope log from an opt invocation,
# chunk it into a series of individual IR files, one for each pass invocation.
# If the log ends with an obvious stack trace, try to split off a separate
# "crashinfo.txt" file leaving only the valid input IR in the last c... | apache-2.0 | Python | |
cd08fb72fea040d31394435bc6c1892bc208bcc0 | Add sumclip.py for WPA analysis | randomascii/tools,randomascii/tools,randomascii/tools | bin/sumclip.py | bin/sumclip.py | # Copyright 2016 Bruce Dawson. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | apache-2.0 | Python | |
34317172bc8b0cf6ec512181e7fac30bc4804cea | Create goingLoopyWithPython.py | AlexEaton1105/computerScience | goingLoopyWithPython.py | goingLoopyWithPython.py | # date: 11/09/15
# username: A1fus
# name: Alfie Bowman
# description: Going Loopy with Python
lines = 0 #defines variable
while lines <50: #causes Python to do anything indented until the condition is met
print("I will not mess about in Computer Science lessons") #prints the str
lines = lines + 1 ... | mit | Python | |
a90c05355c2735c0a8d2b87d12b143d91f801660 | make timeline of training output | deworrall92/groupConvolutions,deworrall92/harmonicConvolutions | bsd/epochizer.py | bsd/epochizer.py | '''Group ims'''
import os
import sys
import time
if __name | mit | Python | |
d3fa9df4c4f91ddb42954ea125ed69c2380ada62 | create python version of list_change_file_hashes | niyaton/kenja-java-parser,daiki1217/kenja,daiki1217/kenja,yum-kvn/kenja,niyaton/kenja,yum-kvn/kenja,niyaton/kenja | src/list_changed_file_hashes.py | src/list_changed_file_hashes.py | from git import Repo
import os
class CommitList:
def __init__(self, repo):
self.repo = repo
def print_all_blob_hashes(self):
hashes = set()
for commit in self.repo.iter_commits(self.repo.head):
for p in commit.parents:
diff = p.diff(commit)
... | mit | Python | |
c2d9801ada5f28267edfeaf090c3ce973a6197b4 | add breast_segment.py, implement threshold, initial documentation | olieidel/breast_segment | breast_segment/breast_segment.py | breast_segment/breast_segment.py | import numpy as np
from skimage.exposure import equalize_hist
from skimage.filters.rank import median
from skimage.measure import regionprops
from skimage.morphology import disk
from skimage.segmentation import felzenszwalb
from skimage.transform import rescale
from scipy.ndimage import binary_fill_holes
from scipy.mis... | mit | Python | |
5f3f2ce52569eb3ae57ab3e4a2eaff29fc0d6522 | add pyqt demo | cheenwe/cheenwe.github.io,cheenwe/cheenwe.github.io,cheenwe/cheenwe.github.io,cheenwe/cheenwe.github.io,cheenwe/cheenwe.github.io,cheenwe/cheenwe.github.io,cheenwe/cheenwe.github.io | study/python/pyqt/demo.py | study/python/pyqt/demo.py | from PyQt5.QtWidgets import QMainWindow, QPushButton , QWidget , QMessageBox, QApplication, QHBoxLayout
import sys, sqlite3
class WinForm(QMainWindow):
def __init__(self, parent=None):
super(WinForm, self).__init__(parent)
button1 = QPushButton('插入数据')
button2 = QPushButton('显示数据')
... | mit | Python | |
bf8328ff9b020bd3b99268744f86f94db2924011 | Create process.py | elecabfer/Bowtie,elecabfer/Bowtie | process.py | process.py | rm 1_*
rm 21_*
head *error.txt >> info_gg_unpaired.txt
source /mnt/common/epfl/etc/bbcf_bashrc ### para llamar a todos los programas de bbcf
module add UHTS/Analysis/samtools/1.2;
python -c "from bbcflib import mapseq"
for i in {2..48}
do
add_nh_flag "$i"_16S_gg.sam "$i"_SE_gg.bam
samtools sort "$i"_SE_gg.bam "$... | mit | Python | |
93589c7e139d3af4b0a949f107fc5e20ed69fee4 | add atop stats library | ronniedada/litmus,mikewied/cbagent,vmx/cbagent,couchbase/cbmonitor,ronniedada/litmus,couchbase/cbmonitor,pavel-paulau/cbagent,couchbase/cbagent | cbagent/collectors/libstats/atopstats.py | cbagent/collectors/libstats/atopstats.py | from uuid import uuid4
from fabric.api import run
from systemstats import SystemStats, multi_task, single_task
uhex = lambda: uuid4().hex
class AtopStats(SystemStats):
def __init__(self, hosts, user, password):
super(AtopStats, self).__init__(hosts, user, password)
self.logfile = "/tmp/{0}.at... | apache-2.0 | Python | |
a6c03ff9bc850248999afa3f597f460ee3eadc26 | Add lexer | 9seconds/curly | curly/lexer.py | curly/lexer.py | # -*- coding: utf-8 -*-
import collections
import re
import textwrap
def make_regexp(pattern):
pattern = textwrap.dedent(pattern)
pattern = re.compile(pattern, re.UNICODE | re.VERBOSE)
return pattern
class Token:
__slots__ = "contents", "raw_string"
REGEXP = make_regexp(".+")
def __ini... | mit | Python | |
8c65226b79ad0f7ac3487a117298498cff4b23be | Update cherry-pickup.py | kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015 | Python/cherry-pickup.py | Python/cherry-pickup.py | # Time: O(n^3)
# Space: O(n^2)
class Solution(object):
def cherryPickup(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
# dp holds the max # of cherries two k-length paths can pickup.
# The two k-length paths arrive at (i, k - i) and (j, k - j),
... | # Time: O(n^3)
# Space: O(n^2)
class Solution(object):
def cherryPickup(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
# dp holds the max # of cherries two k-length paths can pickup.
# The two k-length paths arrive at (i, k - i) and (j, k - j),
... | mit | Python |
43f2accb8cd4f63d62f7515bb5633296a7d592f0 | Add setup.py to spm. | carolFrohlich/nipype,fprados/nipype,grlee77/nipype,FredLoney/nipype,carolFrohlich/nipype,carolFrohlich/nipype,glatard/nipype,wanderine/nipype,blakedewey/nipype,iglpdc/nipype,sgiavasis/nipype,carlohamalainen/nipype,blakedewey/nipype,iglpdc/nipype,pearsonlab/nipype,fprados/nipype,satra/NiPypeold,gerddie/nipype,mick-d/nip... | nipype/interfaces/spm/setup.py | nipype/interfaces/spm/setup.py | def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('spm', parent_package, top_path)
config.add_data_dir('tests')
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
setup(**configuration(t... | bsd-3-clause | Python | |
4797918eec0c43ada3f6eb9a63ec2f275eced253 | Add spider for State Farm Agents; closes #519 | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/statefarm.py | locations/spiders/statefarm.py | import json
import re
import scrapy
from locations.items import GeojsonPointItem
class StateFarmSpider(scrapy.Spider):
name = "statefarm"
allowed_domains = ["statefarm.com"]
download_delay = 0.2
start_urls = [
'https://www.statefarm.com/agent/us',
]
def parse_location(self, response... | mit | Python | |
ebec02461bd341d49a499572d56bdef4520a650e | Add a missing migration | Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org | Instanssi/store/migrations/0007_storeitem_is_ticket.py | Instanssi/store/migrations/0007_storeitem_is_ticket.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-11 22:21
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('store', '0006_auto_20161209_0015'),
]
operations = [
migrations.AddField(
... | mit | Python | |
cb01c58e0d11999331eb01e33bf970db8742f2f8 | Create VertexGlyphFilter.py | lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples | src/Python/Filtering/VertexGlyphFilter.py | src/Python/Filtering/VertexGlyphFilter.py | #!/usr/bin/env python
import vtk
def main():
colors = vtk.vtkNamedColors()
points = vtk.vtkPoints()
points.InsertNextPoint(0,0,0)
points.InsertNextPoint(1,1,1)
points.InsertNextPoint(2,2,2)
polydata = vtk.vtkPolyData()
polydata.SetPoints(points)
vertexGlyphFilter = vtk.vtkVert... | apache-2.0 | Python | |
d2536ce3ded4fc2ea5648025f04efa093629b70f | test rapapasswords table | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | test/rapapasswordstest.py | test/rapapasswordstest.py | #!/usr/bin/python2.4
#
# Copyright (c) 2005-2007 rPath, Inc.
#
import testsuite
testsuite.setup()
import os
import sys
import time
import tempfile
import fixtures
from mint import rapapasswords
class rAPAPasswordsTest(fixtures.FixturedUnitTest):
@fixtures.fixture("Full")
def testPasswords(self, db, data):
... | apache-2.0 | Python | |
45e86e49e845ef25df6e1db3bcb336809ffb5f5f | Disable IPv6 on wireless (Extension Attribute for Casper) | killahquam/JAMF,killahquam/JAMF | ipv6_Checker.py | ipv6_Checker.py | #!/usr/bin/python
#Copyright 2014 Quam Sodji
import subprocess
def getinfo(hardware): #Return network info on select interface
info = subprocess.check_output(["networksetup", "-getinfo", hardware])
return info
wireless = ["Airport", "Wi-Fi"] #The two type of interfaces that refers to wireless
list_network... | mit | Python | |
c68872453a0c4a28e31d5ee38faf11d8a0486b62 | add drone_setup.py | dronesmith/Radiation-Detection-Example,dronesmith/Radiation-Detection-Example | drone_setup.py | drone_setup.py | import requests
import json
# Open user-account.json and create a json object containing
# user credential fields.
with open('user-account.json', "r") as jsonFile:
jsonUser = json.load(jsonFile)
jsonFile.close()
# Assign user credentials to variables
USER_EMAIL = jsonUser[0]['email']
USER_API_KEY = jsonUser[0][... | bsd-3-clause | Python | |
a5ff02a696c553dbd4038e1cb1c0fd0668b30006 | Create ets2look.py | NixillUmbreon/Scripts | FreePIE/ets2look.py | FreePIE/ets2look.py | hSen = 750
vSen = 200
if starting:
lastX = 0
lastY = 0
thisX = xbox360[0].rightStickX * hSen
thisY = xbox360[0].rightStickY * vSen
mouse.deltaX = thisX - lastX
mouse.deltaY = lastY - thisY
lastX = thisX
lastY = thisY
| mit | Python | |
7bea7133d8b069e784b8e35e045a6411cac8882c | add movielens (#1027) | intel-analytics/BigDL,intel-analytics/BigDL,yangw1234/BigDL,yangw1234/BigDL,intel-analytics/BigDL,yangw1234/BigDL,intel-analytics/BigDL,yangw1234/BigDL | python/dllib/src/bigdl/dllib/feature/dataset/movielens.py | python/dllib/src/bigdl/dllib/feature/dataset/movielens.py | #
# Copyright 2016 The BigDL Authors.
#
# 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 ... | apache-2.0 | Python | |
46b7dd2c389d2bf020e2c413518e0f960fa28ba4 | Add test for current_locale expression | rmoorman/sqlalchemy-i18n,kvesteri/sqlalchemy-i18n | tests/test_expressions.py | tests/test_expressions.py | from sqlalchemy_i18n.expressions import current_locale
class TestCurrentLocaleExpression(object):
def test_render(self):
assert str(current_locale()) == ':current_locale'
| bsd-3-clause | Python | |
3d33aeb24018943ffcc1fdc7a537d871f804a3ab | Add test file | blink1073/pexpect,blink1073/pexpect,blink1073/pexpect | tests/test_popen_spawn.py | tests/test_popen_spawn.py | #!/usr/bin/env python
'''
PEXPECT LICENSE
This license is approved by the OSI and FSF as GPL-compatible.
http://opensource.org/licenses/isc-license.txt
Copyright (c) 2012, Noah Spurrier <noah@noah.org>
PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY
PURPOSE WITH OR WIT... | isc | Python | |
633f5ad8064395ec3805e38ea1f73a9aa7475878 | Use the caller's unpickler as well | dongguangming/jsonpickle,dongguangming/jsonpickle,dongguangming/jsonpickle,mandx/jsonpickle,mandx/jsonpickle,dongguangming/jsonpickle,mandx/jsonpickle,mandx/jsonpickle | jsonpickle/_handlers.py | jsonpickle/_handlers.py | import datetime
import jsonpickle
class DatetimeHandler(jsonpickle.handlers.BaseHandler):
"""
Datetime objects use __reduce__, and they generate binary strings encoding
the payload. This handler encodes that payload to reconstruct the
object.
"""
def flatten(self, obj, data):
pickler =... | import datetime
import jsonpickle
class DatetimeHandler(jsonpickle.handlers.BaseHandler):
"""
Datetime objects use __reduce__, and they generate binary strings encoding
the payload. This handler encodes that payload to reconstruct the
object.
"""
def flatten(self, obj, data):
pickler =... | bsd-3-clause | Python |
f1f654d823ee8454b53f27372bbaab85f4d01631 | add analyzer | DBCDK/serviceprovider,DBCDK/serviceprovider | performancetest/rec-analyze.py | performancetest/rec-analyze.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import division
import re
import sys
import os
import json
import numpy as np
def f(n):
return int(round(n))
def report(name, seq):
print '===', name, '[ms] ==='
print "mean:", f(np.mean(seq)), "\tstd dev:", f(np.std(seq))
print "95%:", ... | agpl-3.0 | Python | |
e7809f307610e98cb8356110eec7e8c1f41e9d46 | Backup script. | couchbaselabs/ep-engine,teligent-ru/ep-engine,owendCB/ep-engine,sriganes/ep-engine,daverigby/kv_engine,jimwwalker/ep-engine,membase/ep-engine,zbase/ep-engine,zbase/ep-engine,membase/ep-engine,abhinavdangeti/ep-engine,couchbase/ep-engine,abhinavdangeti/ep-engine,jimwwalker/ep-engine,teligent-ru/ep-engine,daverigby/ep-en... | management/backup.py | management/backup.py | #!/usr/bin/env python
import sys
import os
import glob
import shutil
import mc_bin_client
def usage():
print >> sys.stderr, """
Usage: %s <dest_dir>
""" % os.path.basename(sys.argv[0])
sys.exit(1)
def main():
if len(sys.argv) != 2:
usage()
cmd_dir = os.path.dirname(sys.argv[0])
dest_dir =... | apache-2.0 | Python | |
2945b68d5a8b6505f1a8516dd8b5f7d4b85aac5a | Add tests for storeslice | sklam/numba,IntelLabs/numba,gmarkall/numba,pitrou/numba,stuartarchibald/numba,GaZ3ll3/numba,cpcloud/numba,gmarkall/numba,stuartarchibald/numba,stefanseefeld/numba,stonebig/numba,pombredanne/numba,pombredanne/numba,jriehl/numba,jriehl/numba,stonebig/numba,jriehl/numba,GaZ3ll3/numba,ssarangi/numba,GaZ3ll3/numba,pombredan... | numba/tests/test_storeslice.py | numba/tests/test_storeslice.py | from __future__ import print_function
import numba.unittest_support as unittest
import numpy as np
from numba.compiler import compile_isolated, Flags
def usecase(obs, nPoints, B, sigB, A, sigA, M, sigM):
center = nPoints / 2
print(center)
obs[0:center] = np.arange(center)
obs[center] = 321
obs[(ce... | bsd-2-clause | Python | |
c468f49e50b7a55995ef1fc447c04993c2171ca2 | Add lc0242_valid_anagram.py | bowen0701/algorithms_data_structures | lc0242_valid_anagram.py | lc0242_valid_anagram.py | """Leetcode 242. Valid Anagram
Easy
URL: https://leetcode.com/problems/valid-anagram/
Given two strings s and t,
write a function to determine if t is an anagram of s.
Example 1:
Input: s = "anagram", t = "nagaram"
Output: true
Example 2:
Input: s = "rat", t = "car"
Output: false
Note:
You may assume the string co... | bsd-2-clause | Python | |
dbb812621c58d92bc3c2aed6135ddb9b91cd9181 | implement bucket compaction test | EricACooper/perfrunner,couchbase/perfrunner,couchbase/perfrunner,pavel-paulau/perfrunner,pavel-paulau/perfrunner,couchbase/perfrunner,EricACooper/perfrunner,hsharsha/perfrunner,mikewied/perfrunner,mikewied/perfrunner,hsharsha/perfrunner,PaintScratcher/perfrunner,vmx/perfrunner,couchbase/perfrunner,pavel-paulau/perfrunn... | perfrunner/tests/compaction.py | perfrunner/tests/compaction.py | from perfrunner.tests import TargetIterator
from perfrunner.tests.kv import KVTest
class DbCompactionTest(KVTest):
def compact(self):
self.reporter.start()
for target_settings in TargetIterator(self.cluster_spec,
self.test_config):
self.re... | apache-2.0 | Python | |
c2982060ff7ffbbf784a37675f2caec381e9aa48 | Create quicksort.py | saru95/DSA,saru95/DSA,saru95/DSA,saru95/DSA,saru95/DSA | Python/quicksort.py | Python/quicksort.py | def quickSort(arr):
less = []
pivotList = []
more = []
if len(arr) <= 1:
return arr
else:
pivot = arr[0]
for i in arr:
if i < pivot:
less.append(i)
elif i > pivot:
more.append(i)
else:
pivotLi... | mit | Python | |
592f9901f9125534f59efc2cb36bb4fb2bab351e | Fix typo (#8754) | jnewland/home-assistant,persandstrom/home-assistant,nugget/home-assistant,LinuxChristian/home-assistant,fbradyirl/home-assistant,GenericStudent/home-assistant,tchellomello/home-assistant,nugget/home-assistant,mKeRix/home-assistant,persandstrom/home-assistant,mezz64/home-assistant,mKeRix/home-assistant,DavidLP/home-assi... | homeassistant/scripts/__init__.py | homeassistant/scripts/__init__.py | """Home Assistant command line scripts."""
import argparse
import importlib
import logging
import os
import sys
from typing import List
from homeassistant.bootstrap import mount_local_lib_path
from homeassistant.config import get_default_config_dir
from homeassistant.const import CONSTRAINT_FILE
from homeassistant.ut... | """Home Assistant command line scripts."""
import argparse
import importlib
import logging
import os
import sys
from typing import List
from homeassistant.bootstrap import mount_local_lib_path
from homeassistant.config import get_default_config_dir
from homeassistant.const import CONSTRAINT_FILE
from homeassistant.ut... | apache-2.0 | Python |
0aaed7764d743afe46af503fe5938fa718fe3abc | Set up contextmanager for db cals | nathanljustin/teamwork-analysis,nathanljustin/teamwork-analysis,nathanljustin/teamwork-analysis,nathanljustin/teamwork-analysis | teamworkApp/lib/dbCalls.py | teamworkApp/lib/dbCalls.py | # muddersOnRails()
# Sara McAllister November 5, 2-17
# Last updated: 11-5-2017
# library for SQLite database calls for teamwork analysis app
import contextlib
import sqlite3
DB = 'db/development.sqlite3'
def connect(sqlite_file):
""" Make connection to an SQLite database file """
conn = sqlite3.connect(sql... | mit | Python | |
6e5074cf969f8667e633ab2fa3373e83402e7610 | Add DigitalOcean | jpaugh/agithub,mozilla/agithub | agithub/DigitalOcean.py | agithub/DigitalOcean.py | # Copyright 2012-2016 Jonathan Paugh and contributors
# See COPYING for license details
from base import *
class DigitalOcean(API):
'''
Digital Ocean API
'''
def __init__(self, token=None, *args, **kwargs):
props = ConnectionProperties(
api_url = 'api.digitalocean.com',
... | mit | Python | |
18aeea496175cb73ccf0d9f164359f75f854b512 | add background_helper | DOAJ/doaj,DOAJ/doaj,DOAJ/doaj,DOAJ/doaj | portality/background_helper.py | portality/background_helper.py | """ collections of wrapper function for helping you to create BackgroundTask
"""
from typing import Callable, Type
from portality import models
from portality.background import BackgroundApi, BackgroundTask
from portality.core import app
def execute_by_job_id(job_id,
task_factory: Callable[[mo... | apache-2.0 | Python | |
caef73c6d7d9853e32f5a75b321f515f3c138b6d | Create nzbget.py | Comandarr/Comandarr | comandarr/nzbget.py | comandarr/nzbget.py | apache-2.0 | Python | ||
853972cac73c3837c37a5682c2057a0aab500961 | Add tests for VAE framework | lisa-lab/pylearn2,nouiz/pylearn2,CIFASIS/pylearn2,msingh172/pylearn2,JesseLivezey/pylearn2,fyffyt/pylearn2,hyqneuron/pylearn2-maxsom,CIFASIS/pylearn2,abergeron/pylearn2,lunyang/pylearn2,TNick/pylearn2,kastnerkyle/pylearn2,JesseLivezey/pylearn2,goodfeli/pylearn2,goodfeli/pylearn2,woozzu/pylearn2,se4u/pylearn2,lancezlin/... | pylearn2/models/tests/test_vae.py | pylearn2/models/tests/test_vae.py | import numpy
import theano
import theano.tensor as T
from pylearn2.models.mlp import MLP
from pylearn2.models.mlp import Linear, ConvRectifiedLinear
from pylearn2.models.vae import VAE
from pylearn2.models.vae.visible import BinaryVisible
from pylearn2.models.vae.latent import DiagonalGaussianPrior
from pylearn2.space ... | bsd-3-clause | Python | |
bf1e9434afc03a21cab5b274401a755c3b84196c | add event.brochure migration | Ircam-Web/mezzanine-organization,Ircam-Web/mezzanine-organization | migrations/mezzanine_agenda/0014_event_brochure.py | migrations/mezzanine_agenda/0014_event_brochure.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-05-10 13:56
from __future__ import unicode_literals
from django.db import migrations
import mezzanine.core.fields
class Migration(migrations.Migration):
dependencies = [
('mezzanine_agenda', '0013_auto_20160510_1542'),
]
operations = [... | agpl-3.0 | Python | |
fa95e31128e7dcfbbbbab5f48675536ba1b5ebf2 | Add amazon/ec2_instance_status_checks | sailthru/ansible-oss,sailthru/ansible-oss | modules/cloud/amazon/ec2_instance_status_checks.py | modules/cloud/amazon/ec2_instance_status_checks.py | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
module: ec2_instance_status_checks
short description: Perform instance status checks with wait option
description:
- Perform instance status checks
- Wait for x seconds for the status ... | apache-2.0 | Python | |
cfa474b489bc02307cc4944d30fbb34b57f843f6 | Add base connection tests | tych0/pylxd,lxc/pylxd,ivuk/pylxd,Saviq/pylxd,javacruft/pylxd,lxc/pylxd | pylxd/tests/test_connection.py | pylxd/tests/test_connection.py | # Copyright (c) 2015 Canonical Ltd
#
# 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 ... | apache-2.0 | Python | |
d0afa54fa01a2981c10f0bbdbc0f5eab4b5ad710 | test that test fullscreen/resize with 3d actions | google-code-export/los-cocos,google-code-export/los-cocos | test/test_3d_fullscreen.py | test/test_3d_fullscreen.py | # This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import pyglet
import cocos
from cocos.director import director
from cocos.actions import *
from cocos.layer import *
class BackgroundLayer( cocos.layer.La... | bsd-3-clause | Python | |
7b4a23758e40dbbd131df930b617a5c08659cca9 | Create app.py | msmexplorer/msmexplorer-d3,msmexplorer/msmexplorer-d3,cxhernandez/msmexplorer-d3,cxhernandez/msmexplorer-d3,msmexplorer/msmexplorer-d3,cxhernandez/msmexplorer-d3 | app.py | app.py | #!/Users/cu3alibre/anaconda/bin/python
import os, optparse, uuid, urlparse, time
from threading import Lock
from urllib import urlencode
from pymongo import Connection
import tornado.ioloop
from tornado.web import (RequestHandler, StaticFileHandler, Application,asynchronous)
from tornado.websocket import WebSocketHand... | mit | Python | |
126af71599e14866501e2e9f479b2658fff56526 | Create ipc_lista2.06.py | any1m1c/ipc20161 | lista2/ipc_lista2.06.py | lista2/ipc_lista2.06.py | apache-2.0 | Python | ||
dac5f9e406f3c205d6ed212d4414ca55c94b8f15 | Add test for exact search with album query | pacificIT/mopidy,hkariti/mopidy,bencevans/mopidy,jmarsik/mopidy,swak/mopidy,swak/mopidy,diandiankan/mopidy,vrs01/mopidy,dbrgn/mopidy,jodal/mopidy,tkem/mopidy,quartz55/mopidy,hkariti/mopidy,ali/mopidy,swak/mopidy,mokieyue/mopidy,mokieyue/mopidy,swak/mopidy,dbrgn/mopidy,SuperStarPL/mopidy,kingosticks/mopidy,tkem/mopidy,g... | tests/local/test_search.py | tests/local/test_search.py | from __future__ import unicode_literals
import unittest
from mopidy.local import search
from mopidy.models import Album, Track
class LocalLibrarySearchTest(unittest.TestCase):
def test_find_exact_with_album_query(self):
expected_tracks = [Track(album=Album(name='foo'))]
tracks = [Track(), Track(... | apache-2.0 | Python | |
a99e92756a10529ca1e52d1d351bc43fea067b35 | Add fabfile for API | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | packaging/radar-api/fabfile.py | packaging/radar-api/fabfile.py | import os
import re
from fabric.api import task, put, run, cd
@task
def deploy(archive=None, name='radar-api'):
if archive is None:
# Use the latest archive by default
archive = sorted(x for x in os.listdir('.') if x.endswith('.tar.gz'))[-1]
version = re.search('-([^-]+-[^-]+)\.tar\.gz$', ar... | agpl-3.0 | Python | |
246ed2ba33f21b696af2a00793a521bc77da2a45 | add excel-sheet-column-title | zeyuanxy/leet-code,zeyuanxy/leet-code,EdisonAlgorithms/LeetCode,EdisonAlgorithms/LeetCode,EdisonAlgorithms/LeetCode,zeyuanxy/leet-code | vol4/excel-sheet-column-title/excel-sheet-column-title.py | vol4/excel-sheet-column-title/excel-sheet-column-title.py | import string
class Solution(object):
def convertToTitle(self, n):
"""
:type n: int
:rtype: str
"""
alphabet = string.uppercase
ret = ''
while n > 0:
ret = alphabet[(n - 1) % 26] + ret
n = (n - 1) / 26
return ret
| mit | Python | |
2674b886b786086ec62a18b953e80ec6fceaa59d | Bump subminor version (2.0.5 -> 2.0.6) | inklesspen/endpoints-python,inklesspen/endpoints-python,cloudendpoints/endpoints-python,cloudendpoints/endpoints-python | endpoints/__init__.py | endpoints/__init__.py | #!/usr/bin/python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | #!/usr/bin/python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | apache-2.0 | Python |
0ca298f6706706637dccd4f27c56eed6e91c98ba | Rename new test class correctly and flesh out first passing tests | mattrobenolt/invoke,pyinvoke/invoke,mattrobenolt/invoke,pyinvoke/invoke,kejbaly2/invoke,frol/invoke,tyewang/invoke,pfmoore/invoke,mkusz/invoke,mkusz/invoke,pfmoore/invoke,singingwolfboy/invoke,kejbaly2/invoke,frol/invoke | tests/runners.py | tests/runners.py | import sys
from spec import Spec, trap, eq_
from invoke import Local, Context
from _utils import mock_subprocess
class Local_(Spec):
class run:
@trap
@mock_subprocess(out="sup")
def out_stream_defaults_to_sys_stdout(self):
"out_stream defaults to sys.stdout"
Loca... | from spec import Spec
class Runner_(Spec):
class run:
def out_stream_defaults_to_sys_stdout(self):
"out_stream defaults to sys.stdout"
def err_stream_defaults_to_sys_stderr(self):
"err_stream defaults to sys.stderr"
def out_stream_can_be_overridden(self):
... | bsd-2-clause | Python |
f6bd8bcf45d182e3aa8edd3cf0fef5aa35125e31 | create ccc.py | piraaa/VideoDigitalWatermarking | src/ccc.py | src/ccc.py | #
# ccc.py
# Created by pira on 2017/07/28.
#
| mit | Python | |
0843eba3476809e833ea52611d9e193bf0872dbd | Add Back Builder Code | littleskunk/dataserv,F483/dataserv,Storj/dataserv | tools/Builder.py | tools/Builder.py | import os
import hashlib
import RandomIO
# config vars
my_address = "1CutsncbjcCtZKeRfvQ7bnYFVj28zeU6fo"
my_store_path = "C://Farm/"
my_shard_size = 1024*1024*128 # 128 MB
my_max_size = 1024*1024*640 # 640 MB
class Builder:
def __init__(self, address, shard_size, max_size):
self.address = address
... | mit | Python | |
8e74d76a96b0b259bf7d8a4022fae8293749f37d | Add module uniprocessing.py | kolyat/chainsyn,kolyat/chainsyn | uniprocessing.py | uniprocessing.py | # Copyright (c) 2016 Kirill 'Kolyat' Kiselnikov
# This file is the part of chainsyn, released under modified MIT license
# See the file LICENSE.txt included in this distribution
"""
Module "uniprocessing" with patterns and universal processing function
process() - function that process one chain to another using given... | mit | Python | |
8b7d1ffb2461e12b5cbce6873e51ca14f9d8cf90 | Revert "Accidentally deleted manage.py" | eSmelser/SnookR,eSmelser/SnookR,eSmelser/SnookR,eSmelser/SnookR | SnookR/manage.py | SnookR/manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "SnookR.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | mit | Python | |
202c8472298780cbf80bf3253550e4277236c0c9 | add simple noise fitting code | ColumbiaCMB/kid_readout,ColumbiaCMB/kid_readout | kid_readout/analysis/noise_fit.py | kid_readout/analysis/noise_fit.py | import numpy as np
import lmfit
from kid_readout.analysis import fitter
print "k"
def lorenz(f,fc,a):
return a/(1+(f/fc)**2)
def simple_noise_model(params,f):
A = params['A'].value
fc = params['fc'].value
nw = params['nw'].value
return lorenz(f,fc,A) + nw
def simple_noise_guess(f,S):
params = ... | bsd-2-clause | Python | |
5879e59f34e31707f207c588143711dbdf18ee8b | remove login_required for register page | gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin | app/main/views/index.py | app/main/views/index.py | from flask import render_template
from flask_login import login_required
from app.main import main
@main.route('/')
def index():
return render_template('signedout.html')
@main.route("/govuk")
def govuk():
return render_template('govuk_template.html')
@main.route("/register")
def register():
return re... | from flask import render_template
from flask_login import login_required
from app.main import main
@main.route('/')
def index():
return render_template('signedout.html')
@main.route("/govuk")
def govuk():
return render_template('govuk_template.html')
@main.route("/register")
@login_required
def register(... | mit | Python |
42c496c78fe2dcc06df65641ba1df33c02e41533 | Revert "updates" | jamesacampbell/python-examples,jamesacampbell/python-examples | cvlib_example.py | cvlib_example.py | """Example using cvlib."""
import cvlib as cv
from cvlib.object_detection import draw_bbox
import cv2
img = image = cv2.imread("assets/sv.jpg")
bbox, label, conf = cv.detect_common_objects(img, model="largess")
print(label)
output_image = draw_bbox(img, bbox, label, conf)
cv2.imwrite("cvlib-example-out.jpg", output_i... | mit | Python | |
5831dee7a6c14c85933658610ae991fbc0af9442 | Add basic tests for stream.me plugin (#391) | wlerin/streamlink,javiercantero/streamlink,gravyboat/streamlink,bastimeyer/streamlink,mmetak/streamlink,beardypig/streamlink,bastimeyer/streamlink,melmorabity/streamlink,chhe/streamlink,beardypig/streamlink,streamlink/streamlink,back-to/streamlink,javiercantero/streamlink,chhe/streamlink,gravyboat/streamlink,wlerin/str... | tests/test_plugin_streamme.py | tests/test_plugin_streamme.py | import unittest
from streamlink.plugins.streamme import StreamMe
class TestPluginStreamMe(unittest.TestCase):
def test_can_handle_url(self):
# should match
self.assertTrue(StreamMe.can_handle_url("http://www.stream.me/nameofstream"))
# shouldn't match
self.assertFalse(StreamMe.ca... | bsd-2-clause | Python | |
2b9909004a761047fd935ad51b06102032dbe30a | Create __init__.py | numenta/nupic.research,numenta/nupic.research | src/nupic/research/frameworks/htm/temporal_memory/__init__.py | src/nupic/research/frameworks/htm/temporal_memory/__init__.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2022, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | agpl-3.0 | Python | |
09ad948086712793cc0bbf81d5515ef31823a085 | test for committee attendance | Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2 | tests/unit/test_attendance.py | tests/unit/test_attendance.py | from tests import PMGTestCase
from pmg.models import db, CommitteeMeeting, CommitteeMeetingAttendance, Committee, House, Province, Party, Member
class TestCommitteeMeetingAttendance(PMGTestCase):
def setUp(self):
super(TestCommitteeMeetingAttendance, self).setUp()
province = Province(name='Western... | apache-2.0 | Python | |
4ebfc2e6ffb21fd55ef1fc4f1fd836153b2da545 | Add tests for all exceptions | rainmattertech/pykiteconnect | tests/unit/test_exceptions.py | tests/unit/test_exceptions.py | # coding: utf-8
import pytest
import responses
import kiteconnect.exceptions as ex
@responses.activate
def test_wrong_json_response(kiteconnect):
responses.add(
responses.GET,
"%s%s" % (kiteconnect.root, kiteconnect._routes["portfolio.positions"]),
body="{a:b}",
content_type="appl... | mit | Python | |
cec436eba6174fbf52dc7908e1d5218cd9bea1e7 | add tests around internal classes of Vcf class | ernfrid/svtools,abelhj/svtools,ernfrid/svtools,abelhj/svtools,abelhj/svtools,abelhj/svtools,hall-lab/svtools,hall-lab/svtools,hall-lab/svtools | tests/vcf_tests/file_tests.py | tests/vcf_tests/file_tests.py | from unittest import TestCase, main
from svtools.vcf.file import Vcf
class Test_Format(TestCase):
def test_init(self):
f = Vcf.Format('GT', 1, 'String', '"Genotype"')
self.assertEqual(f.id, 'GT')
self.assertEqual(f.number, '1')
self.assertEqual(f.type, 'String')
self.assertE... | mit | Python | |
f131cd221b2ce6fc144b2aa9882cb0ad1b116675 | Add (failing) tests for the dashboard | SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange | tests/views/test_dashboard.py | tests/views/test_dashboard.py | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# 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 applic... | apache-2.0 | Python | |
920870a310a3c32b851dfe5927aad48d7b86b0c0 | Update model verbose names | dbinetti/barberscore-django,dbinetti/barberscore,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore,barberscore/barberscore-api,dbinetti/barberscore-django,barberscore/barberscore-api | project/bhs/migrations/0008_auto_20190514_0904.py | project/bhs/migrations/0008_auto_20190514_0904.py | # Generated by Django 2.1.8 on 2019-05-14 16:04
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bhs', '0007_auto_20190513_1349'),
]
operations = [
migrations.AlterModelOptions(
name='group',
options={'ordering': ['tree_s... | bsd-2-clause | Python | |
226c2f36b9cc8257ce99bd15648be4aba2ccb606 | Move utility functions for checking passported benefits into separate module | ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public | cla_public/apps/checker/utils.py | cla_public/apps/checker/utils.py | from cla_public.apps.checker.constants import PASSPORTED_BENEFITS, \
NASS_BENEFITS
def passported(benefits):
return bool(set(benefits).intersection(PASSPORTED_BENEFITS))
def nass(benefits):
return bool(set(benefits).intersection(NASS_BENEFITS))
| mit | Python | |
6185e7bbc12c3bc9aba1efcfd53275cc109f2e91 | Add a snippet. | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/pyqt/pyqt5/widget_QPainter_draw_polygon.py | python/pyqt/pyqt5/widget_QPainter_draw_polygon.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# See https://www.youtube.com/watch?v=96FBrNR3XOY
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, QLabel, QVBoxLayout
from PyQt5.QtGui import QPainter, QBrush, QColor, QPen, QPolygon
from PyQt5.QtCore import Qt, QPoint
class MyPaintWidget(QWi... | mit | Python | |
d56b94ef5acaafcaf11ebcb4ccb5b61390448974 | Update loading to use results.AddValue(...) | M4sse/chromium.src,dushu1203/chromium.src,PeterWangIntel/chromium-crosswalk,Fireblend/chromium-crosswalk,Chilledheart/chromium,ltilve/chromium,mohamed--abdel-maksoud/chromium.src,ondra-novak/chromium.src,TheTypoMaster/chromium-crosswalk,dushu1203/chromium.src,hgl888/chromium-crosswalk-efl,bright-sparks/chromium-spacewa... | tools/perf/metrics/loading.py | tools/perf/metrics/loading.py | # Copyright 2013 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.
from metrics import Metric
from telemetry.value import scalar
class LoadingMetric(Metric):
"""A metric for page loading time based entirely on window.perf... | # Copyright 2013 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.
from metrics import Metric
class LoadingMetric(Metric):
"""A metric for page loading time based entirely on window.performance"""
def Start(self, page,... | bsd-3-clause | Python |
84009965977b9b0508ae5ec50b28acd0c2828ae2 | Add untested script to download fasta files from ncbi with the GI | maubarsom/biotico-tools,maubarsom/biotico-tools,maubarsom/biotico-tools,maubarsom/biotico-tools,maubarsom/biotico-tools | python/download_fastas_ncbi.py | python/download_fastas_ncbi.py | #!/usr/bin/env python
"""
Download fastas from a list of gi identifiers of the form
gi|xxxx| from a specified NCBI database
Author: Mauricio Barrientos-Somarribas
Email: mauricio.barrientos@ki.se
Copyright 2014 Mauricio Barrientos-Somarribas
Licensed under the Apache License, Version 2.0 (the "License");
you may n... | apache-2.0 | Python | |
7d917f7cbf6f00eec93d97adcdb545ae55c5b345 | Add core actions file | opps/opps,williamroot/opps,opps/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,jeanmask/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,opps/opps,opps/opps,YACOWS/opps,YACOWS/opps,williamroot/opps,jeanmask/opps | opps/core/actions.py | opps/core/actions.py | # coding: utf-8
import csv
from django.http import HttpResponse
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
def export_to_csv(modeladmin, request, queryset):
"""Exporting queryset results and filter into CSV"""
# limit only staff and super_user accounts
if re... | mit | Python | |
65245e2ef91952f3d9383f520f8e875b8a2a2648 | add translate type | CenterForOpenScience/modular-odm,sloria/modular-odm,chrisseto/modular-odm,icereval/modular-odm | modularodm/fields/BooleanField.py | modularodm/fields/BooleanField.py | from . import Field
from ..validators import validate_boolean
class BooleanField(Field):
# default = False
validate = validate_boolean
translate_type = bool
def __init__(self, *args, **kwargs):
super(BooleanField, self).__init__(*args, **kwargs) | from . import Field
from ..validators import validate_boolean
class BooleanField(Field):
# default = False
validate = validate_boolean
def __init__(self, *args, **kwargs):
super(BooleanField, self).__init__(*args, **kwargs) | apache-2.0 | Python |
3fb4146b53c88695a9941b591c22362ccd5b211d | Create Flyweight.py | QuantumFractal/Python-Scripts,QuantumFractal/Python-Scripts | DesignPatterns/Flyweight.py | DesignPatterns/Flyweight.py | '''
Flyweight. A design pattern used solely for efficiency with
large arrays of nearly indentical objects.
A simple world generator
Written in python for simplicity sake.
For more info >> http://gameprogrammingpatterns.com/command.html
'''
from random import *
class World:
def __init__(self, width, height):
sel... | mit | Python | |
ef2bad889159941b344808cb88179135d3908f19 | Add missing file | FabriceSalvaire/grouped-purchase-order,FabriceSalvaire/grouped-purchase-order,FabriceSalvaire/grouped-purchase-order,FabriceSalvaire/grouped-purchase-order | GroupedPurchaseOrder/api.py | GroupedPurchaseOrder/api.py | ####################################################################################################
#
# GroupedPurchaseOrder - A Django Application.
# Copyright (C) 2014 Fabrice Salvaire
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Li... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.