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 |
|---|---|---|---|---|---|---|---|---|
f2864289f02a6e221d6fafbb1885d20aa26417fd | Add default conftest | buddly27/champollion | test/unit/conftest.py | test/unit/conftest.py | # :coding: utf-8
import os
import shutil
import tempfile
import uuid
import pytest
@pytest.fixture()
def unique_name():
"""Return a unique name."""
return "unique-{0}".format(uuid.uuid4())
@pytest.fixture()
def temporary_file(request):
"""Return a temporary file path."""
file_handle, path = tempfi... | apache-2.0 | Python | |
1dba0fb24f98bb09bd0c918439c0457c603e1386 | Create ullman.py | mryalamanchi/Ullman-Foundations-of-CS | ullman.py | ullman.py | import requests
from multiprocessing import Pool
import time
startURL = 'http://i.stanford.edu/~ullman/focs/ch'
extension = '.pdf'
savePath = '' #enter the path for the pdfs to be stored on your system
chapters = range(1,15) #chapters 1-14
def chapterStringManipulate(chapter):
if chapter < 10 :
download('0{}'.f... | mit | Python | |
9d3925c4809791d2366bc1d6fd6b04bc8a710c9b | add fmt to repo | brentp/toolshed,pombredanne/toolshed | toolshed/fmt.py | toolshed/fmt.py | import re
def fmt2header(fmt):
"""
Turn a python format string into a usable header:
>>> fmt = "{chrom}\t{start:d}\t{end:d}\t{pvalue:.4g}"
>>> fmt2header(fmt)
'chrom start end pvalue'
>>> fmt.format(chrom='chr1', start=1234, end=3456, pvalue=0.01232432)
'chr1 1234 3456 0.01232... | bsd-2-clause | Python | |
dd9b683b24cea02c93a6e23a163065c0f26f6a68 | Test manager | stanfordnmbl/osim-rl,vzhuang/osim-rl | tests/test.manager.py | tests/test.manager.py | import opensim
model_path = "../osim/models/arm2dof6musc.osim"
model = opensim.Model(model_path)
model.setUseVisualizer(True)
state = model.initSystem()
manager = opensim.Manager(model)
muscleSet = model.getMuscles()
stepsize = 0.01
for i in range(10):
for j in range(muscleSet.getSize()):
# muscleSet.get(j... | mit | Python | |
5d18f7c7145bf8d5e7248392d644e521222929b8 | add tests for _extras | myint/rstcheck,myint/rstcheck | tests/test__extras.py | tests/test__extras.py | """Tests for ``_extras`` module."""
import pytest
from rstcheck import _compat, _extras
class TestInstallChecker:
"""Test ``is_installed_with_supported_version``."""
@staticmethod
@pytest.mark.skipif(_extras.SPHINX_INSTALLED, reason="Test for absence of sphinx.")
def test_false_on_missing_sphinx_pac... | mit | Python | |
eb1c7d1c2bfaa063c98612d64bbe35dedf217143 | Add initial tests for alerter class | jamesoff/simplemonitor,jamesoff/simplemonitor,jamesoff/simplemonitor,jamesoff/simplemonitor,jamesoff/simplemonitor | tests/test_alerter.py | tests/test_alerter.py | import unittest
import datetime
import Alerters.alerter
class TestAlerter(unittest.TestCase):
def test_groups(self):
config_options = {'groups': 'a,b,c'}
a = Alerters.alerter.Alerter(config_options)
self.assertEqual(['a', 'b', 'c'], a.groups)
def test_times_always(self):
conf... | bsd-3-clause | Python | |
33658163b909073aae074b5b2cdae40a0e5c44e8 | Add unit tests for asyncio coroutines | overcastcloud/trollius,overcastcloud/trollius,overcastcloud/trollius | tests/test_asyncio.py | tests/test_asyncio.py | from trollius import test_utils
from trollius import From, Return
import trollius
import unittest
try:
import asyncio
except ImportError:
from trollius.test_utils import SkipTest
raise SkipTest('need asyncio')
# "yield from" syntax cannot be used directly, because Python 2 should be able
# to execute thi... | apache-2.0 | Python | |
72ff3bfcbfb9e4144d43ca03c77f0692cccd0fc2 | add small interface for DHT Adafruit lib (in rpi.py) | enavarro222/gsensors | gsensors/rpi.py | gsensors/rpi.py | #-*- coding:utf-8 -*-
""" Drivers for common sensors on a rPi
"""
import sys
import gevent
from gsensors import AutoUpdateValue
class DHTTemp(AutoUpdateValue):
def __init__(self, pin, stype="2302", name=None):
update_freq = 10 #seconds
super(DHTTemp, self).__init__(name=name, unit="°C", update_fr... | agpl-3.0 | Python | |
3bc341036730ab8e9fd5ac61e10556af028813e2 | Add migration -Remove dupes -Add index preventing dupe creation | TomBaxter/osf.io,icereval/osf.io,leb2dg/osf.io,felliott/osf.io,chrisseto/osf.io,aaxelb/osf.io,leb2dg/osf.io,binoculars/osf.io,leb2dg/osf.io,baylee-d/osf.io,Johnetordoff/osf.io,caseyrollins/osf.io,felliott/osf.io,chennan47/osf.io,icereval/osf.io,crcresearch/osf.io,chennan47/osf.io,TomBaxter/osf.io,binoculars/osf.io,bria... | osf/migrations/0044_basefilenode_uniqueness_index.py | osf/migrations/0044_basefilenode_uniqueness_index.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.db import connection
from django.db import migrations
logger = logging.getLogger(__name__)
def remove_duplicate_filenodes(*args):
from osf.models.files import BaseFileNode
sql = """
SELECT id
FROM (SELE... | apache-2.0 | Python | |
e322daa6d92a9dad8db9b8c9b6085aded90bef39 | add beta release script | mixpanel/mixpanel-iphone,mixpanel/mixpanel-iphone,mixpanel/mixpanel-iphone,mixpanel/mixpanel-iphone,mixpanel/mixpanel-iphone | scripts/release_beta.py | scripts/release_beta.py |
import argparse
import subprocess
parser = argparse.ArgumentParser(description='Release Mixpanel Objective-C SDK')
parser.add_argument('--old', help='old version number', action="store")
parser.add_argument('--new', help='new version number for the release', action="store")
args = parser.parse_args()
def bump_versi... | apache-2.0 | Python | |
c783c26c6362cdd0702211552578a09f380e9dac | Add tags module. | kivhift/pu | src/pu/tags.py | src/pu/tags.py | #
# Copyright (c) 2013 Joshua Hughes <kivhift@gmail.com>
#
import sys
class Tag(object):
_name = ''
def __init__(self, *a, **kw):
super(Tag, self).__init__()
self.content = list(a)
self.attributes = kw
def __str__(self):
name = self._name
content = ''.join(str(c) fo... | mit | Python | |
9c6130b5f9337b428f530cfae7036b7be2a9eea4 | test commit | usc-isi-i2/etk,usc-isi-i2/etk,usc-isi-i2/etk | etk2/DefaultDocumentSelector.py | etk2/DefaultDocumentSelector.py | import json
import jsonpath_rw
import re
from document import Document
class DefaultDocumentSelector(DocumentSelector):
def __init__(self):
pass
"""
A concrete implementation of DocumentSelector that supports commonly used methods for
selecting documents.
"""
"""
Args:
... | mit | Python | |
e5f77ccc2f51fdcaa32c55b56f6b801b3ae2e0e2 | Add triggered oscilloscope example | pyacq/pyacq,pyacq/pyacq | example/pyaudio_triggerscope.py | example/pyaudio_triggerscope.py | """
Simple demonstration of streaming data from a PyAudio device to a QOscilloscope
viewer.
Both device and viewer nodes are created locally without a manager.
"""
from pyacq.devices.audio_pyaudio import PyAudio
from pyacq.viewers import QTriggeredOscilloscope
import pyqtgraph as pg
# Start Qt application
app = pg.... | bsd-3-clause | Python | |
5c5c2e9ae69b6543830975239068d34620205119 | add context logger | pingf/PyModulesLearning,pingf/PyModulesLearning | logging/logger_reload_with_context.py | logging/logger_reload_with_context.py | import logging
import traceback
from yaml_config import yaml_config
yaml_config('yaml.conf')
class ContextLogger(object):
def __init__(self, name):
self.logger = logging.getLogger(name)
def _context(self):
stack = traceback.extract_stack()
(filename, line, procname, text) = stack[-3]... | mit | Python | |
bc7f1363a7da1375b62f70caf441423af2718641 | Create example.py | BobStevens/micropython | BMP085/example.py | BMP085/example.py | # Continuously polls the BMP180 Pressure Sensor
import pyb
import BMP085
# creating objects
blue = pyb.LED(4)
bmp180 = BMP085.BMP085(port=2,address=0x77,mode=3,debug=False)
while 1:
blue.toggle()
temperature = bmp180.readTemperature()
print("%f celcius" % temperature)
pressure = bmp180.readPressure()
pr... | mit | Python | |
6c08209ee26210df07b9d80da45d815b595205ae | test for new Wigner function | anubhavvardhan/qutip,zasdfgbnm/qutip,cgranade/qutip,cgranade/qutip,anubhavvardhan/qutip,qutip/qutip,zasdfgbnm/qutip,qutip/qutip | test_wigner.py | test_wigner.py | from qutip import *
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from pylab import *
N = 20;
psi=(coherent(N,-2-2j)+coherent(N,2+2j)).unit()
#psi = ket2dm(basis(N,0))
xvec = linspace(-5.,5.,200)
yvec = xvec
X,Y = meshgrid(xvec, yvec)
W = wigner(psi,xvec,xvec);
fig2 = plt.figure(figsize=(9, 6))
ax =... | bsd-3-clause | Python | |
1ffdfc3c7ae11c583b2ea4d45b50136996bcf3e3 | Add mock HTTP server to respond to requests from web UI | jmlong1027/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,mitre/multiscanner,mitre/multiscanner,jmlong1027/multiscanner,MITRECND/multiscanner,MITRECND/multiscanner,jmlong1027/multiscanner | tests/mocks.py | tests/mocks.py | from http.server import BaseHTTPRequestHandler, HTTPServer
import json
import socket
from threading import Thread
import requests
# https://realpython.com/blog/python/testing-third-party-apis-with-mock-servers/
class MockHTTPServerRequestHandler(BaseHTTPRequestHandler):
def do_OPTIONS(self):
# add respo... | mpl-2.0 | Python | |
481b822125de1d29de09975a6607c4fa038b98df | Add model List | ajoyoommen/zerrenda,ajoyoommen/zerrenda | todo/models.py | todo/models.py | from django.db import models
from django.utils.text import slugify
from common.models import TimeStampedModel
class List(TimeStampedModel):
name = models.CharField(max_length=50)
slug = models.CharField(max_length=50, editable=False)
def save(self, *args, **kwargs):
self.slug = slugify(self.name... | mit | Python | |
d64e28b6aabf83711faca5853a01b590c5f89548 | Create topicmining.py | psyllost/02819 | topicmining.py | topicmining.py |
from gensim import corpora, models
from itertools import chain
from urllib import urlopen
from operator import itemgetter
import csv
import simplejson as json
#The code for extracting entities from referata was taken by fnielsen git repository
# Define a url as a Python string (note we are only getting 100 documents)
... | apache-2.0 | Python | |
744d7971926bf7672ce01388b8617be1ee35df0e | Add missing test data folder | GoogleCloudPlatform/repo-automation-playground,GoogleCloudPlatform/repo-automation-playground,GoogleCloudPlatform/repo-automation-playground,GoogleCloudPlatform/repo-automation-playground,GoogleCloudPlatform/repo-automation-playground,GoogleCloudPlatform/repo-automation-playground,GoogleCloudPlatform/repo-automation-pl... | xunit-autolabeler-v2/ast_parser/core/test_data/parser/exclude_tags/exclude_tags_main.py | xunit-autolabeler-v2/ast_parser/core/test_data/parser/exclude_tags/exclude_tags_main.py | # Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python | |
c2f1a5b84497132c6b7b15797493082c865e737d | add twitter_bot | lambdan/lambblog,lambdan/lambblog | twitter_bot.py | twitter_bot.py | import tweepy
import feedparser
import re
import requests
import os
# pip3 install tweepy feedparser
feed_url = "https://lambdan.se/blog/rss.xml"
database_file = "./tweeted_by_twitter_bot.txt" # txt with urls that have been tweeted (one url per line)
twitter_consumer_api_key = ""
twitter_api_secret_key = ""
twitter_a... | mit | Python | |
156c0b09930bd7700cb7348197a9e167831dca6d | ADD initial syft.lib.util tests | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | packages/syft/tests/syft/lib/util_test.py | packages/syft/tests/syft/lib/util_test.py | #absolute
from syft.lib.util import full_name_with_name
from syft.lib.util import full_name_with_qualname
class TSTClass:
pass
class FromClass:
@staticmethod
def static_method():
pass
def not_static_method(self):
pass
class ToClass:
pass
def test_full_name_with_name():
... | apache-2.0 | Python | |
2eb849578b7306762f1e9dc4962a9db2ad651fc9 | add solution for Linked List Cycle II | zhyu/leetcode,zhyu/leetcode | src/linkedListCycleII.py | src/linkedListCycleII.py | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param head, a ListNode
# @return a list node
def detectCycle(self, head):
slow = fast = head
no_loop = True
while fast and fast.... | mit | Python | |
855f9afa6e8d7afba020dc5c1dc8fabfc84ba2d4 | add new package : jafka (#14304) | iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/jafka/package.py | var/spack/repos/builtin/packages/jafka/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Jafka(Package):
"""
Jafka is a distributed publish-subscribe messaging system.
"""... | lgpl-2.1 | Python | |
665a373f12f030d55a5d004cbce51e9a86428a55 | Add the main rohrpost handler | axsemantics/rohrpost,axsemantics/rohrpost | rohrpost/main.py | rohrpost/main.py | import json
from functools import partial
from . import handlers # noqa
from .message import send_error
from .registry import HANDLERS
REQUIRED_FIELDS = ['type', 'id']
def handle_rohrpost_message(message):
"""
Handling of a rohrpost message will validate the required format:
A valid JSON object includ... | mit | Python | |
8084a3be60e35e5737047f5b2d2daf8dce0cec1a | Update sliding-window-maximum.py | kamyu104/LeetCode,kamyu104/LeetCode,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,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015 | Python/sliding-window-maximum.py | Python/sliding-window-maximum.py | # Time: O(n)
# Space: O(k)
# Given an array nums, there is a sliding window of size k
# which is moving from the very left of the array to the
# very right. You can only see the k numbers in the window.
# Each time the sliding window moves right by one position.
#
# For example,
# Given nums = [1,3,-1,-3,5,3,6,7], an... | # Time: O(n)
# Space: O(k)
# Given an array nums, there is a sliding window of size k
# which is moving from the very left of the array to the
# very right. You can only see the k numbers in the window.
# Each time the sliding window moves right by one position.
#
# For example,
# Given nums = [1,3,-1,-3,5,3,6,7], an... | mit | Python |
f8bd2205e57e7a3b457e20b678d69065b620c965 | Create __init__.py | cmccomb/vote-sim | votesim/__init__.py | votesim/__init__.py | mit | Python | ||
24baf3e5e7a608d0b34d74be25f96f1b74b7622e | Add feed update task for social app | kansanmuisti/datavaalit,kansanmuisti/datavaalit | web/social/tasks.py | web/social/tasks.py | from celery.task import PeriodicTask
from datetime import timedelta
from social.utils import FeedUpdater, UpdateError
class UpdateFeedsTask(PeriodicTask):
run_every = timedelta(minutes=15)
def run(self, **kwargs):
logger = self.get_logger()
updater = FeedUpdater(logger)
print "Updatin... | agpl-3.0 | Python | |
b5dfae3c80b08616401604aad211cedd31783f33 | Add benchmarks.py script | fonttools/skia-pathops | benchmarks.py | benchmarks.py | from pathops import union as pathops_union
from booleanOperations import union as boolops_union
from defcon import Font as DefconFont
from ufoLib2 import Font as UfoLib2Font
import math
import timeit
REPEAT = 10
NUMBER = 1
def remove_overlaps(font, union_func, pen_getter, **kwargs):
for glyph in font:
c... | bsd-3-clause | Python | |
a62e0bb3bfe192dcf080f28405a41ce7eb298b9b | Add tests for soc.logic.helper.prefixes. | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | tests/app/soc/logic/helper/test_prefixes.py | tests/app/soc/logic/helper/test_prefixes.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 | |
115145da5063c47009e93f19aa5645e0dbb2580f | add missing migration for tests | fcurella/django-fakery | tests/migrations/0002_auto_20210712_1629.py | tests/migrations/0002_auto_20210712_1629.py | # Generated by Django 2.2.24 on 2021-07-12 21:29
import django.contrib.gis.db.models.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tests', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Pizzeria',
... | mit | Python | |
319d74685a0bd44ca0c62bf41dae2f9515b5e327 | Add tests for nilrt_ip._load_config | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/pytests/unit/modules/test_nilrt_ip.py | tests/pytests/unit/modules/test_nilrt_ip.py | import io
import pytest
import salt.modules.nilrt_ip as nilrt_ip
from tests.support.mock import patch
@pytest.fixture(autouse=True)
def setup_loader(request):
setup_loader_modules = {nilrt_ip: {}}
with pytest.helpers.loader_mock(request, setup_loader_modules) as loader_mock:
yield loader_mock
@pyte... | apache-2.0 | Python | |
e810ecb5362496f72485220ab4e9cecd5467b3a6 | kill leftover webpagereplay servers. | ChromiumWebApps/chromium,dushu1203/chromium.src,Pluto-tv/chromium-crosswalk,krieger-od/nwjs_chromium.src,crosswalk-project/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,Jonekee/chromium.src,axinging/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,markYoungH/chromium.src,crosswalk-project/chromium-cr... | build/android/pylib/utils/test_environment.py | build/android/pylib/utils/test_environment.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.
import logging
import os
import psutil
import signal
from pylib import android_commands
def _KillWebServers():
for s in [signal.SIGTERM, signal.SIGINT, ... | # 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.
import logging
import os
import psutil
from pylib import android_commands
def _KillWebServers():
for retry in xrange(5):
for server in ['lighttpd', '... | bsd-3-clause | Python |
082f28198b76c93ee7dc06ed3ea68bfe9a596b97 | create Spider for France website of McDonalds | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/mcdonalds_fr.py | locations/spiders/mcdonalds_fr.py | # -*- coding: utf-8 -*-
import scrapy
import json
import re
from locations.items import GeojsonPointItem
class McDonalsFRSpider(scrapy.Spider):
name = "mcdonalds_fr"
allowed_domains = ["www.mcdonalds.fr"]
start_urls = (
'https://prod-dot-mcdonaldsfrance-storelocator.appspot.com/api/store/nearest?... | mit | Python | |
d77cb643c7762401209f1f9d9693ee352e6672cb | Create mqttEampleRemoteBrain.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/kyleclinton/mqttEampleRemoteBrain.py | home/kyleclinton/mqttEampleRemoteBrain.py | from java.lang import String
from time import sleep
pi = Runtime.createAndStart("pi","RasPi")
#Load Pub/Sub Service (MQTT)
execfile("../py_scripts/mqttPubSubConfig.py")
# Add in controller for head, neck and antenna servos SHOULD be using i2c 16 servo controller
#Load Juniors mouth!
execfile("../py_scripts/juniors_v... | apache-2.0 | Python | |
188c4af91f2a3dbb98997da6cdc3e43df488e791 | add ALCE examples | ntucllab/libact,ntucllab/libact,ntucllab/libact | examples/alce.py | examples/alce.py | #!/usr/bin/env python3
"""
Cost-Senstive Multi-Class Active Learning`
"""
import copy
import os
import numpy as np
from sklearn.model_selection import StratifiedShuffleSplit
import sklearn.datasets
from sklearn.linear_model import LinearRegression
# libact classes
from libact.base.dataset import Dataset, import_libs... | bsd-2-clause | Python | |
3fb4d7b630fb7a4b34dcc4e1b72947e61f73a80f | Create script to dowload requisite test urls. | cielling/jupyternbs | TestData/download_test_data.py | TestData/download_test_data.py | def set_test_db():
from sys import path
path.insert(0, "..")
from MyEdgarDb import get_list_sec_filings, get_cik_ticker_lookup_db, lookup_cik_ticker
get_list_sec_filings (7, 'test_idx.db')
get_cik_ticker_lookup_db ('test_idx.db')
def download_test_data():
import sqlite3
from datetime import... | agpl-3.0 | Python | |
df8206b01eb2298651099c5e701d269a0e6cd8c6 | add test case for tuple attribute error #35 | zedlander/flake8-commas,zedlander/flake8-commas | test/test_flake8.py | test/test_flake8.py | import subprocess
def test_call_flake8(tmpdir):
tmp = tmpdir.join('tmp.py')
tmp.write('')
output = subprocess.check_output(
['flake8', str(tmp)],
stderr=subprocess.STDOUT,
)
assert output == b''
| mit | Python | |
ecae1fa205c88d1d503663c5fbec80a1943146ad | add resources comparator | gopro/gopro-lib-node.gl,gopro/gopro-lib-node.gl,gopro/gopro-lib-node.gl,gopro/gopro-lib-node.gl | pynodegl-utils/pynodegl_utils/tests/cmp_resources.py | pynodegl-utils/pynodegl_utils/tests/cmp_resources.py | #!/usr/bin/env python
#
# Copyright 2020 GoPro Inc.
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache... | apache-2.0 | Python | |
885aac79c2e31fc74dc143fc2527e02c2c0a8941 | add duckduckgo crawler | citationfinder/scholarly_citation_finder | scholarly_citation_finder/api/crawler/Duckduckgo.py | scholarly_citation_finder/api/crawler/Duckduckgo.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
class Duckduckgo:
API_URL = 'https://duckduckgo.com/html/'
CSS_RESULT_ELEMENT = 'a'
CSS_RESULT_ELEMENT_CLASS = 'large'
CSS_RESULT_TYPE_ELEMENT = 'span'
CSS_RESULT_TYPE_ELEMENT_CLASS = 'result__type'
... | mit | Python | |
60f01c055405fea9e3672821a1188774f7517707 | add 140 | EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,zeyuanxy/project-euler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler | vol3/140.py | vol3/140.py | if __name__ == "__main__":
L = 30
sqrt5 = 5 ** 0.5
f = [7, 14, 50, 97]
for i in range(L - 4):
f.append(7 * f[-2] - f[-4])
print sum(int(x / sqrt5) - 1 for x in f)
| mit | Python | |
7d6b04bc60270d357fdf9401174ece249f9f3568 | add 153 | EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,zeyuanxy/project-euler | vol4/153.py | vol4/153.py | import math
import fractions
if __name__ == "__main__":
L = 10 ** 8
ans = 0
for i in xrange(1, L + 1):
ans += (L / i) * i
if i * i < L:
j = 1
while j <= i:
if fractions.gcd(i, j) == 1:
div = i * i + j * j
k = 1
... | mit | Python | |
b67250ca02705d47a124353207a1f60546919c0f | add versiondb.Manifest class | lsst-sqre/sqre-codekit,lsst-sqre/sqre-codekit | codekit/versiondb.py | codekit/versiondb.py | """versionDB related utility functions."""
from codekit.codetools import debug
from public import public
import logging
import re
import requests
import textwrap
default_base_url =\
'https://raw.githubusercontent.com/lsst/versiondb/master/manifests'
@public
def setup_logging(verbosity=0):
# enable requests ... | mit | Python | |
f6f12b1194fde3fc4dc355535ca88f472962d3a3 | add camera color histogram | miguelinux/ejemplos-opencv,miguelinux/ejemplos-opencv | python/ocv4/camera_color_histogram.py | python/ocv4/camera_color_histogram.py | #!/usr/bin/env python
'''
Video histogram sample to show live histogram of video
Keys:
ESC - exit
'''
# Python 2/3 compatibility
from __future__ import print_function
import numpy as np
import cv2 as cv
# built-in modules
import sys
# local modules
import video
class App():
def set_scale(self, val):... | bsd-3-clause | Python | |
3ebb2731d6389170e0bef0dab66dc7c4ab41152e | Add a unit-test for thread_pool.py. | graveljp/smugcli | thread_pool_test.py | thread_pool_test.py | import thread_pool
import unittest
from six.moves import queue
class TestThreadPool(unittest.TestCase):
def _producer_thread(self, results):
for i in range(10):
results.put(i)
def _consumer_thread(self, results):
for i in range(10):
self.assertEqual(results.get(), i)
def testContextManager... | mit | Python | |
f6d4116ed5122868dbc10bf41dfc44053d0a0edf | write annotation parser for PASCAL VOC 2006 | yassersouri/omgh,yassersouri/omgh | src/pascal_utils.py | src/pascal_utils.py | import re
def which_one(str, arr):
for a in arr:
if a in str:
return a
return ''
class VOC2006AnnotationParser(object):
SKIP_CHARACTER = '#'
OBJECT_SUMMARY = 'Objects with ground truth'
PREPEND = 'PAS'
TRUNC = 'Trunc'
DIFFICULT = 'Difficult'
CLASSES = ['bicycle', ... | mit | Python | |
c6b1cbddec20fae0daeece0ea859a7227e16e3bf | Add primitive name space registry for event types | fxstein/SentientHome | common/shregistry.py | common/shregistry.py | #!/usr/local/bin/python3 -u
__author__ = 'Oliver Ratzesberger <https://github.com/fxstein>'
__copyright__ = 'Copyright (C) 2015 Oliver Ratzesberger'
__license__ = 'Apache License, Version 2.0'
# ALL event types need to be registered here
# ATTENTION: type must be unique to avoid event name space polution
# Regis... | apache-2.0 | Python | |
167872381e16090b1b47184a1a80bbe948d5fd91 | Add test and test_suite function to svm module | ZenDevelopmentSystems/scikit-learn,btabibian/scikit-learn,Akshay0724/scikit-learn,Myasuka/scikit-learn,xwolf12/scikit-learn,macks22/scikit-learn,aminert/scikit-learn,Aasmi/scikit-learn,russel1237/scikit-learn,devanshdalal/scikit-learn,liyu1990/sklearn,fredhusser/scikit-learn,nvoron23/scikit-learn,bigdataelephants/sciki... | scikits/learn/machine/svm/__init__.py | scikits/learn/machine/svm/__init__.py | """
A Support Vector Machine, this module defines the following classes:
- `LibSvmCClassificationModel`, a model for C-SV classification
- `LibSvmNuClassificationModel`, a model for nu-SV classification
- `LibSvmEpsilonRegressionModel`, a model for epsilon-SV regression
- `LibSvmNuRegressionModel`, a model for nu-SV r... | """
A Support Vector Machine, this module defines the following classes:
- `LibSvmCClassificationModel`, a model for C-SV classification
- `LibSvmNuClassificationModel`, a model for nu-SV classification
- `LibSvmEpsilonRegressionModel`, a model for epsilon-SV regression
- `LibSvmNuRegressionModel`, a model for nu-SV r... | bsd-3-clause | Python |
5a27a8e0c7ae2e0cef787db107305251d096d81f | Add test runner. | rapidsms/rapidsms-legacy,rapidsms/rapidsms-legacy,rapidsms/rapidsms-legacy | lib/rapidsms/tests/runtests.py | lib/rapidsms/tests/runtests.py | #!/usr/bin/python
from test_component import *
if __name__ == "__main__":
unittest.main()
| bsd-3-clause | Python | |
2f9152d5cc0ad4123522b054dd2b6458c602b1fd | add script for dataset | molecularsets/moses,molecularsets/moses | moses/scripts/download_dataset.py | moses/scripts/download_dataset.py | import argparse
import os
import pandas as pd
from urllib import request
def get_parser():
parser = argparse.ArgumentParser()
parser.add_argument('--output_dir', type=str, default='./data',
help='Directory for downloaded dataset')
parser.add_argument('--dataset_url', type=str, ... | mit | Python | |
19712e8e7b9423d4cb4bb22c37c7d8d2ea0559c5 | Add example to show listing of USB devices | solus-project/linux-driver-management,solus-project/linux-driver-management | examples/list-usb.py | examples/list-usb.py | #!/usr/bin/env python2
#
# This file is Public Domain and provided only for documentation purposes.
#
# Run : python2 ./list-usb.py
#
# Note: This will happily run with Python3 too, I just picked a common baseline
#
import gi
gi.require_version('Ldm', '0.1')
from gi.repository import Ldm, GObject
class PretendyPlugin... | lgpl-2.1 | Python | |
b56690d046021e036b5b15c484d86c92f3519600 | Add partial evaluation tool to replace functools module for python < 2.5 | shikhardb/scikit-learn,ClimbsRocks/scikit-learn,bthirion/scikit-learn,samuel1208/scikit-learn,sinhrks/scikit-learn,OshynSong/scikit-learn,ky822/scikit-learn,treycausey/scikit-learn,TomDLT/scikit-learn,RomainBrault/scikit-learn,zuku1985/scikit-learn,icdishb/scikit-learn,arabenjamin/scikit-learn,sarahgrogan/scikit-learn,... | scikits/learn/common/myfunctools.py | scikits/learn/common/myfunctools.py | # Last Change: Mon Aug 20 01:00 PM 2007 J
# Implement partial application (should only be used if functools is not
# available (eg python < 2.5)
class partial:
def __init__(self, fun, *args, **kwargs):
self.fun = fun
self.pending = args[:]
self.kwargs = kwargs.copy()
def __call__(self,... | bsd-3-clause | Python | |
6219211d529d2dd58693ea93e6b799fd36259fee | Add tests | grzes/djangae,grzes/djangae,potatolondon/djangae,grzes/djangae,potatolondon/djangae | djangae/tests/test_async_multi_query.py | djangae/tests/test_async_multi_query.py | from django.test import override_settings
from django.db import NotSupportedError
from django.db import models
from djangae.test import TestCase
class MultiQueryModel(models.Model):
field1 = models.IntegerField()
class AsyncMultiQueryTest(TestCase):
"""
Specific tests for multiquery
"""
def... | bsd-3-clause | Python | |
51e04ff17bccb4b71b8d5db4057a782fd2f8520c | Add script to synthesize all uploaded files. Patch by Dan Callahan. | techtonik/pydotorg.pypi,techtonik/pydotorg.pypi | tools/touch_all_files.py | tools/touch_all_files.py | #!/usr/bin/python
"""
This script touches all files known to the database, creating a skeletal
mirror for local development.
"""
import sys, os
import store
def get_paths(cursor, prefix=None):
store.safe_execute(cursor, "SELECT python_version, name, filename FROM release_files")
for type, name, filename in c... | bsd-3-clause | Python | |
2684aa6eabdeb3fa5ec4c7e910af04c7068c7cd8 | add working loopback test | tgarc/pastream,tgarc/pastream,tgarc/pastream | test_pastream.py | test_pastream.py | """
Loopback tests for pastream.
"""
from __future__ import print_function
import os, sys
import numpy as np
import soundfile as sf
import pytest
import numpy.testing as npt
import time
import tempfile
import platform
import pastream as pas
# Set up the platform specific device
system = platform.system()
if system ==... | mit | Python | |
e8b6c596a7627d1c4f3f6915236317b0730210a2 | Rename ds_tree_max_min_depth.py to ds_tree_balanced_bt.py | ngovindaraj/Python | leetcode/ds_tree_balanced_bt.py | leetcode/ds_tree_balanced_bt.py | # @file Balanced Binary Tree
# @brief Given a binary tree, determine if it is height-balanced.
# https://leetcode.com/problems/balanced-binary-tree/
'''
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined
as a binary tree in which the depth of the two ... | mit | Python | |
4a6edf85f755f62a2213ce09cd407621fe635cea | Add DB migration file | cgwire/zou | zou/migrations/versions/528b27337ebc_.py | zou/migrations/versions/528b27337ebc_.py | """empty message
Revision ID: 528b27337ebc
Revises: f0567e8d0c62
Create Date: 2018-05-17 15:51:25.513852
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
from sqlalchemy.dialects import postgresql
import sqlalchemy_utils
import uuid
# revision identifiers, used by Alembic.
revision = '528b2... | agpl-3.0 | Python | |
68f3c14c2ae7df9d9a5cdc44fe7a181760d54dfa | Add Exercise 3.10. | jcrist/pydy,skidzo/pydy,jcrist/pydy,Shekharrajak/pydy,Shekharrajak/pydy,jcrist/pydy,skidzo/pydy,jcrist/pydy,oliverlee/pydy,oliverlee/pydy,oliverlee/pydy,jcrist/pydy,Shekharrajak/pydy,jcrist/pydy,Shekharrajak/pydy,jcrist/pydy,skidzo/pydy,skidzo/pydy | Kane1985/Chapter2/Ex3.10.py | Kane1985/Chapter2/Ex3.10.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 3.10 from Kane 1985."""
from __future__ import division
from sympy import cancel, collect, expand_trig, solve, symbols, trigsimp
from sympy import sin, cos
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy.physics.mechanics import dot, dynami... | bsd-3-clause | Python | |
484e50b34c06785f1b1b48da5502f79ee5a2357b | add factories.py | texastribune/tx_salaries,texastribune/tx_salaries | tx_salaries/factories.py | tx_salaries/factories.py | import factory
from tx_people.models import Organization, Membership, Person, Post
from tx_salaries.models import Employee, EmployeeTitle, CompensationType, OrganizationStats
# tx_people factories
class OrganizationFactory(factory.DjangoModelFactory):
FACTORY_FOR = Organization
class PersonFactory(factory.Djang... | apache-2.0 | Python | |
533559e20e377ce042591709e53d7dc7031d6205 | Add test for timer automatically inserted due to directive | giserh/hug,STANAPO/hug,MuhammadAlkarouri/hug,janusnic/hug,MuhammadAlkarouri/hug,janusnic/hug,gbn972/hug,MuhammadAlkarouri/hug,STANAPO/hug,shaunstanislaus/hug,yasoob/hug,jean/hug,philiptzou/hug,philiptzou/hug,jean/hug,shaunstanislaus/hug,origingod/hug,giserh/hug,yasoob/hug,timothycrosley/hug,alisaifee/hug,timothycrosley... | tests/test_directives.py | tests/test_directives.py | """tests/test_directives.py.
Tests to ensure that directives interact in the etimerpected mannor
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without... | """tests/test_directives.py.
Tests to ensure that directives interact in the etimerpected mannor
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without... | mit | Python |
a3939b572c51b7a721b758cb5b93364e4b156c13 | Add script that dumps the python path | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | dev_tools/syspath.py | dev_tools/syspath.py | #!/usr/bin/env python
import sys
# path[0], is the directory containing the script that was used to invoke the Python interpreter
for s in sorted(sys.path[1:]):
print s
| apache-2.0 | Python | |
f06a71a87daaaf0bc4b1f5701ce4c59805b70f6b | Format all local .json files for human readability | cclauss/Ten-lines-or-less | usr/bin/json_readable.py | usr/bin/json_readable.py | #!/usr/bin/env python
import json, os
for filename in os.listdir('.'):
if os.path.isfile(filename) and os.path.splitext(filename)[1].lower() == '.json':
with open(filename) as in_file:
data = json.load(in_file)
with open(filename, 'w') as out_file:
json.dump(data, out_file,... | apache-2.0 | Python | |
e736772d21aea0995a1948220e2dc2c6fa413fca | Add python zookeeper example | xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet,xgfone/snippet | snippet/example/python/zookeeper.py | snippet/example/python/zookeeper.py | #!/usr/bin/env python
# encoding: utf8
from __future__ import absolute_import, print_function, unicode_literals, division
import zookeeper
def refactor_path(f):
def wrapper(*args, **kwargs):
_refactor = kwargs.pop("refactor", True)
if _refactor:
path = kwargs.get("path", None... | mit | Python | |
101d334b80872c36adb5645ba0b3cda9b7c36a61 | Add compliance with rule E261 to camo.py. | eeshangarg/zulip,rht/zulip,shubhamdhama/zulip,rht/zulip,shubhamdhama/zulip,tommyip/zulip,eeshangarg/zulip,j831/zulip,verma-varsha/zulip,hackerkid/zulip,vaidap/zulip,rht/zulip,ryanbackman/zulip,amanharitsh123/zulip,synicalsyntax/zulip,tommyip/zulip,punchagan/zulip,punchagan/zulip,christi3k/zulip,andersk/zulip,andersk/zu... | zerver/lib/camo.py | zerver/lib/camo.py | from django.conf import settings
import codecs
import hashlib
import hmac
from typing import Text
# Encodes the provided URL using the same algorithm used by the camo
# caching https image proxy
def get_camo_url(url):
# type: (Text) -> Text
# Only encode the url if Camo is enabled
if settings.CAMO_URI == ... | from django.conf import settings
import codecs
import hashlib
import hmac
from typing import Text
# Encodes the provided URL using the same algorithm used by the camo
# caching https image proxy
def get_camo_url(url):
# type: (Text) -> Text
# Only encode the url if Camo is enabled
if settings.CAMO_URI == ... | apache-2.0 | Python |
c78dffb9b23e38fc980c06ff519e750f5d1e3678 | add day1_short_palindrome.py - might work :) | flypenguin/hackerrank-exercises | 10-days-of-stats/day1_short_palindrome.py | 10-days-of-stats/day1_short_palindrome.py | #!/usr/bin/python3
# let's try to not do string comparisons and maybe list indexing
# is faster than string indexing
s = list(map(ord, list(input())))
slen = len(s)
found = 0
# baseline optimization only (don't know if there is more possible)
for a in range(0, slen-3):
for d in range(a+3, slen):
if not s... | unlicense | Python | |
c0220578f4cd9b4c26879548751586615fe070e8 | Add some freesurfer tools | gallantlab/pycortex,gallantlab/pycortex,gallantlab/pycortex,gallantlab/pycortex,CVML/pycortex,smerdis/pycortex,CVML/pycortex,gallantlab/pycortex,CVML/pycortex,CVML/pycortex,smerdis/pycortex,CVML/pycortex,smerdis/pycortex,smerdis/pycortex,smerdis/pycortex | cortex/freesurfer.py | cortex/freesurfer.py | import os
import struct
import tempfile
import shlex
import subprocess as sp
import numpy as np
import vtkutils_new as vtk
def parse_curv(filename):
with open(filename) as fp:
fp.seek(15)
return np.fromstring(fp.read(), dtype='>f4').byteswap()
def show_surf(subject, hemi, type):
from mayavi ... | bsd-2-clause | Python | |
ed4d07fb2a7fa8f1dd30a2b7982940a5fe78275b | Add the analysis driver for the run step of the study | mdpiper/dakota-swash-parameter-study,mdpiper/dakota-swash-parameter-study | dakota_run_driver.py | dakota_run_driver.py | #! /usr/bin/env python
# Brokers communication between Dakota and SWASH through files.
#
# Arguments:
# $1 is 'params.in' from Dakota
# $2 is 'results.out' returned to Dakota
import sys
import os
import shutil
from subprocess import call
def driver():
"""Broker communication between Dakota and SWASH through ... | mit | Python | |
ac5f30f9d58a25476c935d5266e9948b03efebf8 | Add simple fetch tests | rcos/Observatory,rcos/Observatory,rcos/Observatory,rcos/Observatory,rcos/Observatory,rcos/Observatory | observatory/dashboard/tests/test_fetch.py | observatory/dashboard/tests/test_fetch.py | import pytest
from dashboard.models import Project, Blog, Repository
from emaillist.models import EmailAddress
from django.contrib.auth.models import User
@pytest.mark.django_db
def test_fetch_warning(client):
user = User.objects.create_user('a', 'vagrant@test.rcos.rpi.edu', 'bob')
user.first_name = "testf"
... | isc | Python | |
7af99b98a9985aa1274c56ef8333b0c57a4679c9 | add simple redis queue processor. | thruflo/pyramid_weblayer | src/pyramid_weblayer/queue.py | src/pyramid_weblayer/queue.py | # -*- coding: utf-8 -*-
"""Provides a ``QueueProcessor`` utility that consumes and processes data
from one or more redis channels.
>>> redis_client = '<redis.Redis> instance'
>>> input_channels = ['channel1', 'channeln']
>>> handle_data = lambda data_str: print data_str
>>> processor = Que... | unlicense | Python | |
1975e6ebd57aac379ad19f5d4675f8f598c03c66 | add utilNetworkIP | yasokada/python-151127-7segLed_IPadrDisplay | utilNetworkIP.py | utilNetworkIP.py | import socket
import fcntl
import struct
'''
v0.1 2015/11/28
- add NetworkIP_get_ipAddress_eth0()
- add get_ip_address()
'''
def get_ip_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(
s.fileno(),
0x8915, # SIOCGIFADDR
struc... | mit | Python | |
d8f5b31fab57cc009e87a8d62c8d03075f66e9bd | Add solution for Project Euler problem 72 (#3122) | TheAlgorithms/Python | project_euler/problem_072/sol2.py | project_euler/problem_072/sol2.py | """
Project Euler Problem 72: https://projecteuler.net/problem=72
Consider the fraction, n/d, where n and d are positive integers. If n<d and HCF(n,d)=1,
it is called a reduced proper fraction.
If we list the set of reduced proper fractions for d ≤ 8 in ascending order of size,
we get:
1/8, 1/7, 1/6, 1/5, 1/4, 2/7, ... | mit | Python | |
dab192db863fdd694bb0adbce10fa2dd6c05353b | Make the cli work again. | rzyns/jrnl,philipsd6/jrnl,notbalanced/jrnl,flight16/jrnl,maebert/jrnl,MSylvia/jrnl,dzeban/jrnl,nikvdp/jrnl,cloudrave/jrnl-todos,MinchinWeb/jrnl,beni55/jrnl,zdravi/jrnl,Shir0kamii/jrnl | jrnl/__init__.py | jrnl/__init__.py | #!/usr/bin/env python
# encoding: utf-8
"""
jrnl is a simple journal application for your command line.
"""
__title__ = 'jrnl'
__version__ = '1.0.3'
__author__ = 'Manuel Ebert'
__license__ = 'MIT License'
__copyright__ = 'Copyright 2013 Manuel Ebert'
from . import Journal
from . import jrnl
from .jrnl import cli
| #!/usr/bin/env python
# encoding: utf-8
"""
jrnl is a simple journal application for your command line.
"""
__title__ = 'jrnl'
__version__ = '1.0.3'
__author__ = 'Manuel Ebert'
__license__ = 'MIT License'
__copyright__ = 'Copyright 2013 Manuel Ebert'
from . import Journal
from . import jrnl
| mit | Python |
b7ea4cde920a69add4cbd4cfb76c651ec77910ce | Create __init__.py | MOLSSI-BSE/basis_set_exchange | bse/data/__init__.py | bse/data/__init__.py | bsd-3-clause | Python | ||
ed36937ff6ccb2e676236b2bd128a2bb8fa9a760 | add format_html util | dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | dimagi/utils/html.py | dimagi/utils/html.py | from __future__ import absolute_import
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
def format_html(format_string, *args, **kwargs):
escaped_args = map(conditional_escape, args)
escaped_kwargs = dict([(key, conditional_escape(value)) for key, value in kwargs])... | bsd-3-clause | Python | |
8a668efbc266802a4f4e23c936d3589b230d9528 | Add blink example on two different boards | joppi/nanpy,nanpy/nanpy | nanpy/examples/blink_2boards.py | nanpy/examples/blink_2boards.py | #!/usr/bin/env python
# Author: Andrea Stagi <stagi.andrea@gmail.com>
# Description: keeps your led blinking on 2 boards
# Dependencies: None
from nanpy import (ArduinoApi, SerialManager)
from time import sleep
device_1 = '/dev/tty.usbmodem1411'
device_2 = '/dev/tty.usbmodem1431'
connection_1 = SerialManager(devic... | mit | Python | |
ee08eca3d8bb28819c2594bfdc855fbd7f743536 | Add script to copy brifti files. | rameshvs/nipype,grlee77/nipype,carolFrohlich/nipype,blakedewey/nipype,iglpdc/nipype,Leoniela/nipype,pearsonlab/nipype,sgiavasis/nipype,wanderine/nipype,dgellis90/nipype,gerddie/nipype,FredLoney/nipype,mick-d/nipype_source,carlohamalainen/nipype,dgellis90/nipype,FCP-INDI/nipype,carlohamalainen/nipype,sgiavasis/nipype,FC... | nipype/externals/copy_brifti.py | nipype/externals/copy_brifti.py | #!/usr/bin/env python
"""Script to copy brifti files from the git repos into nipype.
I stole this from nipy.tools.copy_brifti.py. Matthew Brett is the
original author, I've hacked the script to make it work with nipype.
The script downloads the current pynifti git repository from my github
account, pulls out the nif... | bsd-3-clause | Python | |
61a005ffbc988b6a20441841112890bb397f8ca3 | Create stub for 2016 NFLPool player picks | prcutler/nflpool,prcutler/nflpool | 2016_player_picks.py | 2016_player_picks.py |
stone = {"firstname": "chris", "lastname": "stone", "timestamp": "9/6/2016", "email": "stone@usisales.com",
"afc_east_1": "Patriots", "afc_east_2": "Jets", "afc_east_last": "Bills", "afc_north_1": "Steelers",
"afc_north_2": "Bengals", "afc_north_last": "Browns", "afc_south_1": "Colts", "afc_south_2"... | mit | Python | |
893e4292f6b1799bf5f1888fcbad41ec8b5a5951 | Use Q-learning to learn all state-action values via self-play | davidrobles/mlnd-capstone-code | examples/tic_ql_tabular_selfplay_all.py | examples/tic_ql_tabular_selfplay_all.py | '''
In this example we use Q-learning via self-play to learn
the value function of all Tic-Tac-Toe positions.
'''
from capstone.environment import Environment
from capstone.game import TicTacToe
from capstone.mdp import GameMDP
from capstone.rl import QLearningSelfPlay
from capstone.rl.tabularf import TabularF
from cap... | mit | Python | |
af9b64bcf99d0e2c13b9b6b05a6b4029a0bb7d28 | Add theimdbapi provider, it's faster than myapifilms. | EmilStenstrom/nephele | providers/moviedata/theimdbapi.py | providers/moviedata/theimdbapi.py | import re
from providers.moviedata.provider import MoviedataProvider
from application import ACCESS_KEYS, APPLICATION as APP
try:
from urllib import urlencode # Python 2.X
except ImportError:
from urllib.parse import urlencode # Python 3+
IDENTIFIER = "theimdbapi"
class Provider(MoviedataProvider):
def ... | mit | Python | |
a8419c46ceed655a276dad00a24e21f300fda543 | Add py solution for 513. Find Bottom Left Tree Value | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/find-bottom-left-tree-value.py | py/find-bottom-left-tree-value.py | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def findBottomLeftValue(self, root):
"""
:type root: TreeNode
:rtype: int
"""
q =... | apache-2.0 | Python | |
1e45505a94f23198d0ec464107c12d29d4d9aa16 | Add tests for libdft | sunqm/pyscf,sunqm/pyscf,sunqm/pyscf,sunqm/pyscf | pyscf/lib/dft/test/test_libdft.py | pyscf/lib/dft/test/test_libdft.py | #!/usr/bin/env python
import unittest
import ctypes
import itertools
import numpy
from pyscf.dft.numint import libdft
class KnownValues(unittest.TestCase):
def test_empty_blocks(self):
ao_loc = numpy.array([0,51,60,100,112,165,172], dtype=numpy.int32)
def get_empty_mask(non0tab_mask):
... | apache-2.0 | Python | |
d2aca979f2c8a711bbc139675cf699b6ce5ce53d | Update keys-and-rooms.py | tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode | Python/keys-and-rooms.py | Python/keys-and-rooms.py | # Time: O(n!)
# Space: O(n)
# There are N rooms and you start in room 0.
# Each room has a distinct number in 0, 1, 2, ..., N-1,
# and each room may have some keys to access the next room.
#
# Formally, each room i has a list of keys rooms[i],
# and each key rooms[i][j] is an integer in [0, 1, ..., N-1]
# where N = r... | # There are N rooms and you start in room 0.
# Each room has a distinct number in 0, 1, 2, ..., N-1,
# and each room may have some keys to access the next room.
#
# Formally, each room i has a list of keys rooms[i],
# and each key rooms[i][j] is an integer in [0, 1, ..., N-1]
# where N = rooms.length.
# A key rooms[i][... | mit | Python |
29a2dcf4ab6684187d95e0faab171b5e071e1eee | Create main.py | garyelephant/snippets,garyelephant/snippets,garyelephant/snippets,garyelephant/snippets | python/using_sqlalchemy01/main.py | python/using_sqlalchemy01/main.py | from .models import User
from .database import session_scope
if __name__ == '__main__':
with session_scope() as session:
users = session.query( User ).order_by( User.id )
# Remove all object instances from this Session to make them available to accessed by outside
users.expunge_all... | mit | Python | |
95ff080685f01cbb368d9467f67076ce9f3eae08 | add generic resource creator | remind101/stacker_blueprints,remind101/stacker_blueprints | stacker_blueprints/generic.py | stacker_blueprints/generic.py | """ Load dependencies """
from troposphere import (
Ref, Output
)
from stacker.blueprints.base import Blueprint
from stacker.blueprints.variables.types import (
CFNString,
CFNCommaDelimitedList,
)
class generic_resource_creator(Blueprint):
""" Generic Blueprint for creating a resource """
def add_... | bsd-2-clause | Python | |
3dcf737fa6a6467e1c96d31325e26ecf20c50320 | Add test cases for the logger | thombashi/sqliteschema | test/test_logger.py | test/test_logger.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import print_function
from __future__ import unicode_literals
import logbook
import pytest
from sqliteschema import (
set_logger,
set_log_level,
)
class Test_set_logger(object):
@pytest.mark.param... | mit | Python | |
9100581d63f52281c42e89ad618b0e411907cb4a | Test to help develop psf measure | toros-astro/ProperImage | test_psf_measure.py | test_psf_measure.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# test_recoverstats.py
#
# Copyright 2016 Bruno S <bruno.sanchez.63@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either versi... | bsd-3-clause | Python | |
b410facc9e7882ecec1bc1029caa3f35a3a28d03 | Test for bundle API | mturilli/aimes.emanager,mturilli/aimes.emanager | tests/bundle_api.py | tests/bundle_api.py | #!/usr/bin/env python
# pylint: disable-msg=C0103
"""Implements an Execution Manager for the AIMES demo.
"""
__author__ = "Matteo Turilli, Andre Merzky"
__copyright__ = "Copyright 2014, RADICAL"
__license__ = "MIT"
import os
import radical.utils as ru
import aimes.bundle
import aimes.emanager.interface
# Set env... | mit | Python | |
8b0b7c19d2e2c015fd8ba7d5408b23334ee8874f | Add test case for configure failure. | Distrotech/scons,Distrotech/scons,Distrotech/scons,Distrotech/scons,Distrotech/scons | test/Configure/VariantDir2.py | test/Configure/VariantDir2.py | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | mit | Python | |
1fd09e7328b1ebf41bc0790f2a96c18207b10077 | Add sine wave sweep test | depp/libfresample,depp/libfresample,depp/libfresample,h6ah4i/libfresample,h6ah4i/libfresample | tests/test-sweep.py | tests/test-sweep.py | #!/usr/bin/env python
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
class Makefile(object):
def __init__(self):
self._fp = StringIO()
self._all = set()
self._targets = set()
def add_default(self, x):
self._all.add(x)
def build(self, ... | bsd-2-clause | Python | |
93b65dd6707093487dc702fd94cdb3c6017d873b | add unit tests for translate_ix_member_name in ixapi.py | jbaltes/python-ixia | tests/test_ixapi.py | tests/test_ixapi.py | from pyixia.ixapi import translate_ix_member_name
from nose.tools import eq_
def test_translate_ix_member_name():
eq_(translate_ix_member_name('A'), 'a')
eq_(translate_ix_member_name('b'), 'b')
eq_(translate_ix_member_name('AA'), 'aa')
eq_(translate_ix_member_name('bb'), 'bb')
eq_(translate_ix_memb... | lgpl-2.1 | Python | |
9b50c5c8082a39bf36b1f23303bf148b0cc4f345 | Add proxy tests, some of them still broken | Schevo/kiwi,Schevo/kiwi,Schevo/kiwi | tests/test_proxy.py | tests/test_proxy.py | import unittest
from kiwi import ValueUnset
from kiwi.python import Settable
from kiwi.ui.proxy import Proxy
from kiwi.ui.widgets.checkbutton import ProxyCheckButton
from kiwi.ui.widgets.entry import ProxyEntry
from kiwi.ui.widgets.label import ProxyLabel
from kiwi.ui.widgets.radiobutton import ProxyRadioButton
from k... | lgpl-2.1 | Python | |
2e4111dda23e6d686c188cf832f7b6c7c19ea14b | Test ReadLengthStatistics | marcelm/cutadapt | tests/test_stats.py | tests/test_stats.py | from cutadapt.statistics import ReadLengthStatistics
class TestReadLengthStatistics:
def test_empty_on_init(self):
rls = ReadLengthStatistics()
assert rls.written_reads() == 0
assert rls.written_bp() == (0, 0)
lengths = rls.written_lengths()
assert not lengths[0] and not le... | mit | Python | |
1165673d784eab36edcdc4ed4caf22dbd222874a | Add some preliminary code and function to enlarge image | SkullTech/whois-scraper | whois-scraper.py | whois-scraper.py | from lxml import html
from PIL import Image
import requests
def enlarge_image(image_file):
image = Image.open(image_file)
enlarged_size = map(lambda x: x*2, image.size)
enlarged_image = image.resize(enlarged_size)
return enlarged_image
def extract_text(image_file):
image = enlarge_image(image_file)
# Use Tess... | mit | Python | |
8f4d557023a84f1b532fe0843615179ebf3194ec | add setup.py | zokis/DateObjects | DateObjects/setup.py | DateObjects/setup.py | # coding: utf-8
from setuptools import setup
import os
README = os.path.join(os.path.dirname(__file__), 'README.md')
setup(name='date-objects',
version='1.0',
description='helper for manipulating dates.',
long_description=open(README).read(),
author="Marcelo Fonseca Tambalo", author_email="ma... | mit | Python | |
7d1f6125d1f56b871e8d6515e7dd1844e36968b1 | Add exception support, most code transferred from driver's code | mfcloud/python-zvm-sdk,mfcloud/python-zvm-sdk,mfcloud/python-zvm-sdk,mfcloud/python-zvm-sdk | zvmsdk/exception.py | zvmsdk/exception.py | import config
import log
import six
CONF = config.CONF
LOG = log.LOG
class BaseException(Exception):
"""
Inherit from this class and define a 'msg_fmt' property.
That msg_fmt will get printf'd with the keyword arguments
provided to the constructor.
"""
msg_fmt = "An unknown exception occurred... | apache-2.0 | Python | |
1d1f9d5d8f4873d6a23c430a5629eaeddfd50d2a | Add network set default route view | CanonicalLtd/subiquity,CanonicalLtd/subiquity | subiquity/ui/views/network_default_route.py | subiquity/ui/views/network_default_route.py | # Copyright 2015 Canonical, Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | agpl-3.0 | Python | |
8b8db4f78610b6c8b72270275a621d529091a74f | Set account_credit_control_dunning_fees to installable | nagyv/account-financial-tools,bringsvor/account-financial-tools,andrius-preimantas/account-financial-tools,taktik/account-financial-tools,OpenPymeMx/account-financial-tools,iDTLabssl/account-financial-tools,Antiun/account-financial-tools,diagramsoftware/account-financial-tools,adhoc-dev/oca-account-financial-tools,rayc... | account_credit_control_dunning_fees/__openerp__.py | account_credit_control_dunning_fees/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publi... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publi... | agpl-3.0 | Python |
d7c46e9bc205d8f5a3cf7e1871547eff8ae7164c | Implement performance testing script | jssenyange/traccar,jssenyange/traccar,tsmgeek/traccar,AnshulJain1985/Roadcast-Tracker,tananaev/traccar,ninioe/traccar,orcoliver/traccar,tananaev/traccar,ninioe/traccar,renaudallard/traccar,jon-stumpf/traccar,tananaev/traccar,tsmgeek/traccar,al3x1s/traccar,tsmgeek/traccar,joseant/traccar-1,duke2906/traccar,joseant/tracc... | tools/test-performance.py | tools/test-performance.py | #!/usr/bin/python3
import asyncio
import random
host = 'localhost'
port = 5027
messageLogin = bytearray.fromhex('000F313233343536373839303132333435')
messageLocation = bytearray.fromhex('000000000000002b080100000140d4e3ec6e000cc661d01674a5e0fffc00000900000004020100f0000242322318000000000100007a04')
devices = 100
pe... | apache-2.0 | Python | |
2c57f2143e21fa3d006d4e4e2737429fb60b4797 | Call pip install before running server. | knewmanTE/FrameworkBenchmarks,PermeAgility/FrameworkBenchmarks,circlespainter/FrameworkBenchmarks,raziel057/FrameworkBenchmarks,saturday06/FrameworkBenchmarks,circlespainter/FrameworkBenchmarks,sanjoydesk/FrameworkBenchmarks,ashawnbandy-te-tfb/FrameworkBenchmarks,markkolich/FrameworkBenchmarks,stefanocasazza/FrameworkB... | tornado/setup_pg.py | tornado/setup_pg.py | import os
import subprocess
import sys
import time
bin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin')
python = os.path.expanduser(os.path.join(bin_dir, 'python'))
pip = os.path.expanduser(os.path.join(bin_dir, 'pip'))
cwd = os.path.expanduser('~/FrameworkBenchmarks/tornado')
def start(args, logf... | from os.path import expanduser
from os import kill
import subprocess
import sys
import time
python = expanduser('~/FrameworkBenchmarks/installs/py2/bin/python')
cwd = expanduser('~/FrameworkBenchmarks/tornado')
def start(args, logfile, errfile):
subprocess.Popen(
python + " server.py --port=8080 --postg... | bsd-3-clause | Python |
fdfc17628c34a4219fd61a6f54fc5d86fbb0d6d2 | Add script to copy the files of selected edbo titles | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | copy_edbo_titles.py | copy_edbo_titles.py | """Script that copies the files of edbo titles that are both available and
selected.
For convenience hard coded file paths are used.
Usage: python copy_edbo_titles.py
"""
import pandas as pd
import glob
import shutil
import os
import re
import requests
from bs4 import BeautifulSoup
def get_file_id(row):
#print... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.