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 |
|---|---|---|---|---|---|---|---|---|
abd70f40aaa026844f9b088a4a648ce58e469839 | add preliminary measure script | miklos1/fayette | measure.py | measure.py | from __future__ import absolute_import, division, print_function
from six.moves import filter, intern, map, range, zip
from functools import reduce
from numpy import cbrt, floor, sqrt
from firedrake.petsc import PETSc
from firedrake import ExtrudedMesh, UnitSquareMesh, assemble
import form
num_matvecs = 20
PETS... | mit | Python | |
462f9a651eb93aca3c8ff980345e40429e6f3fe9 | add migrate script | anapat/Upload-Data-to-Amazon-S3 | migrate.py | migrate.py | # -*- coding: utf-8 -*-
import os
from boto.s3.connection import S3Connection
from boto.s3.key import Key
connection = S3Connection(
host = 's3.amazonaws.com', # S3 Compatible Services
is_secure = True,
aws_access_key_id = 'access_key_id', # Add your access key
aws_secret_access_key = 'secret_acce... | apache-2.0 | Python | |
feb4e40afa8b589d9dc90652099202d07921f4b8 | add 0021 | Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2 | llluiop/0021/password.py | llluiop/0021/password.py | #!/usr/bin/env python
#-*- coding: utf-8-*-
import os
from hashlib import sha256
from hmac import HMAC
def encode(password):
salt = os.urandom(8)
print salt
result = password.encode("utf-8")
for i in range(10):
result = HMAC(result, salt, sha256).digest()
return result
if __name__ ==... | mit | Python | |
debaa1f32b6b2dcbc7a7e8a02de19afc2c86a29f | add asgi file | fcurella/django-channels-react-redux,fcurella/django-channels-react-redux,fcurella/django-channels-react-redux | django_react/asgi.py | django_react/asgi.py | import os
import channels.asgi
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_react.settings")
channel_layer = channels.asgi.get_channel_layer()
| bsd-3-clause | Python | |
002e903c978a30f27ed24316bb85958e5c69a259 | Solve Code Fights count visitors problem | HKuz/Test_Code | CodeFights/countVisitors.py | CodeFights/countVisitors.py | #!/usr/local/bin/python
# Code Fights Count Visitors Problem
class Counter(object):
def __init__(self, value):
self.value = value
def inc(self):
self.value += 1
def get(self):
return self.value
def countVisitors(beta, k, visitors):
counter = Counter(beta)
for visitor in... | mit | Python | |
f53aef9fdcd01fdb8607984e38b4fb8c5813aacf | Solve Code Fights fibonacci list problem | HKuz/Test_Code | CodeFights/fibonacciList.py | CodeFights/fibonacciList.py | #!/usr/local/bin/python
# Code Fights Fibonacci List Problem
from functools import reduce
def fibonacciList(n):
return [[0] * x for x in reduce(lambda x, n: x + [sum(x[-2:])],
range(n - 2), [0, 1])]
def main():
tests = [
[
6,
[[],
... | mit | Python | |
93a9ba6bacf6c1f32b8601c6de6153048c5d9feb | Create Keithley_autoprobefilter.py | jzmnd/fet-py-scripts | Keithley_autoprobefilter.py | Keithley_autoprobefilter.py | # Reads Keithley .xls and filters data from autoprober
# Jeremy Smith
# Northwestern University
# Version 1.1
from numpy import *
import xlrd
import os
import sys
from myfunctions import *
from scipy import stats
data_path = os.path.dirname(__file__) # Path name for location of script
print "\n"
print data_path... | mit | Python | |
902cf7f0b167847a96e1db0cd523878c5abb9032 | add addlc.py: add 2 lightcurves (to be used to crate EPIC combined lightcurves) | evandromr/python_scitools | addlcs.py | addlcs.py | #!/usr/env python
import myscitools
import glob
if __name__ == '__main__':
'''
Add lightcurves
MOS1 + MOS2 = MOSS
PN + MOSS = EPIC
'''
mos1files = glob.glob('MOS1_lc_net*')
mos2files = glob.glob('MOS2_lc_net*')
pnfiles = glob.glob('PN_lc_net*')
mos1files.sort()
mos2files.sort(... | mit | Python | |
0116701a64748efe1348686c2c52069d8d94c5f9 | Add migration | mfcovington/djangocms-lab-carousel,mfcovington/djangocms-lab-carousel | cms_lab_carousel/migrations/0004_auto_20151207_0015.py | cms_lab_carousel/migrations/0004_auto_20151207_0015.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('cms_lab_carousel', '0003_auto_20150827_0111'),
]
operations = [
... | bsd-3-clause | Python | |
5b1782ad41d738bce01f20b4cef5242420e83931 | 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/matplotlib/colour_map_list.py | python/matplotlib/colour_map_list.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# See: http://matplotlib.org/1.2.1/examples/pylab_examples/show_colormaps.html
# See also:
# - http://matplotlib.org/examples/color/colormaps_reference.html (the list of all colormaps)
# - http://matplotlib.org/users/colormaps.html?highlight=colormap#mycarta-banding (wha... | mit | Python | |
ad47e008ec61772c8c169742f0ab944f0f426a7a | Add solution to 97. | bsamseth/project-euler,bsamseth/project-euler | 097/97.py | 097/97.py |
def two_to_n_mod_10_to_m(n, m):
"""Successive squaring. Very fast and handles very large numbers.
1. Rewrite 2^n so that n is a sum of powers of two.
2. Create a list of powers 2^(2^i) mod 10^m, by repeatedly squaring the prior result.
3. Combine, with multiplication mod 10^m, the powers in the list ... | mit | Python | |
644ada5f8afcfe791299eea72efda1b0475040aa | Add benchmark for parsing vs. serializing. | plures/ndtypes,skrah/ndtypes,plures/ndtypes,skrah/ndtypes,plures/ndtypes,skrah/ndtypes,plures/ndtypes,skrah/ndtypes | python/bench.py | python/bench.py | from ndtypes import *
import time
# =============================================================================
# Type with huge number of offsets
# =============================================================================
s = "var(offsets=[0,10000000]) * var(offsets=%s) * int64" % list(ra... | bsd-3-clause | Python | |
bf744e472209162ce83b2759c9240cb3018cb0bf | Fix find_packages | iheartradio/Henson | henson/contrib/__init__.py | henson/contrib/__init__.py | """Henson's contrib packages."""
| apache-2.0 | Python | |
11296e24228ee10be009b04a9909504a8e8d5ace | Test for the save_character() function | Enether/python_wow | tests/models/character/test_saver.py | tests/models/character/test_saver.py | import unittest
import database.main
from tests.create_test_db import engine, session, Base
database.main.engine = engine
database.main.session = session
database.main.Base = Base
import models.main
from classes import Paladin
from models.characters.saved_character import SavedCharacterSchema
from models.items.item_t... | mit | Python | |
b329688792d65555ab7169d0ff625f2b4bddd7f2 | Add initial API integration tests | ivuk/pyusesthis | tests/test_integration_pyusesthis.py | tests/test_integration_pyusesthis.py | from pyusesthis import pyusesthis
class TestClass:
def test_get_hardware_all(self):
response = pyusesthis.get_hardware('all')
assert isinstance(response, str)
assert 'thinkpad-x220' in response
assert 'Xeon E5-2680' in response
def test_get_hardware(self):
response = ... | mit | Python | |
dcb4a8ae0732b78afa4385988714f19b78fb3312 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/ff451b346ffc6061369b7712da787ceb2b5becf7. | Intel-Corporation/tensorflow,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-experimental_link_static_libraries_once,frreiss/tensorflow-fred,karllessard/tensorflow,paolodedios/tensorflow,yongtang/tensorflow,gautam1858/tens... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "ff451b346ffc6061369b7712da787ceb2b5becf7"
TFRT_SHA256 = "333151d184baf3b8b384615ea20c9ab14efab635f096b3... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "94a9cc13caf5aa8e2ba54937ed837279c11c78e4"
TFRT_SHA256 = "8a9257aaf2b0042824659be7b2fd8335f37b98a4f57f76... | apache-2.0 | Python |
5568f30f2bcb83eb8f4dd250d8c817aaea3815f5 | Create chalkboard-xor-game.py | kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015 | Python/chalkboard-xor-game.py | Python/chalkboard-xor-game.py | # Time: O(n)
# Space: O(1)
# We are given non-negative integers nums[i] which are written on a chalkboard.
# Alice and Bob take turns erasing exactly one number from the chalkboard,
# with Alice starting first. If erasing a number causes the bitwise XOR of
# all the elements of the chalkboard to become 0, then that ... | mit | Python | |
c9294cbc743923c8898b7775392e93313c1ba171 | Create FindMininRSA2_001.py | Chasego/codirit,cc13ny/algo,Chasego/codi,Chasego/cod,cc13ny/Allin,cc13ny/algo,Chasego/codirit,cc13ny/algo,cc13ny/Allin,Chasego/cod,Chasego/codirit,Chasego/codi,Chasego/codirit,cc13ny/algo,cc13ny/algo,cc13ny/Allin,Chasego/codi,Chasego/codi,Chasego/codirit,cc13ny/Allin,Chasego/cod,Chasego/cod,Chasego/cod,Chasego/codi,cc1... | leetcode/154-Find-Minimum-in-Rotated-Sorted-Array-II/FindMininRSA2_001.py | leetcode/154-Find-Minimum-in-Rotated-Sorted-Array-II/FindMininRSA2_001.py | class Solution:
# @param num, a list of integer
# @return an integer
def findMin(self, num):
L = 0; R = len(num)-1
while L < R and num[L] >= num[R]:
M = (L+R)/2
if num[M] > num[L]:
L = M + 1
elif num[M] < num[R]:
R = M
... | mit | Python | |
a78d93dbc23d832ca5eaae6535a45bfa478e4e56 | Add US state capitals from vega-lite. | altair-viz/altair,ellisonbg/altair,jakevdp/altair | altair/vegalite/v2/examples/us_state_capitals.py | altair/vegalite/v2/examples/us_state_capitals.py | """
U.S. state capitals overlayed on a map of the U.S
================================================-
This is a geographic visualization that shows US capitals
overlayed on a map.
"""
import altair as alt
from vega_datasets import data
states = alt.UrlData(data.us_10m.url,
format=alt.TopoDataFo... | bsd-3-clause | Python | |
301a506aa21d4439448508ed80844d402c574e97 | Add version 1.7 (#26712) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-pygraphviz/package.py | var/spack/repos/builtin/packages/py-pygraphviz/package.py | # Copyright 2013-2021 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 PyPygraphviz(PythonPackage):
"""Python interface to Graphviz"""
homepage = "https://p... | lgpl-2.1 | Python | |
f22abf2b8a31d9621a891191db84364edb167390 | Add a management command to create realm administrators. | wdaher/zulip,xuxiao/zulip,showell/zulip,jonesgithub/zulip,levixie/zulip,Gabriel0402/zulip,ryansnowboarder/zulip,zacps/zulip,rht/zulip,suxinde2009/zulip,hustlzp/zulip,bowlofstew/zulip,sharmaeklavya2/zulip,seapasulli/zulip,SmartPeople/zulip,dxq-git/zulip,sup95/zulip,dhcrzf/zulip,timabbott/zulip,tommyip/zulip,zacps/zulip,... | zephyr/management/commands/knight.py | zephyr/management/commands/knight.py | from __future__ import absolute_import
import sys
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ValidationError
from django.db.utils import IntegrityError
from django.core import validators
from guardian.shortcuts import assign_p... | apache-2.0 | Python | |
4aeba707e8bec6e5cfc8cebf08f307044e145bf3 | Add script to meas TS dispersion | lnls-fac/apsuite | apsuite/commissioning_scripts/measure_disp_ts.py | apsuite/commissioning_scripts/measure_disp_ts.py | #!/usr/bin/env python-sirius
"""."""
import time as _time
import numpy as np
from epics import PV
import pyaccel
from pymodels.middlelayer.devices import SOFB, RF
from apsuite.commissioning_scripts.base import BaseClass
class ParamsDisp:
"""."""
def __init__(self):
"""."""
self.energy_delt... | mit | Python | |
ee1beb9b4bd51ab8f0bcb473d329275c68430919 | Ajoute un script remplaçant des extraits d’enregistrement par les enregistrements entiers. | dezede/dezede,dezede/dezede,dezede/dezede,dezede/dezede | scripts/remplacement_extraits_AFO.py | scripts/remplacement_extraits_AFO.py | # coding: utf-8
"""
Copie les fichiers listés dans "Campagne num° 2012-13.xlsx" (chemin : filepath)
depuis dir_source vers dir_dest.
"""
from __future__ import print_function
import os
import shutil
import pandas as pd
from scripts.import_AFO_11_2014 import path, NOM_FICHIER, REMARQUE, EXCL_MSG
def run(dir_source, d... | bsd-3-clause | Python | |
7eef45621d3e917cf09101b309a7c839008dde76 | Fix indentation | AnishShah/tensorflow,eaplatanios/tensorflow,ArtsiomCh/tensorflow,aselle/tensorflow,manazhao/tf_recsys,gojira/tensorflow,jalexvig/tensorflow,manazhao/tf_recsys,meteorcloudy/tensorflow,snnn/tensorflow,adamtiger/tensorflow,xzturn/tensorflow,ghchinoy/tensorflow,renyi533/tensorflow,tiagofrepereira2012/tensorflow,raymondxyan... | tensorflow/core/platform/default/build_config_root.bzl | tensorflow/core/platform/default/build_config_root.bzl | # Lower-level functionality for build config.
# The functions in this file might be referred by tensorflow.bzl. They have to
# be separate to avoid cyclic references.
def tf_cuda_tests_tags():
return ["local"]
def tf_sycl_tests_tags():
return ["local"]
def tf_additional_plugin_deps():
return select({
"//... | # Lower-level functionality for build config.
# The functions in this file might be referred by tensorflow.bzl. They have to
# be separate to avoid cyclic references.
def tf_cuda_tests_tags():
return ["local"]
def tf_sycl_tests_tags():
return ["local"]
def tf_additional_plugin_deps():
return select({
"//... | apache-2.0 | Python |
cfc11472f16040d06915a58c3dd3c027b77fdd80 | set up testing with py.test | hdashnow/STRetch,Oshlack/STRetch,Oshlack/STRetch,hdashnow/STRetch,Oshlack/STRetch | scripts/tests/test_identify_locus.py | scripts/tests/test_identify_locus.py | import sys
sys.path.append("..")
from identify_locus import *
def test_answer():
assert 5 == 5
| mit | Python | |
4f1e1874f3ed9af8922aa26eb20230dbee5e6d73 | Add some example code for creation of disk partitions. | vpodzime/blivet,dwlehman/blivet,rhinstaller/blivet,vojtechtrefny/blivet,jkonecny12/blivet,vojtechtrefny/blivet,AdamWill/blivet,AdamWill/blivet,rvykydal/blivet,rvykydal/blivet,rhinstaller/blivet,jkonecny12/blivet,dwlehman/blivet,vpodzime/blivet | examples/partitioning.py | examples/partitioning.py | import logging
import sys
import os
from common import set_up_logging
from common import create_sparse_file
from common import tear_down_disk_images
from common import print_devices
# doing this before importing blivet gets the logging from format class
# registrations and other stuff triggered by the import
set_up_l... | lgpl-2.1 | Python | |
d35dd563b25f85d23191169e8f87882129f64adb | Add images admin | stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten | features/images/admin.py | features/images/admin.py | from django.contrib import admin
from . import models
admin.site.register(models.Image)
| agpl-3.0 | Python | |
a0c23d3fc448f916ffdd668a2daf56408dd9c0c0 | Add simple implementation for a pre-commit hook | EliRibble/mothermayi | mothermayi/pre_commit.py | mothermayi/pre_commit.py | import mothermayi.entryway
import mothermayi.git
def handle_plugins(entries):
for entry in entries:
result = entry()
def run():
with mothermayi.git.stash():
entries = mothermayi.entryway.get_entries('pre-commit')
handle_plugins(entries)
| mit | Python | |
d9c283c37f350c8b1629e671f38ef447ef1bbd1f | Add inventory unit tests | dtroyer/python-openstacksdk,openstack/python-openstacksdk,stackforge/python-openstacksdk,openstack-infra/shade,dtroyer/python-openstacksdk,openstack-infra/shade,stackforge/python-openstacksdk,openstack/python-openstacksdk | shade/tests/unit/test_inventory.py | shade/tests/unit/test_inventory.py | # -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | apache-2.0 | Python | |
ec69c9260a2205ab0b7b9b7c4903ae2ced6029a1 | add settings file | andreas-h/mss-chem | msschem_settings.py | msschem_settings.py | import os.path
from msschem.models import CAMSRegDriver
from msschem.download import CAMSRegDownload
register_datasources = {
'CAMSReg_ENSEMBLE': CAMSRegDriver(
dict(
dldriver=CAMSRegDownload(
token='MYTOKEN',
modelname='ENSEMBLE'),
force=False,
... | mit | Python | |
e8d579177ee9fae714dcc3dfc36b5a5c234dfa0e | Create simulator_follow_blue.py | CSavvy/python | simulator/simulator_follow_blue.py | simulator/simulator_follow_blue.py | from Myro import *
init("sim")
setPictureSize("small")
autoCamera()
#'''
#chase blue setting
ylow = 0
yhigh = 255
ulow = 170 #130 for the straw # originally 134
uhigh = 250 # up to 158, really 145, 157 for the straw #142 originally
vlow = 90 # down to 109, really 114, 110 for the straw #114 originally
vhigh = 120 #r... | mit | Python | |
7ebded009386fe5b9ef4a6719fe100fa0a3836ba | Create 0013.py | Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python | Liez-python-code/0013/0013.py | Liez-python-code/0013/0013.py | # 网址:http://tieba.baidu.com/p/4341640851
import os
import re
import urllib.request
def pic_collector(url):
content = urllib.request.urlopen(url).read()
r = re.compile('<img class="BDE_Image" pic_type="1" width="450" height="450" src="(.*?)" ')
pic_list = r.findall(content.decode('utf-8'))
os.mkdir('p... | mit | Python | |
cc488a5082a98f9e0a5a60a86815cb8c518fcc2d | Add test for PosRecChiSquareGamma | XENON1T/pax,XENON1T/pax | tests/test_posrecchisquaregamma.py | tests/test_posrecchisquaregamma.py | import unittest
import numpy as np
from pax import core, plugin
from pax.datastructure import Event, Peak
from pax.utils import empty_event
class TestPosRecChiSquareGamma(unittest.TestCase):
def setUp(self):
self.pax = core.Processor(config_names='posrecChi',
just_testi... | bsd-3-clause | Python | |
d8eb3d1f840dbcfbe32bf98e757b841fd062ad9e | Create ContainDupII_001.py | Chasego/codirit,Chasego/cod,Chasego/cod,Chasego/codirit,cc13ny/algo,cc13ny/Allin,Chasego/cod,Chasego/codi,Chasego/codi,Chasego/codi,Chasego/cod,cc13ny/algo,Chasego/codirit,Chasego/codirit,cc13ny/algo,cc13ny/Allin,Chasego/cod,Chasego/codi,cc13ny/Allin,Chasego/codi,cc13ny/algo,cc13ny/algo,Chasego/codirit,cc13ny/Allin,cc1... | leetcode/219-Contains-Duplicate-II/ContainDupII_001.py | leetcode/219-Contains-Duplicate-II/ContainDupII_001.py | class Solution:
# @param {integer[]} nums
# @param {integer} k
# @return {boolean}
def containsNearbyDuplicate(self, nums, k):
tb = {}
for i in range(len(nums)):
num = nums[i]
if num not in tb:
tb[num] = i
elif i - tb[num] <= k:
... | mit | Python | |
16615d7794b127e9752b1a2b0bd8e70adfb0954c | Add tests for inplace subset | theislab/anndata | anndata/tests/test_inplace_subset.py | anndata/tests/test_inplace_subset.py | import numpy as np
import pytest
from sklearn.utils.testing import (
assert_array_equal
)
from scipy import sparse
from anndata.tests.helpers import (
gen_adata,
subset_func,
asarray
)
@pytest.fixture(
params=[np.array, sparse.csr_matrix, sparse.csc_matrix],
ids=["np_array", "scipy_csr", "scip... | bsd-3-clause | Python | |
db660f2a155b490f6a7f553ef19b8eaf8f9c9776 | Create สร้าง-LINE-Bot-ด้วย-Python.py | wannaphongcom/code-python3-blog | สร้าง-LINE-Bot-ด้วย-Python.py | สร้าง-LINE-Bot-ด้วย-Python.py | # อ่าบทความ https://python3.wannaphong.com/blog/2016/10/02/สร้าง-line-bot-ด้วย-python/
from flask import Flask, request
import json
import requests
app = Flask(__name__)
@app.route('/')
def index():
return "Hello World!"
# ส่วน callback สำหรับ Webhook
@app.route('/callback', methods=['POST'])
def callback():
... | mit | Python | |
e27bc1f295e9e3f41f5d1fc8b964283188e6e5d5 | add GP classification implementation | feuerchop/h3lib | h3lib.learn.api/H3GPC.py | h3lib.learn.api/H3GPC.py | __author__ = 'morgan'
import numpy as np
from H3Kernels import kernel
class H3GPC(object):
'''
Gaussian process classification main class
The implementation is referred to Rasmussen & Williams' GP book.
Note: we use Laplace appriximation and logistic function for GPC.
'''
def __init__(self, s... | mit | Python | |
8f227ebc4900b931a90e0c87d9f61b4c6ea0e084 | add simple topology example | knodir/son-emu,knodir/son-emu,knodir/son-emu,knodir/son-emu | src/emuvim/examples/sonata_simple_topology.py | src/emuvim/examples/sonata_simple_topology.py | """
Copyright (c) 2015 SONATA-NFV
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 applicable law or agreed to... | apache-2.0 | Python | |
eb87d38a65620c7e4a716dca8a8b9488b3a338d3 | Fix syntax error in collector test | tellapart/Diamond,socialwareinc/Diamond,python-diamond/Diamond,works-mobile/Diamond,tuenti/Diamond,Ensighten/Diamond,TinLe/Diamond,sebbrandt87/Diamond,actmd/Diamond,Nihn/Diamond-1,EzyInsights/Diamond,bmhatfield/Diamond,zoidbergwill/Diamond,jaingaurav/Diamond,krbaker/Diamond,TAKEALOT/Diamond,thardie/Diamond,thardie/Diam... | src/collectors/numa/test/testnuma.py | src/collectors/numa/test/testnuma.py | #!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import patch
from diamond.collector import Collector
from numa import NumaCollector
##########... | #!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import patch
from diamond.collector import Collector
from numa import NumaCollector
##########... | mit | Python |
e238d7cfe1a4eace62ba6a9d199813f317c34c6a | Create AnalyticalDistributions.py | Effective-Quadratures/Effective-Quadratures,psesh/Effective-Quadratures | effective_quadratures/AnalyticalDistributions.py | effective_quadratures/AnalyticalDistributions.py | #!/usr/bin/env python
import numpy as np
from scipy.special import erf
"""
Analytical definitions for some sample PDFs. Functions in this file are
called by PolyParams when constructing "custom" orthogonal polynomials,
which require Stieltejes procedure for computing the recurrence coefficients.
Pranay S... | lgpl-2.1 | Python | |
17ba5378934d043052c3e368b4b5468c3a24a7e2 | Test example to specify initial harmonies | gfairchild/pyHarmonySearch | examples/2-D_continuous_initial_harmonies_set.py | examples/2-D_continuous_initial_harmonies_set.py | #!/usr/bin/env python
"""
Copyright (c) 2013, Los Alamos National Security, LLC
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 abov... | bsd-3-clause | Python | |
0263eb5a96f610b5a2e77d11ad26e892d78c9eda | add 191 | EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,zeyuanxy/project-euler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler | vol4/191.py | vol4/191.py | if __name__ == "__main__":
lst = [1, 3, 0, 2, 1, 0, 0, 1]
while lst[0] < 30:
n, t, a, b, c, d, e, f = lst
lst = [n + 1, 2 * t + b - a, c, 2 * b - a + d, t - (a + c), e, f, t]
print lst[1]
| mit | Python | |
84d3e73fd7ff79e36268fce4b470af8fa3617f0c | Add couple of routes for the admin blueprint | finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is,finnurtorfa/aflafrettir.is | app/admin/routes.py | app/admin/routes.py | from flask import render_template, redirect, url_for, flash, request
from flask.ext.login import login_required, current_user
from . import admin
from .forms import ProfileForm
from .. import db
from ..models import User
@admin.route('/')
@login_required
def index():
return render_template('admin/user.html', user=... | mit | Python | |
12bb21ca19a36465241c85b4f69838294c817630 | Update to version 3.4.2 | willthames/ansible-lint,MatrixCrawler/ansible-lint,dataxu/ansible-lint | lib/ansiblelint/version.py | lib/ansiblelint/version.py | __version__ = '3.4.2'
| __version__ = '3.4.1'
| mit | Python |
4e4d4365a0ef1a20d181f1015152acb116226e3d | Add device class for low battery (#10829) | mKeRix/home-assistant,pschmitt/home-assistant,turbokongen/home-assistant,jnewland/home-assistant,sander76/home-assistant,adrienbrault/home-assistant,tboyce021/home-assistant,tchellomello/home-assistant,persandstrom/home-assistant,molobrakos/home-assistant,HydrelioxGitHub/home-assistant,mezz64/home-assistant,aequitas/ho... | homeassistant/components/binary_sensor/__init__.py | homeassistant/components/binary_sensor/__init__.py | """
Component to interface with binary sensors.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/binary_sensor/
"""
import asyncio
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.helpers.entity_component import ... | """
Component to interface with binary sensors.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/binary_sensor/
"""
import asyncio
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.helpers.entity_component import ... | mit | Python |
4d2b0fdb4ee3289c7a2ba435f77f70c978cdd166 | add script to fetch recursively [bug] infinite loop | DeercoderPractice/tools,DeercoderPractice/tools | fetch_recursively.py | fetch_recursively.py | #!/usr/bin/env python
from sys import argv
import random
import urllib
def fetch(src_url):
## first fetch the source HTML page
num = 100000 * random.random()
filename = str(num)
urllib.urlretrieve(src_url, filename=filename)
txt = open(filename, "r")
for line in txt:
index = line.find(".pdf")
inde... | apache-2.0 | Python | |
2ea9f36c8eaf796011d93c361e663b01ba259842 | Call new doc sync in repair command | zenefits/sentry,JackDanger/sentry,mitsuhiko/sentry,mvaled/sentry,BuildingLink/sentry,nicholasserra/sentry,zenefits/sentry,BuildingLink/sentry,BuildingLink/sentry,alexm92/sentry,BuildingLink/sentry,fotinakis/sentry,gencer/sentry,JamesMura/sentry,fotinakis/sentry,looker/sentry,JackDanger/sentry,daevaorn/sentry,mvaled/sen... | src/sentry/runner/commands/repair.py | src/sentry/runner/commands/repair.py | """
sentry.runner.commands.repair
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import os
import click
from sentry.runner.decorators import configuration
@cl... | """
sentry.runner.commands.repair
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import click
from sentry.runner.decorators import configuration
@click.comman... | bsd-3-clause | Python |
eec339635bee64d3e50a29167a639a93bc40a3a3 | Create set selections for debconf | hatchery/Genepool2,hatchery/genepool | genes/debconf/set.py | genes/debconf/set.py | import os
from subprocess import call
from functools import partial
#TODO: stop using sudo or ensure it exists
#TODOE: specify user to run as
#TODO: utilize functools partial to handle some of the above functionality
class Config:
SET_SELECTIONS = ['sudo', '-E', 'debconf-set-selections']
ENV = os.environ.copy(... | mit | Python | |
7a4857682567b5a23f940e05189e02d797599d51 | Add tests/test_00_info.py that simply reports the icat version number and package directory to the terminal. | icatproject/python-icat | tests/test_00_info.py | tests/test_00_info.py | """Report version info about python-icat being tested.
"""
from __future__ import print_function
import pytest
import os.path
import icat
class Reporter(object):
"""Cumulate messages and report them later using a terminalreporter.
"""
def __init__(self, terminalreporter):
super(Reporter, self).__... | apache-2.0 | Python | |
9afbdbb0fa7f77269b08680e9290fa2628d88caf | add problem 069 | smrmkt/project_euler | problem_069.py | problem_069.py | #!/usr/bin/env python
#-*-coding:utf-8-*-
'''
Euler's Totient function, φ(n) [sometimes called the phi function],
is used to determine the number of positive numbers less than or
equal to n which are relatively prime to n.
For example, as 1, 2, 4, 5, 7, and 8, are all less than nine and
relatively prime to nine, φ(9)=... | mit | Python | |
292fd8b37f9f0b28176ceb3c41f3b2f85b227049 | bump version in __init__.py | WillianPaiva/1flow,1flow/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,WillianPaiva/1flow | oneflow/__init__.py | oneflow/__init__.py |
VERSION = '0.20.11.15'
|
VERSION = '0.20.11.14'
| agpl-3.0 | Python |
9df7b7e49c5f7ec9d8962cc28f1b19f18dda114c | Add custom exceptions for api errors | alexbotello/python-overwatch | overwatch/errors.py | overwatch/errors.py | class InvalidFilter(Exception):
"""
Raise when 'filter' key word argument is not recognized
"""
pass
class InvalidHero(Exception):
"""
Raise when 'hero' key word argument is not recognized
"""
pass
class InvalidCombination(Exception):
"""
Raise when 'filter' and 'hero' key wo... | mit | Python | |
0d3343300d62afc37ba7a3bc1ec6e81bb8f8c648 | add parent.py to be forked | open-lambda/open-lambda,open-lambda/open-lambda,open-lambda/open-lambda,open-lambda/open-lambda,open-lambda/open-lambda | worker/namespace/parent.py | worker/namespace/parent.py | #TODO make sure listening on the pipe blocks correctly, better error handling
import os, sys, ns, time
from subprocess import check_output
sys.path.append('/handler') # assume submitted .py file is /handler/lambda_func
def handler(args, path):
import lambda_func
try:
ret = lambda_func(args)
excep... | apache-2.0 | Python | |
1b7cce5b8dd274b904466dc6deeac312238fc857 | add test_comp.py, add test function stubs | kmuehlbauer/wradlib,wradlib/wradlib,wradlib/wradlib,heistermann/wradlib,heistermann/wradlib,kmuehlbauer/wradlib | wradlib/tests/test_comp.py | wradlib/tests/test_comp.py | #!/usr/bin/env python
# -------------------------------------------------------------------------------
# Name: test_comp.py
# Purpose: testing file for the wradlib.comp module
#
# Authors: wradlib developers
#
# Created: 26.02.2016
# Copyright: (c) wradlib developers
# Licence: The MIT License... | mit | Python | |
80089ad2856b60383692a8dd5abe8520f61a0895 | Create write_OME-XML_from_file.py | sebi06/BioFormatsRead | write_OME-XML_from_file.py | write_OME-XML_from_file.py | # -*- coding: utf-8 -*-
"""
@author: Sebi
File: write_OME-XML_from_file.py
Date: 17.12.2015
Version. 1.0
"""
import bfimage as bf
from lxml import etree as etl
def create_omexml(testdata, method=1, writeczi_metadata=True):
# creates readable xml files from image data files. Default method should be = 1.
if... | bsd-2-clause | Python | |
5f5f48f2f6f8c82d97858230219f67229d3165a4 | patch to add match_ids to history | em92/quakelive-local-ratings,em92/quakelive-local-ratings,em92/pickup-rating,em92/quakelive-local-ratings,em92/pickup-rating,em92/quakelive-local-ratings,em92/pickup-rating,em92/quakelive-local-ratings | patch-rating-history2.py | patch-rating-history2.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
from datetime import datetime
from dump_qlstats_data import connect_to_database
GAMETYPES_AVAILABLE = ["ad", "ctf", "tdm"]
def main(args):
try:
db = connect_to_database()
except Exception as e:
print("error: " + str(e))
return 1
for gametype in GA... | agpl-3.0 | Python | |
38375800cee8c02051d7d8212ccc5fc843a109f1 | Create client.py | Colviz/Vince | client.py | client.py | import socket
def Main():
host = '192.168.43.130'
port = 5000
s = socket.socket()
s.connect((host, port))
message = raw_input('-->')
while message != 'q':
s.send(message)
data = s.recv(1024)
print "server: " + str(data)
message = raw_input('-->')
s.close()
if __name__ == '__main__':
Main()
| apache-2.0 | Python | |
901d430e3f6705af372974b6e1b42e36884ba47f | Add mplimporthook.py | mikebirdgeneau/Docker-Datastack,mikebirdgeneau/Docker-Datastack,mikebirdgeneau/Docker-Datastack,mikebirdgeneau/Docker-Datastack,mikebirdgeneau/Docker-Datastack | jupyter/mplimporthook.py | jupyter/mplimporthook.py | """Startup script for IPython kernel.
Installs an import hook to configure the matplotlib backend on the fly.
Originally from @minrk at
https://github.com/minrk/profile_default/blob/master/startup/mplimporthook.py
Repurposed for docker-stacks to address repeat bugs like
https://github.com/jupyter/docker-stacks/issues... | mit | Python | |
baaeee7b003030ded5336c7da9e01c04beea46f3 | add swscale dependency | tuttleofx/sconsProject | autoconf/swscale.py | autoconf/swscale.py | from _external import *
swscale = LibWithHeaderChecker(
'swscale',
'libswscale/swscale.h',
'c',
)
| mit | Python | |
626ce0dbd2450812e0cbac12293133e12bae0daf | Add parsing module | fbergroth/autosort | autosort/parsing.py | autosort/parsing.py | import ast
import textwrap
import tokenize
from collections import namedtuple
from tokenize import COMMENT, DEDENT, ENDMARKER, INDENT, NEWLINE, STRING, NAME
class Name(namedtuple('Name', 'name asname')):
CAMEL, SNAKE, CONST = range(3)
@property
def kind(self):
name = self.name.split('.')[-1]
... | mit | Python | |
059dae76827ac016524925d94c10e5ed0a83f2c2 | Create PreFilterExample.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/Alessandruino/PreFilterExample.py | home/Alessandruino/PreFilterExample.py | from org.myrobotlab.opencv import OpenCVFilterAffine
affine = OpenCVFilterAffine("affine")
affine.setAngle(180.0)
leftPort= "/dev/cu.wchusbserial1450"
i01 = Runtime.start("i01","InMoov")
headTracking = i01.startHeadTracking(leftPort)
eyesTracking = i01.startEyesTracking(leftPort,10,12)
i01.headTracking.addPreFilter(... | apache-2.0 | Python | |
c24fb3b6b41b2f06cee79fd21b090403f3a67457 | Add TwrSearch class | tchx84/twitter-gobject | twitter/twr_search.py | twitter/twr_search.py | #!/usr/bin/env python
#
# Copyright (c) 2013 Martin Abente Lahaye. - tch@sugarlabs.org
#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 righ... | lgpl-2.1 | Python | |
49edeac697b6c4457f2f55ff4086c9dbacedaa71 | add try implementation | przemyslawjanpietrzak/pyMonet | pymonet/try.py | pymonet/try.py | class Try:
def __init__(self, value, is_success):
self.value = value
self.is_success = is_success
def __eq__(self, other):
return self.value == other.value and self.is_success == other.is_success
@classmethod
def of(cls, fn, *args):
try:
return cls(fn(*args... | mit | Python | |
3f35e9b3913bb99cf7b299c36528eefa878337f4 | Add method to determine output name | bacontext/mopidy,liamw9534/mopidy,kingosticks/mopidy,pacificIT/mopidy,dbrgn/mopidy,mokieyue/mopidy,ali/mopidy,dbrgn/mopidy,swak/mopidy,pacificIT/mopidy,jodal/mopidy,rawdlite/mopidy,adamcik/mopidy,abarisain/mopidy,glogiotatidis/mopidy,adamcik/mopidy,jmarsik/mopidy,swak/mopidy,hkariti/mopidy,kingosticks/mopidy,ali/mopidy... | mopidy/outputs/__init__.py | mopidy/outputs/__init__.py | import pygst
pygst.require('0.10')
import gst
import logging
logger = logging.getLogger('mopidy.outputs')
class BaseOutput(object):
"""Base class for providing support for multiple pluggable outputs."""
def get_bin(self):
"""
Build output bin that will attached to pipeline.
"""
... | import pygst
pygst.require('0.10')
import gst
import logging
logger = logging.getLogger('mopidy.outputs')
class BaseOutput(object):
"""Base class for providing support for multiple pluggable outputs."""
def get_bin(self):
"""
Build output bin that will attached to pipeline.
"""
... | apache-2.0 | Python |
ea6458a88079b939188d0e5bf86eedeb62247609 | add src/cs_utime.py | nomissbowling/nomissbowling,nomissbowling/nomissbowling | src/cs_utime.py | src/cs_utime.py | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
'''cs_utime
os.stat(fn).st_ctime # 978307200.0
tt=time.strptime('20010101T090000', '%Y%m%dT%H%M%S') # (2001,1,1,9,0,0,0,1,-1)
t=time.mktime(tt) # 978307200.0
os.utime(fn, (t, t)) # (atime, mtime)
'''
import sys, os, stat
import time
FSENC = 'cp932'
UPATH = u'/tmp/tmp'
F... | mit | Python | |
a2a268ea8b9b2876011453476baedaa4bca01559 | Create ball.py | DarkAce65/rpi-led-matrix,DarkAce65/rpi-led-matrix | python/ball.py | python/ball.py | #!/usr/bin/env python
from rgbmatrix import RGBMatrix
import sys, time
import math
rows = 16
chains = 1
parallel = 1
ledMatrix = RGBMatrix(rows, chains, parallel)
numRows = 16
height = ledMatrix.height
width = ledMatrix.width
try:
print "Press Ctrl + C to stop executing"
while True:
nextFrame = ledMatrix.CreateF... | mit | Python | |
5eb0dce7f2c287203ace05b6989785b7e4fdac75 | add script to track xmin in the database | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | nagios/check_pgsql_xmin.py | nagios/check_pgsql_xmin.py | """
Return the maximum xmin in the database
"""
import os
import sys
import stat
import psycopg2
IEM = psycopg2.connect(database='iem', host='iemdb', user='nobody')
icursor = IEM.cursor()
def check():
icursor.execute("""
SELECT datname, age(datfrozenxid) FROM pg_database
ORDER by age DESC LIMIT 1
""")... | mit | Python | |
c373bbb351de421881d9f0e2f8a16d541bb21347 | add test-receive-file-ipv6.py | freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut | tests/twisted/avahi/test-receive-file-ipv6.py | tests/twisted/avahi/test-receive-file-ipv6.py | import avahi
import urllib
import BaseHTTPServer
import SocketServer
import socket
from saluttest import exec_test
from file_transfer_helper import ReceiveFileTest
from avahitest import AvahiListener
from xmppstream import connect_to_stream6
from twisted.words.xish import domish
class TestReceiveFileIPv6(ReceiveFil... | lgpl-2.1 | Python | |
f296eb4a87a1130cb72e00099f7e9441425548ec | add device handler | cmoberg/ncclient,joysboy/ncclient,ncclient/ncclient,OpenClovis/ncclient,nwautomator/ncclient,leopoul/ncclient,kroustou/ncclient,nnakamot/ncclient,einarnn/ncclient,vnitinv/ncclient,earies/ncclient,GIC-de/ncclient,aitorhh/ncclient,lightlu/ncclient | ncclient/devices/huawei.py | ncclient/devices/huawei.py | """
Handler for Cisco Nexus device specific information.
Note that for proper import, the classname has to be:
"<Devicename>DeviceHandler"
...where <Devicename> is something like "Default", "Huawei", etc.
All device-specific handlers derive from the DefaultDeviceHandler, which implements the
generic information... | apache-2.0 | Python | |
401fbbd7440f16c462ca31150d9873da5f052356 | create app.py | Fillll/reddit2telegram,Fillll/reddit2telegram | reddit2telegram/channels/r_freegamefindings/app.py | reddit2telegram/channels/r_freegamefindings/app.py | #encoding:utf-8
subreddit = 'freegamefindings'
t_channel = '@r_freegamefindings'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| mit | Python | |
412828bea81f5aad917188881c1e7e4d6ce52400 | Add tests for the management views | usingnamespace/usingnamespace | usingnamespace/tests/test_views_management.py | usingnamespace/tests/test_views_management.py | import unittest
from pyramid import testing
class ManagementViewsTest(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
def tearDown(self):
testing.tearDown()
def makeOne(self, context, request):
from usingnamespace.views.management import Management
retu... | isc | Python | |
50d84e5b134b69cebcb4935da24a3cc702e1feef | Add coverage for resolve_ref_for_build | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus | tests/zeus/tasks/test_resolve_ref.py | tests/zeus/tasks/test_resolve_ref.py | from zeus import factories
from zeus.tasks import resolve_ref_for_build
def test_resolve_ref_for_build(mocker, db_session, default_revision):
build = factories.BuildFactory.create(
repository=default_revision.repository, ref=default_revision.sha
)
assert build.revision_sha is None
resolve_re... | apache-2.0 | Python | |
fbb8bffd5e1cb633cc59eb5b1e61fef2067e836a | add empty unit test for viewimage module | julien6387/supvisors,julien6387/supervisors,julien6387/supvisors,julien6387/supervisors,julien6387/supervisors,julien6387/supervisors,julien6387/supvisors,julien6387/supvisors | supvisors/tests/test_viewimage.py | supvisors/tests/test_viewimage.py | #!/usr/bin/python
#-*- coding: utf-8 -*-
# ======================================================================
# Copyright 2016 Julien LE CLEACH
#
# 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 Lice... | apache-2.0 | Python | |
0f395ca18526ea4c6675bd772cc9af88a6baf006 | Create __init__.py | Fillll/reddit2telegram,nsiregar/reddit2telegram,Fillll/reddit2telegram,nsiregar/reddit2telegram | channels/r_gonewild30plus/__init__.py | channels/r_gonewild30plus/__init__.py | mit | Python | ||
10fe17255335e16aac9f828764050bd2c0874175 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/79deb43ff6fe999bc7767f19ebdc20814b1dfe80. | karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,yongtang/tensorflow,Intel-tensorflow/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,yongtang/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tenso... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "79deb43ff6fe999bc7767f19ebdc20814b1dfe80"
TFRT_SHA256 = "3b9a217602bd20258595ebe997a2... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "0ca0913cd468b657b76a001b74ffa6e91e4eed03"
TFRT_SHA256 = "a85d109a5ca7daee97115903784b... | apache-2.0 | Python |
430b5daebbd5385551203c2a0cf23bb355a2c027 | Add a script that uses the Flickr API. | danielballan/photomosaic | doc/source/scripts/06-cat-of-cats.py | doc/source/scripts/06-cat-of-cats.py | import os
import photomosaic as pm
import photomosaic.flickr
import matplotlib.pyplot as plt
# For these published examples we use os.environ to keep our API key private.
# Just set your own Flickr API key here.
FLICKR_API_KEY = os.environ['FLICKR_API_KEY']
# Get a pool of cat photos from Flickr.
pm.set_options(flic... | bsd-3-clause | Python | |
3aad37e287a6d0fdb037393d4fcc30817c9dece5 | Create statanalyisi.py | zsalmasi/much-ado-about-nothing-project | statanalyisi.py | statanalyisi.py | import string #This line defines string so as to be able to get rid of punctuation.
import re
name = raw_input("Enter file:")
if len(name) < 1 : name = "manqnohyphen.txt"
print "Much Ado about Nothing statistics"
handle = open(name)
text = handle.read()
print ''
print 'There are', len(text), 'characters in the text.'... | cc0-1.0 | Python | |
b66b02be95e7b0c36a9ced53b07d91298190ca4a | Add tests for mpi4py.dl module | mpi4py/mpi4py,mpi4py/mpi4py,pressel/mpi4py,pressel/mpi4py,mpi4py/mpi4py,pressel/mpi4py,pressel/mpi4py | test/test_dl.py | test/test_dl.py | from mpi4py import dl
import mpiunittest as unittest
import sys
import os
class TestDL(unittest.TestCase):
def testDL1(self):
if sys.platform == 'darwin':
libm = 'libm.dylib'
else:
libm = 'libm.so'
handle = dl.dlopen(libm, dl.RTLD_LOCAL|dl.RTLD_LAZY)
self.a... | bsd-2-clause | Python | |
63c4883c8bbcd9d1d2ef9417a776ea6134e8e48c | Add python file | UrsusPilot/python-plot | gui.py | gui.py | ################################################################################
# File name: gui.py
#
# Function: Display three data from stm32f4 using Python (matplotlib)
# The three data is roll, pith, yall angle of quadcopter attitude.
#
# Reference:http://electronut.in/plotting-real-time-data-from-arduino-usin... | mit | Python | |
cf3cae6493a369173244e05d190cceae41b9abbd | Add some coverage for olog callback. | ericdill/bluesky,ericdill/bluesky | bluesky/tests/test_olog_cb.py | bluesky/tests/test_olog_cb.py | from bluesky import Msg
from bluesky.callbacks.olog import logbook_cb_factory
text = []
def f(**kwargs):
text.append(kwargs['text'])
def test_default_template(fresh_RE):
text.clear()
fresh_RE.subscribe('start', logbook_cb_factory(f))
fresh_RE([Msg('open_run', plan_args={}), Msg('close_run')])
a... | bsd-3-clause | Python | |
57cfba649e3d7a441e7c10a25448ccb8413b964e | Put PageAdmin back | Elarnon/mangaki,RaitoBezarius/mangaki,Mako-kun/mangaki,Mako-kun/mangaki,RaitoBezarius/mangaki,Elarnon/mangaki,Elarnon/mangaki,RaitoBezarius/mangaki,Mako-kun/mangaki | mangaki/mangaki/admin.py | mangaki/mangaki/admin.py | # coding=utf8
from mangaki.models import Anime, Track, OST, Artist, Rating, Page, Suggestion
from django.forms import Textarea
from django.db import models
from django.contrib import admin, messages
class AnimeAdmin(admin.ModelAdmin):
search_fields = ('id', 'title')
list_display = ('id', 'title', 'nsfw')
l... | # coding=utf8
from mangaki.models import Anime, Track, OST, Artist, Rating, Page, Suggestion
from django.forms import Textarea
from django.db import models
from django.contrib import admin, messages
class AnimeAdmin(admin.ModelAdmin):
search_fields = ('id', 'title')
list_display = ('id', 'title', 'nsfw')
l... | agpl-3.0 | Python |
e3d92ce2cd17a967ac19aecad2998c4094f2ae11 | Add script to draw NACA foil | petebachant/CFT-vectors | run.py | run.py | #!/usr/bin/env python
"""
This script generates a force and velocity vector diagram for a cross-flow
turbine.
"""
import gizeh as gz
import numpy as np
import matplotlib.pyplot as plt
def gen_naca_points(naca="0020", c=100, npoints=100):
"""Generate points for a NACA foil."""
x = np.linspace(0, 1, npoints)*c... | mit | Python | |
4b8c5dd8ebc4261bcdb5e9f92e7936eba68fd5ad | Add BNB prediction script | rnowling/pop-gen-models | bernoulli_nb/bnb_predict.py | bernoulli_nb/bnb_predict.py | import sys
from sklearn.naive_bayes import BernoulliNB as BNB
import matplotlib.pyplot as plt
import numpy as np
def read_variants(flname):
fl = open(flname)
markers = []
individuals = []
population_ids = []
population = -1
for ln in fl:
if "Marker" in ln:
if len(individuals) == 0:
continue
marker ... | apache-2.0 | Python | |
2ccbed0e4d867652554dff208d7c1b7bdd1710f9 | add bench/test_curry | berrytj/toolz,cpcloud/toolz,whilo/toolz,obmarg/toolz,berrytj/toolz,simudream/toolz,whilo/toolz,pombredanne/toolz,quantopian/toolz,llllllllll/toolz,jdmcbr/toolz,karansag/toolz,quantopian/toolz,llllllllll/toolz,karansag/toolz,pombredanne/toolz,jdmcbr/toolz,machinelearningdeveloper/toolz,machinelearningdeveloper/toolz,sim... | bench/test_curry.py | bench/test_curry.py | from toolz.curried import get
pairs = [(1, 2) for i in range(100000)]
def test_get_curried():
first = get(0)
for p in pairs:
first(p)
| bsd-3-clause | Python | |
3017396176491dae5bab3effda82a59e64a3591f | Add button_example | lazka/pgi,lazka/pgi | examples/pygobject/button_example.py | examples/pygobject/button_example.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2011 Sebastian Pölsterl
#
# Permission is granted to copy, distribute and/or modify this document
# under the terms of the GNU Free Documentation License, Version 1.3
# or any later version published by the Free Software Foundation;
# with no Invariant Sections, no ... | lgpl-2.1 | Python | |
efc7097c0248394716144f552522daa1d44b74ce | add test python script | dennissergeev/atmosscibot | twython_test.py | twython_test.py | import datetime
import sys
from twython import Twython
from gettokens import tokens
tweet = datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')
api = Twython(tokens['api_key'],
tokens['api_secret'],
tokens['access_token'],
tokens['access_token_secret'])
api.update_sta... | mit | Python | |
bb5457ab736b5f94b9efb9772da16c5ebf97fa06 | Test for interpolation functions | senarvi/theanolm,senarvi/theanolm | tests/theanolm/probfunctions_test.py | tests/theanolm/probfunctions_test.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
import math
from theanolm.probfunctions import *
class TestProbFunctions(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_interpolate_linear(self):
self.assertAlmostEqual(
interp... | apache-2.0 | Python | |
b8e27997000c448d191121ef0f8b08ebca877ed0 | Add GNU Prolog package. | tmerrick1/spack,LLNL/spack,matthiasdiener/spack,lgarren/spack,iulian787/spack,tmerrick1/spack,LLNL/spack,skosukhin/spack,krafczyk/spack,lgarren/spack,matthiasdiener/spack,tmerrick1/spack,tmerrick1/spack,iulian787/spack,iulian787/spack,EmreAtes/spack,iulian787/spack,LLNL/spack,matthiasdiener/spack,mfherbst/spack,mfherbs... | var/spack/repos/builtin/packages/gnu-prolog/package.py | var/spack/repos/builtin/packages/gnu-prolog/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
d57a1049b45614abfe393f80328a07d78c98b5b2 | Add system tray support | gearlles/planb-client,gearlles/planb-client,gearlles/planb-client | main.py | main.py | #!/usr/bin/env python
# -*-coding: utf8 -*-
import wx
import webbrowser
TRAY_TOOLTIP = 'System Tray Demo'
TRAY_ICON = 'icon/network.png'
def create_menu_item(menu, label, func):
item = wx.MenuItem(menu, -1, label)
menu.Bind(wx.EVT_MENU, func, id=item.GetId())
menu.AppendItem(item)
return item
clas... | apache-2.0 | Python | |
a61bb392fd69c953d7d8c23155d1370bc145533d | Create TOA_Filtering.py | NANOGravDataManagement/bridge,NANOGravDataManagement/bridge,shakeh/bridge | filtering-libstempo/TOA_Filtering.py | filtering-libstempo/TOA_Filtering.py | # TOA_Filtering.py
# A script that takes in a .par file, .tim file, start time and end time, and an output directory
# as a result, it creates a new file with TOAs in the time range, stored in output directory
# sample input:
# python TOA_Filtering.py /Users/fkeri/Desktop/B1855+09_NANOGrav_9yv0.par /Users/fkeri/Desktop... | apache-2.0 | Python | |
d6120537ec982f50d08fa188e91c68c023809db3 | Send ERROR when the user disconnects | Heufneutje/txircd,ElementalAlchemist/txircd | txircd/modules/rfc/response_error.py | txircd/modules/rfc/response_error.py | from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
class ErrorResponse(ModuleData):
implements(IPlugin, IModuleData)
name = "errorResponse"
core = True
def actions(self):
return [("quit", 10, self.sendEr... | bsd-3-clause | Python | |
12dda7a7473c094b4483789630e178fd60b0eba4 | add routes.py | fwilson42/dchacks2015,fwilson42/dchacks2015,fwilson42/dchacks2015 | web/transit/routes.py | web/transit/routes.py | import transit
import transit.views.basic
from transit import app
routes = (
('/api/trains/', transit.views.basic.get_all_trains),
('/api/trains/line/<line>/', transit.views.basic.get_trains_on_line),
('/api/trains/station/<station>/', transit.views.basic.get_trains_at_station)
)
for route, func in route... | mit | Python | |
2a590a11f92e03d923d66cfc6e8fe5837feb0f20 | Add a snippet: 'matplotlib/gaussian_convolution'. | 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 | matplotlib/gaussian_convolution/gaussian_convolution_1d.py | matplotlib/gaussian_convolution/gaussian_convolution_1d.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Gaussian convolution 1D"""
# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org)
# 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 withou... | mit | Python | |
fac031300c81c31f5d6022a65d3637fd4e62fa91 | add blink 3 script | mikebranstein/IoT,mikebranstein/IoT | raspberry-pi/led-blink3.py | raspberry-pi/led-blink3.py | import RPi.GPIO as GPIO
import time
def blink(ledPin, onTime, offTime):
GPIO.output(ledPin, GPIO.HIGH)
time.sleep(onTime)
GPIO.output(ledPin, GPIO.LOW)
time.sleep(offTime)
return
def blinkThree(redLedPin, blueLedPin, greenLedPin):
blink(redLedPin, 1, 0)
blink(blueLedPin, 1, 0)
blin... | mit | Python | |
ac44a041e3e7808305b025e1087f48b7d4a9234a | Add script to delete Bit.ly raw results from S3 | berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud | tools/bitly/delete_bitly_blobs.py | tools/bitly/delete_bitly_blobs.py | #!/usr/bin/env python3
import argparse
import boto3
import os
from typing import List
from mediawords.util.log import create_logger
l = create_logger(__name__)
def delete_bitly_blobs(story_ids: List[int]):
session = boto3.Session(profile_name='mediacloud')
s3 = session.resource('s3')
bucket = s3.Bucket... | agpl-3.0 | Python | |
37c0257fcc5e65b67fabfd17c2bf884ad8fe03e1 | Add migration to reset signatures | Osmose/normandy,mozilla/normandy,mozilla/normandy,Osmose/normandy,Osmose/normandy,mozilla/normandy,mozilla/normandy,Osmose/normandy | recipe-server/normandy/recipes/migrations/0038_remove_invalid_signatures.py | recipe-server/normandy/recipes/migrations/0038_remove_invalid_signatures.py | """
Removes signatures, so they can be easily recreated during deployment.
This migration is intended to be used between "eras" of signatures. As
the serialization format of recipes changes, the signatures need to
also change. This could be handled automatically, but it is easier to
deploy if we just remove everything... | mpl-2.0 | Python | |
8ff39701ce4549bf46f03342ee4ff6bdadddc2ff | Create Blob Upload script | CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge,CloudBoltSoftware/cloudbolt-forge | blueprints/gcp_storage/management/upload_blob.py | blueprints/gcp_storage/management/upload_blob.py | from __future__ import unicode_literals
import json
import os
from pathlib import Path
from typing import Optional
from common.methods import set_progress
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import Resource as GCPResource
from googleapiclient.discovery import build
from go... | apache-2.0 | Python | |
f33ca28e7465a0b35d2419dd9016196f63a114d8 | Add demo.py | 7forz/numpy_pandas_tushare_learning | demo.py | demo.py | #!/usr/bin/python3
# -*- encoding: utf-8 -*-
from indexes import *
import global_data
def main(stock='000001', date=global_data.NEWEST_TRADE_DATE, p_MA=5, p_MACD=(12,26,9),
p_RSI=6, p_KDJ=(9,3), p_MTM=(12,6)):
"""
Example
date: str, '2017-08-18'
p_MA: int, 5
p_MACD: tuple... | agpl-3.0 | Python | |
c19c1838802ef8b4429df605e085176aef3bb45f | Create 04_peery_beams.py | robbievanleeuwen/section-properties | examples/01-advanced/04_peery_beams.py | examples/01-advanced/04_peery_beams.py | r"""
.. _ref_ex_peery_beams:
Symmetric and Unsymmetric Beams in Complex Bending
--------------------------------------------------
Calculate section properties of two different beams
given in examples from 'Aircraft Structures,' by Peery.
These cases have known results, and the output from
SectionProperties can be ... | mit | Python | |
c29bf2b9a87fdeb58d78a3ef3219292742371314 | test script for BEL2 stmt checks | OpenBEL/openbel-server,OpenBEL/openbel-server,OpenBEL/openbel-server | bin/test_bel2_validation.py | bin/test_bel2_validation.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usage: program.py <customer>
"""
import requests
import json
base_url = "http://localhost:9292"
files = ['bel2.0-example-statements.bel', 'bel2_document_examples.bel']
def send_request(bel):
# Issue #134
# GET http://localhost:9292/api/expressions/rxn(r... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.