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 |
|---|---|---|---|---|---|---|---|---|
35f19e61df4c14a2766709f6ab88f08e7fab9756 | add run_test | ericdill/databroker,ericdill/databroker | run_tests.py | run_tests.py | #!/usr/bin/env python
import sys
import pytest
if __name__ == '__main__':
# show output results from every test function
args = ['-v']
# show the message output for skipped and expected failure tests
args.append('-vrxs')
if len(sys.argv) > 1:
args.extend(sys.argv[1:])
print('pytest argu... | bsd-3-clause | Python | |
a91b633ba88a01b12305fdfafd570c0b3776b42d | Add a tool script to print errors statistics in output JSON files. | jdhp-sap/sap-cta-data-pipeline,jdhp-sap/data-pipeline-standalone-scripts,jdhp-sap/sap-cta-data-pipeline,jdhp-sap/data-pipeline-standalone-scripts | utils/print_num_errors.py | utils/print_num_errors.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Make statistics on score files (stored in JSON files).
"""
import argparse
import json
import numpy as np
def parse_json_file(json_file_path):
with open(json_file_path, "r") as fd:
json_data = json.load(fd)
return json_data
def extract_data_list(j... | mit | Python | |
4a06723a475fb6312196ea4e0a5ee47414a2c157 | add power_line, power_minor_line | mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource | integration-test/232-power-lines.py | integration-test/232-power-lines.py | from . import FixtureTest
class PowerLines(FixtureTest):
def test_power_line(self):
self.load_fixtures(['http://www.openstreetmap.org/way/29399873'])
self.assert_has_feature(
14, 2621, 6338, 'landuse',
{'id': 29399873, 'kind': 'power_line', 'min_zoom': 14, 'sort_rank': 27... | mit | Python | |
e2d72a20b241fe2dca1dad1eb391350460c06060 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/4efe74c2473de1220989199258b7a4924dd2a679. | tensorflow/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-Corporation/tensorflow,yongtang/tensorflow,karllessard/tensorflow,Intel-tensorflow/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-experimental_link_static_libraries_once,paolodedios/tensorflow,Intel... | 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 = "4efe74c2473de1220989199258b7a4924dd2a679"
TFRT_SHA256 = "76e8b79220d0d68362782b1877b279dacdaa0a9c4b3a80... | """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 = "ab36dc9c9829c8574b7760e98de18cc4d2b2eaf3"
TFRT_SHA256 = "afe45af9014fdf72e5a58cbfcea2c17522c7ce1a082c1a... | apache-2.0 | Python |
0b47397b91fec94910f18ea1711184ecfd0f6bf0 | Add tests for file storage engine | prophile/jacquard,prophile/jacquard | jacquard/storage/tests/test_file.py | jacquard/storage/tests/test_file.py | from jacquard.storage.file import FileStore
def test_get_nonexistent_key():
# Just test this works without errors
store = FileStore(':memory:')
assert store.get('test') is None
def test_simple_write():
storage = FileStore(':memory:')
with storage.transaction() as store:
store['test'] = "... | mit | Python | |
d56387ee3edb05aee87bb732fb60b9d3a5e8a94b | Add a simple setup.py script | rtyler/greendns | setup.py | setup.py | #!/usr/bin/env python
USE_SETUPTOOLS = False
try:
from setuptools import setup, Extension
USE_SETUPTOOLS = True
except ImportError:
from distutils.core import setup, Extension
setup_kwargs = dict(
name='greendns',
description='''A module for providing greened DNS access via dnspython ''',
ver... | bsd-3-clause | Python | |
daf53c1d5564942651e5efac0d1daa9dbd7248f2 | Create setup.py | cganterh/lechat | setup.py | setup.py | """Setup script for lechat."""
from setuptools import setup
setup()
| mit | Python | |
f02d51237443ce239ab44ef7bb38fb625cd0fac1 | Add generic main function setup to test env | HKuz/Test_Code | setup.py | setup.py | #!/Applications/anaconda/envs/Python3/bin
def main():
print("Hello, World!")
if __name__ == '__main__':
main()
| mit | Python | |
7938b647951bb83604c34ebf0932200e13913e35 | Bump version. | skorokithakis/django-loginas,jarcoal/django-loginas,stochastic-technologies/django-loginas,skorokithakis/django-loginas,stochastic-technologies/django-loginas,jarcoal/django-loginas,topletal/django-loginas,intellisense/django-loginas,intellisense/django-loginas,topletal/django-loginas | setup.py | setup.py | #!/usr/bin/env python
import sys
assert sys.version >= '2.5', "Requires Python v2.5 or above."
from distutils.core import setup
from setuptools import find_packages
setup(
name="django-loginas",
version="0.1.3",
author="Stochastic Technologies",
author_email="info@stochastictechnologies.com",
url=... | #!/usr/bin/env python
import sys
assert sys.version >= '2.5', "Requires Python v2.5 or above."
from distutils.core import setup
from setuptools import find_packages
setup(
name="django-loginas",
version="0.1.2",
author="Stochastic Technologies",
author_email="info@stochastictechnologies.com",
url=... | bsd-3-clause | Python |
162c3cd9b12e559242215d395ae85fc75d8ba37d | Create pl_list.py | dancwilliams/Prefix_List_Script,dancwilliams/Prefix_List_Script | pl_list.py | pl_list.py | __author__ = "Dan C Williams"
__version__ = "0.2"
__date__ = "Jul-24-2016"
__email__ = "dan.c.williams@gmail.com"
__status__ = "Development"
__version__ = "Python 3.5"
import netaddr
import collections
raw_lines = [line.rstrip('\n') for line in open('TEST_PL_DATA.txt')]
blackList = ['0.0.0.0/0', 'description', '!']
s... | mit | Python | |
dc1d43acb5730bd9b555b63aa589b0eeceb14e52 | Add a test case to exercise the 'target stop-hook add' command without relying on pexpect to spawn an lldb child command. The test is not "correct" in that the '** Stop Hooks **' message emitted by the Target implementation is invoked asynchronously and is using a separate: | apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb | test/stop-hook/TestStopHookCmd.py | test/stop-hook/TestStopHookCmd.py | """
Test lldb target stop-hook command.
"""
import os
import unittest2
import lldb
import pexpect
from lldbtest import *
class StopHookCmdTestCase(TestBase):
mydir = "stop-hook"
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_with_dsym(self):
"""Test a sequen... | apache-2.0 | Python | |
250e0d2d0e2264b83a82548df3b30dbc784a4fe5 | Add some example client code | twaugh/docker-registry-client,yodle/docker-registry-client | docker-registry-show.py | docker-registry-show.py | """
Copyright 2015 Red Hat, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
d... | apache-2.0 | Python | |
e7cbd3e2d5a21b003c6ee392da5b8ebe70d279a8 | add lockfile dependency | cloudify-cosmo/cloudify-script-plugin,aria-tosca/cloudify-script-plugin | setup.py | setup.py | #########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | #########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | apache-2.0 | Python |
83bcb62c98c406e2aa6ce6a9a98750d0b565f750 | Add tests for generic hash | mindw/libnacl,johnttan/libnacl,cachedout/libnacl,coinkite/libnacl,saltstack/libnacl,RaetProtocol/libnacl | tests/unit/test_raw_generichash.py | tests/unit/test_raw_generichash.py | # Import nacl libs
import libnacl
# Import python libs
import unittest
class TestGenericHash(unittest.TestCase):
'''
Test sign functions
'''
def test_keyless_generichash(self):
msg1 = b'Are you suggesting coconuts migrate?'
msg2 = b'Not at all, they could be carried.'
chash1 =... | apache-2.0 | Python | |
ff814e3dff10ffa54a0569868f32056d37babff6 | Create test1.py | SygtOpenSoftWareTeam/electricwaverecorder | test1.py | test1.py | import this
| mit | Python | |
064124d09973dc58a444d22aa7c47acf94f8fa81 | Add a script to generate JSON bigram frequencies for English | Kitware/clique,Kitware/clique,XDATA-Year-3/clique,XDATA-Year-3/clique,Kitware/clique,XDATA-Year-3/clique | data/bigramfreq.py | data/bigramfreq.py | import json
import lxml.html
from lxml.cssselect import CSSSelector
import requests
import sys
def main():
raw = requests.get("http://norvig.com/mayzner.html")
if not raw:
print >>sys.stderr, "Request failed with code %d" % (raw.status_code)
return 1
tree = lxml.html.fromstring(raw.text)
... | apache-2.0 | Python | |
b9b6b8a9337888fdcfcf15af1dedc758d0662dd0 | add nexted evalute=False test | Arafatk/sympy,abhiii5459/sympy,jaimahajan1997/sympy,bukzor/sympy,AunShiLord/sympy,Sumith1896/sympy,Designist/sympy,yukoba/sympy,kaushik94/sympy,Vishluck/sympy,kumarkrishna/sympy,shipci/sympy,kaushik94/sympy,dqnykamp/sympy,jamesblunt/sympy,beni55/sympy,toolforger/sympy,kaichogami/sympy,moble/sympy,postvakje/sympy,Arafat... | sympy/core/tests/test_evaluate.py | sympy/core/tests/test_evaluate.py | from sympy.abc import x, y
from sympy.core.evaluate import evaluate
from sympy.core import Mul, Add
def test_add():
with evaluate(False):
expr = x + x
assert isinstance(expr, Add)
assert expr.args == (x, x)
assert isinstance(x + x, Mul)
def test_nested():
with evaluate(False):
... | bsd-3-clause | Python | |
6330db1c6d3261d7a22046fa11cc1c661ba57484 | Add basic code for uploading videos to youtube. | punchagan/gg2yt | yt.py | yt.py | """ Parse messages and post links to youtube. """
from __future__ import print_function
import email
import logging
from os.path import join
import re
def configure_logger():
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler('yt.log')
fh.setLevel(logging.DEB... | mit | Python | |
9f551b236a5d4052f2371cc11613e84808f43dee | Add setup.py | sgaynetdinov/py-vkontakte | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(
name='pyvk',
version='2016.08',
packages=['pyvk'],
url='https://github.com/sgaynetdinov/pyvk',
license='MIT License',
author='Sergey Gaynetdinov',
author_email='s.gaynetdinov@gmail.com',
description='Python API wrapper around... | mit | Python | |
fcd027a115fd3c690f042468c303eeedc74774fa | Use setuptools instead of distribute. | Aloomaio/facebook-sdk,mobolic/facebook-sdk | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
setup(
name='facebook-sdk',
version='0.4.0',
description='This client library is designed to support the Facebook '
'Graph API and the official Facebook JavaScript SDK, which '
'is the canonical way to implement Facebook aut... | #!/usr/bin/env python
from distutils.core import setup
setup(
name='facebook-sdk',
version='0.4.0',
description='This client library is designed to support the Facebook '
'Graph API and the official Facebook JavaScript SDK, which '
'is the canonical way to implement Facebook... | apache-2.0 | Python |
923c6b5a4181dfd9ae3f3c26ba411a63e27a79fe | add test for custom argument parser | FunTimeCoding/python-utility,FunTimeCoding/python-utility | tests/test_custom_argument_parser.py | tests/test_custom_argument_parser.py | import pytest
from python_utility.custom_argument_parser import CustomArgumentParser
def test_custom_argument_parser() -> None:
parser = CustomArgumentParser()
with pytest.raises(SystemExit):
parser.error(message='test')
| mit | Python | |
220671d4bc2300983cf200cc6f7834efef458ff1 | add a new factors module | svimanet/IRC-Bob | modules/factors.py | modules/factors.py | # finding all factors for a given number
def find_factors(x): # define a function
print ("The factors of ", x, " are: ")
for i in range(1, x + 1):
if x % i == 0:
print(i)
def print_factors():
# ask the user to input a number
num = input("Enter a number to print its factors: ")
if num >= 0: # check ... | unlicense | Python | |
291117e0c56fb00fd27c93a95b883784cf69c9bc | add dataset parser | Superjom/NeuralNetworks,Superjom/NeuralNetworks | apps/paper/dataset.py | apps/paper/dataset.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on March 7, 2014
@author: Chunwei Yan @ PKU
@mail: yanchunwei@outlook.com
'''
from __future__ import division
class DUC(object):
def __init__(self, path):
self.path = path
def get_text(self):
'''
get lines of the TEXT
... | apache-2.0 | Python | |
070d3f780ffab6e866fb3d1d7fc21bd77fb31ae6 | Add momento pattern | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | momento-pattern.py | momento-pattern.py | #!/usr/bin/python
import copy
class Originator(object):
class Memento(object):
def __init__(self, mstate):
self.mstate = mstate
def rollback_state(self):
return self.mstate
def set_state(self, state):
print ('Originator: setup state to: {0}'.format(state))
... | mit | Python | |
8e3e1883b9aa25091b6a9a1b4684128bd56659f7 | Add new test | phuonghuynh/compressor,phuonghuynh/compressor,phuonghuynh/compressor,phuonghuynh/compressor,phuonghuynh/compressor | setup.py | setup.py | """
Finix Python client library.
See ``README.md`` for usage advice.
"""
import os
import re
try:
import setuptools
except ImportError:
import distutils.core
setup = distutils.core.setup
else:
setup = setuptools.setup
PACKAGE = next((str(s) for s in setuptools.find_packages('.', exclude=("tests", "t... | apache-2.0 | Python | |
0fe1d3eb78ef3d2c5dbbd5a662829309ab808a6f | Add setup.py | diogo149/treeano,jagill/treeano,diogo149/treeano,jagill/treeano,nsauder/treeano,diogo149/treeano,nsauder/treeano,nsauder/treeano,jagill/treeano | setup.py | setup.py | from setuptools import setup
treeano_version = '0.0.1'
setup(
name="treeano",
version=treeano_version,
packages=["treeano", "canopy"]
)
| apache-2.0 | Python | |
529d9328570febd037077cfe865feedb841a1162 | Create setup.py | WeiXuanChan/autoD | setup.py | setup.py | from distutils.core import setup
setup(
name = 'autoD', # How you named your package folder (MyLib)
packages = ['autoD'], # Chose the same as "name"
version = '3.7.0', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https:/... | mit | Python | |
20b31aa5faa155639df8c206de2864af80924254 | add setup.py script | thomlake/pytorch-attention | setup.py | setup.py | from distutils.core import setup
setup(
name='attention',
version='0.1.0',
author='tllake',
author_email='thom.l.lake@gmail.com',
packages=['attention'],
description='An attention function for PyTorch.',
long_description=open('README.md').read()) | bsd-2-clause | Python | |
5df5a19cba3bd543bcadd92d57fdd07d84b38339 | update project page link in setup script | dementrock/pycparser,fjalex/pycparser,strazzere/py010parser,bowlofstew/pycparser,fjalex/pycparser,jorik041/pycparser,Nairolf21/pycparser,dementrock/pycparser,bowlofstew/pycparser,dubslow/pycparser,jorik041/pycparser,sideeffects/pycparser,keulraesik/pycparser,CtheSky/pycparser,fjalex/pycparser,sideeffects/pycparser,dubs... | setup.py | setup.py | import os, sys
from distutils.core import setup
setup(
# metadata
name='pycparser',
description='C parser in Python',
long_description="""
pycparser is a complete parser of the C language, written in
pure Python using the PLY parsing library.
It parses C code into a... | import os, sys
from distutils.core import setup
setup(
# metadata
name='pycparser',
description='C parser in Python',
long_description="""
pycparser is a complete parser of the C language, written in
pure Python using the PLY parsing library.
It parses C code into a... | bsd-3-clause | Python |
229c54fa4122f9c08aae9b31dc6720e78daaf90d | add setup | cdimascio/py-readability-metrics | setup.py | setup.py | #!/user/bin/env python
from setuptools import setup
setup(
name='py-readability',
version='0.0.1',
description='Calculate readability scores. e.g. Gunning Fog',
author='Carmine DiMAscio',
url='https://github.com/cdimascio/py-readability',
packages=['py-readabilitiy-metrics'],
install_requi... | mit | Python | |
e3cd2d3880dbc00e254ac503d5f5c84ab77edc4f | Add Invoke tasks for cleaning and building docs. | audreyr/binaryornot,hackebrot/binaryornot,0k/binaryornot,pombredanne/binaryornot,pombredanne/binaryornot,hackebrot/binaryornot,0k/binaryornot,pombredanne/binaryornot,audreyr/binaryornot,audreyr/binaryornot,hackebrot/binaryornot | tasks.py | tasks.py | from invoke import task, run
@task
def clean():
run("rm -rf docs/_build")
@task('clean')
def build():
run("sphinx-build docs docs/_build")
| bsd-3-clause | Python | |
75131bdf806c56970f3160de3e6d476d9ecbc3a7 | Add problem delete note in a linked list | guozengxin/myleetcode,guozengxin/myleetcode | python/deleteNodeInALinkedList.py | python/deleteNodeInALinkedList.py | # https://leetcode.com/problems/delete-node-in-a-linked-list/
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def deleteNode(self, node):
"""
:type node: ListNode
:rtype: v... | mit | Python | |
1c59296f6819c5d8e6222c237afa9146ddf6a56b | add new status poller | hep-gc/cloudscheduler,hep-gc/cloudscheduler,hep-gc/cloudscheduler,hep-gc/cloudscheduler | data_collectors/general/csstatus.py | data_collectors/general/csstatus.py | import multiprocessing
from multiprocessing import Process
import logging
import time
import sys
import os
from cloudscheduler.lib.csv2_config import Config
from cloudscheduler.lib.poller_functions import \
start_cycle, \
wait_cycle
import htcondor
import classad
from sqlalchemy import create_engine
from sqla... | apache-2.0 | Python | |
1a8c361d90243c44a877ebdc4ae92fbfb3226b40 | add test file for words | mcdickenson/python-washu-2014 | day1/words_test.py | day1/words_test.py | import unittest
import words
class TestWordsCode(unittest.TestCase):
def test_has_no_e(self):
self.assertEqual(words.has_no_e("bet"), False)
self.assertEqual(words.has_no_e("bit"), True)
def test_uses_only(self):
self.assertEqual(words.uses_only("ababab", "a"), False)
self.assertEqual(words.uses_... | mit | Python | |
6b92d9fe24fe682c357e3f5a5e6c19f1569bd29e | Add riak backend | disqus/nydus | nydus/db/backends/riak.py | nydus/db/backends/riak.py | """
nydus.db.backends.riak
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2011 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from __future__ import absolute_import
import socket
import httplib
from riak import RiakClient, RiakError
from nydus.db.backends import BaseConnection
class Riak(BaseCon... | apache-2.0 | Python | |
6b630687336de18bb0c9179b7002d310772b6871 | Add corpwiki/iptool | kevinxw/namebench,Forgen/namebench,evelynmitchell/namebench,ulaskaraoren/namebench,thatchristoph/namebench,cloudcache/namebench,feardax/namebench,Trinitaria/namebench,movermeyer/namebench,doadin/namebench,leeoo/namebench,felipsmartins/namebench,sbalun/namebench,asolfre/namebench,beermix/namebench,jjoaonunes/namebench,M... | tools/check_nameserver_popularity.py | tools/check_nameserver_popularity.py | #!/usr/bin/env python
import os
import sys
import pickle
import time
import traceback
import yahoo.search
from yahoo.search.web import WebSearch
APP_ID = 'P5ihFKzV34G69QolFfb3nN7p0rSsYfC9tPGq.IUS.NLWEeJ14SG9Lei0rwFtgwL8cDBrA6Egdw--'
QUERY_MODIFIERS = '-site:txdns.net -site:sitedossier.com -mx -site:dataopedia.com -sit... | #!/usr/bin/env python
import os
import sys
import pickle
import time
import traceback
import yahoo.search
from yahoo.search.web import WebSearch
APP_ID = 'P5ihFKzV34G69QolFfb3nN7p0rSsYfC9tPGq.IUS.NLWEeJ14SG9Lei0rwFtgwL8cDBrA6Egdw--'
QUERY_MODIFIERS = '-site:txdns.net -site:sitedossier.com -mx -site:dataopedia.com -sit... | apache-2.0 | Python |
dc15986b0ff890250d21a36350b689809d535f44 | Create KMP.py | saru95/DSA,saru95/DSA,saru95/DSA,saru95/DSA,saru95/DSA | KMP.py | KMP.py | # Github username : yatingupta10
# Website : http://www.yatingupta.me/
# Find occurrences of pattern as a contiguous subsequence of the text.
# For the KMP versions the pattern must be a list or string, because we
# perform array indexing into it, but the text can be anything that can
# be used in a for-loop. The nai... | mit | Python | |
51642c95ce9d7c7d95648952340d90f4ef2254f3 | Add test for record_panel | khchine5/opal,khchine5/opal,khchine5/opal | opal/tests/test_panels.py | opal/tests/test_panels.py | """
Tests create_singletons command
"""
from opal.core.test import OpalTestCase
from opal.templatetags import panels
from opal.tests.models import Demographics
class RecordPanelTestCase(OpalTestCase):
def test_record_panel(self):
expected = dict(
name='demographics',
singleton=Tru... | agpl-3.0 | Python | |
d9959b9a8e38fc5c6b23618fdbd8a67423302e4e | include forgotten exceptions.py file | Duke-GCB/DukeDSClient,Duke-GCB/DukeDSClient | ddsc/exceptions.py | ddsc/exceptions.py | class DDSUserException(Exception):
"""
Exception with an error message to be displayed to the user on the command line.
"""
pass
| mit | Python | |
45215b36e544f8d7a9ac21a825807d6e49d2ade9 | Add binarySearch function | iandmyhand/python-utils | DataStructuresAndAlgorithmsInPython/BinarySearch.py | DataStructuresAndAlgorithmsInPython/BinarySearch.py | ##-*- coding: utf-8 -*-
#!/usr/bin/python
""" Returns either the index of the location in the array,
or -1 if the array did not contain the targetValue
"""
import math
def binarySearch (array, targetValue):
minimum = 0;
maximum = len(array) - 1;
guess = -1;
guessesCount = 0;
while (maxim... | mit | Python | |
b423ea140a8f041bca84390ef698d13789a128df | Convert Numbers to words | yoda-yoda/numbers-to-words | number_to_words.py | number_to_words.py | """Convert Numbers to Words.
1001 - One thousand and One
"""
import math
class NumbersToWord(object):
"""Convert Numbers to words."""
hyphen = '-'
conjunction = ' and '
separator = ', '
negative = 'negative '
decimal = ' point '
space = ' '
dictionary = {
0: 'zero',
... | mit | Python | |
0e43fce67c2c53fe2a7dbf233df86c042501e477 | Move explain_sam_flags.py to public repository | alecw/picard,nh13/picard,broadinstitute/picard,alecw/picard,broadinstitute/picard,nh13/picard,annkupi/picard,broadinstitute/picard,alecw/picard,nh13/picard,alecw/picard,annkupi/picard,nh13/picard,annkupi/picard,broadinstitute/picard,annkupi/picard,broadinstitute/picard | src/scripts/explain_sam_flags.py | src/scripts/explain_sam_flags.py | #!/usr/bin/env python
# The Broad Institute
# SOFTWARE COPYRIGHT NOTICE AGREEMENT
# This software and its documentation are copyright 2008 by the
# Broad Institute/Massachusetts Institute of Technology. All rights are
# reserved.
# This software is supplied without any warranty or guaranteed support
# whatsoever. Neit... | mit | Python | |
5352740a1cc508a6b902f447a80960fa237414aa | Add ProgressPathView | controversial/ui2 | ui2/view_classes/ProgressPathView.py | ui2/view_classes/ProgressPathView.py | from objc_util import *
import ui
def _get_CGColor(color):
"""Get a CGColor from a wide range of formats."""
return UIColor.colorWithRed_green_blue_alpha_(
*ui.parse_color(color)
).CGColor()
class ProgressPathView(ui.View):
"""A view class which can turn a ui.Path into a progress bar.
... | mit | Python | |
8738accb2a612a3c1e41cc00aa337d0be890f4a0 | add problem 052 | smrmkt/project_euler | problem_052.py | problem_052.py | #!/usr/bin/env python
#-*-coding:utf-8-*-
'''
'''
import timeit
def loop(n):
for i in range(10, 10000000):
if str(i)[0] != '1':
continue
f = [1 for j in range(2, n+1) if sorted(list(str(i))) != sorted(str(i*j))]
if len(f) == 0:
return i
if __name__ == '__main__... | mit | Python | |
88f0e5ba8a404f0fcdaaaacc69109775182b7213 | Add squashed migrations | francbartoli/dj-experiment,francbartoli/dj-experiment | dj_experiment/migrations/0002_auto_20170802_1206_squashed_0004_auto_20170802_1230.py | dj_experiment/migrations/0002_auto_20170802_1206_squashed_0004_auto_20170802_1230.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-02 17:31
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
replaces = [('dj_experiment', '0002_auto_20170802_1206'), ('dj_experiment', '0003_auto... | mit | Python | |
26eba1f16c44ed6693b2a575a6a2c5ebef9401b5 | Create Movie object city_lights | vishallama/udacity-fullstack-movie-trailer,vishallama/udacity-fullstack-movie-trailer | entertainment_center.py | entertainment_center.py | # entertainment_center.py
import media
__author__ = 'vishal lama'
city_lights = media.Movie(
"City Lights",
"A tramp falls in love with a beautiful blind girl. Her family is in "
"financial trouble. The tramp's on-and-off friendship with a wealthy "
"man allows him to be the girl's benefactor and suit... | mit | Python | |
714537e1cff4009a5e8ba93da94954b84536127a | Add Teli API | tuxxy/SMIRCH | api.py | api.py | import requests
class Teli:
TOKEN = ""
API = ""
def __init__(self, TOKEN):
self.TOKEN = TOKEN
self.API = "https://sms.teleapi.net/{}/send"
def send_sms(self, src, dest, message):
args = {
'token': self.TOKEN,
'source': src,
'destination': de... | agpl-3.0 | Python | |
8bdf94c29418a3826e5c6fd3a76f96051326bfe6 | Add management command extract votes #126 | MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets,MTG/freesound-datasets | datasets/management/commands/extract_votes.py | datasets/management/commands/extract_votes.py | from django.core.management.base import BaseCommand
import json
from datasets.models import CandidateAnnotation, Vote, TaxonomyNode, Dataset
class Command(BaseCommand):
help = 'Extract user votes' \
'Usage: python manage.py extract_votes <dataset_shor_name> <output_file>'
def add_arguments(self, p... | agpl-3.0 | Python | |
1fe2fea7f7f35c61bb63c641042b9bf12f896fca | add module oslo_policy.common.sql | darren-wang/op | oslo_policy/common/sql.py | oslo_policy/common/sql.py | # Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | apache-2.0 | Python | |
1ede9bd211cd8ea6aac4db6f8818804cb778a022 | Add a view that serves a single static file | chrisseto/dinosaurs.sexy,chrisseto/dinosaurs.sexy | dinosaurs/views.py | dinosaurs/views.py | import os
import tornado.web
import tornado.ioloop
class SingleStatic(tornado.web.StaticFileHandler):
def initialize(self, path):
self.dirname, self.filename = os.path.split(path)
super(SingleStatic, self).initialize(self.dirname)
def get(self, path=None, include_body=True):
super(Si... | mit | Python | |
3f7a03baad15da817e81a8524b87f32c9ca79c1b | Add image service tests | CptSpaceToaster/memegen,joshfriend/memegen,DanLindeman/memegen,DanLindeman/memegen,DanLindeman/memegen,joshfriend/memegen,DanLindeman/memegen,CptSpaceToaster/memegen,joshfriend/memegen,CptSpaceToaster/memegen,joshfriend/memegen | memegen/test/test_services_image.py | memegen/test/test_services_image.py | from unittest.mock import Mock
import pytest
class TestImageService:
def test_find_template(self, image_service):
mock_template = Mock()
image_service.template_store.read.return_value = mock_template
template = image_service.find_template('my_key')
assert image_service.template... | mit | Python | |
33a439d5b52036bb272c8866017b973bef18237d | Create tests.py | bskinn/opan,bskinn/opan | tests.py | tests.py | #...
| mit | Python | |
234897a36cdf5a5cf5b7550f6d176f4168d7a6c7 | add basic test suite | kua-hosi-GRUp/Flask-Bones,Urumasi/Flask-Bones,cburmeister/flask-bones,cburmeister/flask-bones,kua-hosi-GRUp/Flask-Bones,kua-hosi-GRUp/Flask-Bones,Urumasi/Flask-Bones,Urumasi/Flask-Bones,cburmeister/flask-bones | tests.py | tests.py | import os
import app
import unittest
class TestCase(unittest.TestCase):
def setUp(self):
self.
self.app = app.app.test_client()
def tearDown(self):
pass
def test_index(self):
resp = self.app.get('/')
assert 'Hello World!' in resp.data
if __name__ == '__main__':
... | mit | Python | |
7e283316050dd4e33f1f0a7182c13eef18c82039 | Create AmbyByeBye.py | MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/AdolphSmith/AmbyByeBye.py | home/AdolphSmith/AmbyByeBye.py | arduino = Runtime.createAndStart("arduino","Arduino")
arduino.connect("COM9")
mouth = Runtime.create("mouth","Speech")
s8 = Runtime.createAndStart("s8","Servo")
s9 = Runtime.createAndStart("s9","Servo")
s10 = Runtime.createAndStart("s10","Servo")
s11 = Runtime.createAndStart("s11","Servo")
s13 = Runtime.createAndSt... | apache-2.0 | Python | |
4d3ed1ff13cde88abe695c724d7c8946578cde21 | Add py-docopt package (#8236) | LLNL/spack,mfherbst/spack,matthiasdiener/spack,iulian787/spack,krafczyk/spack,tmerrick1/spack,tmerrick1/spack,LLNL/spack,mfherbst/spack,iulian787/spack,iulian787/spack,tmerrick1/spack,iulian787/spack,matthiasdiener/spack,LLNL/spack,matthiasdiener/spack,mfherbst/spack,iulian787/spack,mfherbst/spack,krafczyk/spack,LLNL/s... | var/spack/repos/builtin/packages/py-docopt/package.py | var/spack/repos/builtin/packages/py-docopt/package.py | ##############################################################################
# Copyright (c) 2013-2018, 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 | |
889b6254526b5b49cd27d2f7bf7603a60f4f64fe | Add py-geeadd package (#12366) | iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-geeadd/package.py | var/spack/repos/builtin/packages/py-geeadd/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 PyGeeadd(PythonPackage):
"""Google Earth Engine Batch Assets Manager with Addons."""
... | lgpl-2.1 | Python | |
06e7dd815a77739089b2ad0aed5cb9f01a194967 | Add script to normalize image using Ops | bic-kn/imagej-scripts | Normalize_Image.py | Normalize_Image.py | # @Dataset data
# @OpService ops
# @OUTPUT Img normalized
# Create normalized image to the [0, 1] range.
#
# Stefan Helfrich (University of Konstanz), 03/10/2016
from net.imglib2.type.numeric.real import FloatType
from net.imglib2.type.numeric.integer import ByteType
from net.imagej.ops import Ops
normalized = ops.c... | bsd-2-clause | Python | |
b4fdb95ef8a88cfd2d283698ac005ce8d9ec3468 | Create fetch-wms-urls.py | VirtualWatershed/vw-py,VirtualWatershed/vw-py,tri-state-epscor/wcwave_adaptors,tri-state-epscor/wcwave_adaptors | scripts/fetch-wms-urls.py | scripts/fetch-wms-urls.py | #!/usr/bin/python
import requests
import json
url = "http://129.24.196.43/apps/my_app/search/datasets.json?version=3&model_run_uuid=20f303cd-624d-413d-b485-6113319003d4&model_set=outputs&model_set_type=vis"
r = requests.get(url)
data = json.loads(r.text)
for i in data["results"]:
full = i["services"][0]["wms"]
... | bsd-2-clause | Python | |
6d4efa0bd1199bbe900a8913b829ca7201dde6ab | Add migration to add new Juniper SASS vars to sites | appsembler/edx-platform,appsembler/edx-platform,appsembler/edx-platform,appsembler/edx-platform | openedx/core/djangoapps/appsembler/sites/migrations/0003_add_juniper_new_sass_vars.py | openedx/core/djangoapps/appsembler/sites/migrations/0003_add_juniper_new_sass_vars.py | # -*- coding: utf-8 -*-
import json
from django.db import migrations, models
def add_juniper_new_sass_vars(apps, schema_editor):
"""
This migration adds all the new SASS variabled added during the initial
pass of the Tahoe Juniper release upgrade.
"""
new_sass_var_keys = {
"$base-contain... | agpl-3.0 | Python | |
46351669c279764e1b070943366d7c0ea84a243a | Build pipeline directly in build/action_maketokenizer.py. Review URL: http://codereview.chromium.org/67086 | robclark/chromium,hgl888/chromium-crosswalk,dednal/chromium.src,bright-sparks/chromium-spacewalk,TheTypoMaster/chromium-crosswalk,axinging/chromium-crosswalk,markYoungH/chromium.src,Fireblend/chromium-crosswalk,Jonekee/chromium.src,hujiajie/pa-chromium,mohamed--abdel-maksoud/chromium.src,mohamed--abdel-maksoud/chromium... | webkit/build/action_maketokenizer.py | webkit/build/action_maketokenizer.py | #!/usr/bin/python
# Copyright (c) 2009 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.
# usage: action_maketokenizer.py OUTPUTS -- INPUTS
#
# Multiple INPUTS may be listed. The sections are separated by -- arguments.
#
#... | #!/usr/bin/python
# Copyright (c) 2009 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.
# usage: action_maketokenizer.py OUTPUTS -- INPUTS
#
# Multiple INPUTS may be listed. The sections are separated by -- arguments.
#
#... | bsd-3-clause | Python |
163c214f8d714e3f1dc08324f9d48a34f813d9fe | Add agency creation script. | sunlightlabs/regulations-scraper,sunlightlabs/regulations-scraper,sunlightlabs/regulations-scraper | regscrape/regscrape_lib/commands/create_agencies.py | regscrape/regscrape_lib/commands/create_agencies.py | def run():
from regscrape_lib.util import get_db
from regscrape_lib.search import get_agencies
from pymongo.errors import DuplicateKeyError
db = get_db()
new = 0
print 'Fetching agencies...'
agencies = get_agencies()
print 'Saving agencies...'
stop_words = ['the', 'and', ... | bsd-3-clause | Python | |
392125f2b3fae38b4f4d32877ad2abaa60ea6ffd | Add pony/orm/examples/demo.py | ponyorm/pony,gwecho/pony,gwecho/pony,gwecho/pony,ponyorm/pony,ponyorm/pony,ponyorm/pony | pony/orm/examples/demo.py | pony/orm/examples/demo.py | from decimal import Decimal
from pony.orm import *
db = Database("sqlite", "demo.sqlite", create_db=True)
class Customer(db.Entity):
id = PrimaryKey(int, auto=True)
name = Required(unicode)
email = Required(unicode, unique=True)
orders = Set("Order")
class Order(db.Entity):
id = PrimaryKey(int, a... | apache-2.0 | Python | |
d5ed0cf979fa393d45e2f719d3096618e0f723aa | Add utils.py file for util functions | sonph/gdaxcli,sonph/gdaxcli | utils.py | utils.py | """Utilities."""
import logging
def configure_logging(to_stderr=True, to_file=True, file_name='main.log'):
"""Configure logging destinations."""
root_logger = logging.getLogger()
root_logger.setLevel(logging.INFO)
format_str = '%(asctime)s - %(levelname)s - %(message)s'
formatter = logging.Formatter(format... | mit | Python | |
f2b97f029e61bd70b9f4ef5d79c875132907e45e | add missing file. | alex/gunicorn,GitHublong/gunicorn,wong2/gunicorn,prezi/gunicorn,ccl0326/gunicorn,malept/gunicorn,zhoucen/gunicorn,ammaraskar/gunicorn,beni55/gunicorn,jamesblunt/gunicorn,gtrdotmcs/gunicorn,ccl0326/gunicorn,alex/gunicorn,WSDC-NITWarangal/gunicorn,urbaniak/gunicorn,zhoucen/gunicorn,urbaniak/gunicorn,urbaniak/gunicorn,gtr... | gunicorn/monkey.py | gunicorn/monkey.py | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
def patch_django():
""" monkey patch django.
This patch make sure that we use real threads to get the ident which
is going to happen if we are using gevent or eventlet.
"""
... | mit | Python | |
b0f8c27325c9b4cbc5cd5bc83ece6f3d7569f7da | Add gzip stream | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | gzipinputstream.py | gzipinputstream.py | import zlib
import string
BLOCK_SIZE = 16384
"""Read block size"""
WINDOW_BUFFER_SIZE = 16 + zlib.MAX_WBITS
"""zlib window buffer size, set to gzip's format"""
class GzipInputStream(object):
"""
Simple class that allow streaming reads from GZip files.
Python 2.x gzip.GZipFile relies on .seek() and .tell... | mit | Python | |
95e5b80117b090ae0458df18e062bad50b0c0b5a | add module init file | Berling/project-zombye-exporter | io_exporter_zombye/__init__.py | io_exporter_zombye/__init__.py | # The MIT License (MIT)
#
# Copyright (c) 2015 Georg Schäfer
#
# 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, mod... | mit | Python | |
19df1ece66f815d0aaaae5e7273117b2da9541ac | Create mpu9250_i2c_modi.py | mikechan0731/RaspBerryPi_MPU9250_data_read,mikechan0731/GY-91_and_PiCamera_RaspberryPi | mpu9250_i2c_modi.py | mpu9250_i2c_modi.py | import smbus
import time,timeit
#import RPi.GPIO as GPIO
# Global varible
i2c = smbus.SMBus(1)
addr = 0x68
c_t0 = time.clock()
t_t0 = time.time()
try:
device_id = i2c.read_byte_data(addr,0x75)
print "Device ID:" + str(hex(device_id))
print "MPU9250 I2C Connected."
except:
print "Connect failed"
i2c.write_byte_... | mit | Python | |
7acd91331d97a9a4c2190c7d6c8844bd4b7ccfe3 | add cache to diagnostics/__init__.py | jakirkham/dask,mikegraham/dask,pombredanne/dask,cowlicks/dask,vikhyat/dask,gameduell/dask,clarkfitzg/dask,wiso/dask,dask/dask,clarkfitzg/dask,mraspaud/dask,chrisbarber/dask,ssanderson/dask,mrocklin/dask,pombredanne/dask,jcrist/dask,cpcloud/dask,vikhyat/dask,jcrist/dask,dask/dask,mraspaud/dask,ContinuumIO/dask,ssanderso... | dask/diagnostics/__init__.py | dask/diagnostics/__init__.py | from .profile import Profiler
from .progress import ProgressBar
from .cache import Cache
| from .profile import Profiler
from .progress import ProgressBar
| bsd-3-clause | Python |
e383dc5c52db12aee5327743e26301b4d0f48af9 | Add files via upload | wiseman/dramabot | nearest_chat_bot.py | nearest_chat_bot.py |
import gensim
import pandas
import numpy as np
from sklearn.neighbors import NearestNeighbors
import pickle
def get_soap_data(location=None):
if type(location)==type(None):
location="D:\dialogue_agent\dr_word2vec_code\input_data\soaps_all.txt" #Change direcotry
f=open(location,mode="r")
... | mit | Python | |
63318185d5477fbf99e570e5ccaba303ebe26493 | add testcases | yosida95/python-jsmapper | jsmapper/tests/test_mapping.py | jsmapper/tests/test_mapping.py | # -*- coding: utf-8 -*-
from nose.tools import (
eq_,
ok_,
)
from ..mapping import (
Mapping,
MappingProperty,
object_property,
)
from ..schema import JSONSchema
from ..types import (
Integer,
String,
)
def test_object_property():
schema = JSONSchema()
@object_property(name='pro... | mit | Python | |
190df1378844c6294c6f48ad6cb0272f2146fc48 | Add example of force https | timothycrosley/hug,MuhammadAlkarouri/hug,timothycrosley/hug,timothycrosley/hug,MuhammadAlkarouri/hug,MuhammadAlkarouri/hug | examples/force_https.py | examples/force_https.py | """An example of using a middleware to require HTTPS connections.
requires https://github.com/falconry/falcon-require-https to be installed via
pip install falcon-require-https
"""
import hug
from falcon_require_https import RequireHTTPS
hug.API(__name__).http.add_middleware(RequireHTTPS())
@hug.get()
def my... | mit | Python | |
c7e8f255d5ad85dc03f5f302f49295d491ac11a1 | Create app.py | mailmevj/apiai-flightassistant-webhook-sample | app.py | app.py | #!/usr/bin/env python
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
import json
import os
from flask import Flask
from flask impor... | apache-2.0 | Python | |
2b74fccbed0a63a503d59ac46fe90d0916abe39c | Add sublime script | chrisdone/bdo,chrisdone/bdo | bdo.py | bdo.py | import sublime, sublime_plugin, subprocess, threading, time
class Bdo(sublime_plugin.TextCommand):
def run(self, cmd):
sublime.active_window().show_input_panel("bdo ", "update", self.execute, None, None)
def execute(self, cmd):
output = subprocess.Popen(
"echo " + cmd + " | nc -w 10... | bsd-3-clause | Python | |
876365a7f19a3786db15dc7debbd2686fa5d02ef | Add WmataError class and start of Wmata class. | ExperimentMonty/py3-wmata | wmata.py | wmata.py | import datetime
import urllib
import json
class WmataError(Exception):
pass
class Wmata(object):
base_url = 'http://api.wmata.com/%(svc)s.svc/json/%(endpoint)s'
# By default, we'll use the WMATA demonstration key
api_key = 'kfgpmgvfgacx98de9q3xazww'
def __init__(self, api_key=None):
if ... | mit | Python | |
51f02779f306c516bbd6d9cd1550e25c972932cf | Create base.py | jleeothon/urlmodel | base.py | base.py | from django.db import models
from django.core.urlresolvers import reverse
class UrlModelMixin(object):
"""
Provides methods for the URLs of basic actions such as searching,
creating, inspecting (detail), updating, deleting.
If a model instance is identified by pk, ``slug_field_name`` should be le... | mit | Python | |
a4ab01d64c505b786e6fef217829fb56c3d6b6ce | Add management script to generate hansard appearance scores. | geoffkilpin/pombola,patricmutwiri/pombola,patricmutwiri/pombola,ken-muturi/pombola,Hutspace/odekro,mysociety/pombola,geoffkilpin/pombola,hzj123/56th,mysociety/pombola,hzj123/56th,patricmutwiri/pombola,hzj123/56th,hzj123/56th,Hutspace/odekro,geoffkilpin/pombola,mysociety/pombola,geoffkilpin/pombola,Hutspace/odekro,hzj12... | mzalendo/scorecards/management/commands/scorecard_update_person_hansard_appearances.py | mzalendo/scorecards/management/commands/scorecard_update_person_hansard_appearances.py | import datetime
from django.core.management.base import NoArgsCommand
from django.core.exceptions import ImproperlyConfigured
class Command(NoArgsCommand):
help = 'Create/update hansard scorecard entry for all mps'
args = ''
def handle_noargs(self, **options):
# Imports are here to avoid an impor... | agpl-3.0 | Python | |
4a404709081515fa0cc91683b5a9ad8f6a68eae6 | Add a migration to drop mandatory assessment methods from brief data | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | migrations/versions/630_remove_mandatory_assessment_methods_.py | migrations/versions/630_remove_mandatory_assessment_methods_.py | """Remove mandatory assessment methods from briefs
Revision ID: 630
Revises: 620
Create Date: 2016-06-03 15:26:53.890401
"""
# revision identifiers, used by Alembic.
revision = '630'
down_revision = '620'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
from sqlalchemy.dialect... | mit | Python | |
d44fc89f27be0e618d02202b5d067466079be16d | add tool to download and extract latest firmware | zsquareplusc/wipy-environment | download-mcuimg.py | download-mcuimg.py | #! /usr/bin/env python3
import urllib.request
from pprint import pprint
import zipfile
import json
print('Downloading release info..')
release_info = json.loads(urllib.request.urlopen('https://api.github.com/repos/wipy/wipy/releases/latest').read().decode('utf-8'))
with open('mcuimg.txt', 'w') as f:
pprint(releas... | bsd-3-clause | Python | |
373bdc41b35f75a15430eb2f9a03a8ab38d401e8 | Test for upcast with parent unbound method. | pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython | tests/basics/subclass_native6.py | tests/basics/subclass_native6.py | # Calling native base class unbound method with subclass instance.
class mylist(list):
pass
l = mylist((1, 2, 3))
assert type(l) is mylist
print(l)
list.append(l, 4)
print(l)
| mit | Python | |
cd69cf46d0d40e3f70c9757c981d8a9b75aab9de | Create run_zaspe.py | rabrahm/zaspe,rabrahm/zaspe | run_zaspe.py | run_zaspe.py | import new2
import numpy as np
import pyfits
import time
f = open('zaspe.pars','r')
lines = f.readlines()
for line in lines:
cos = line.split()
if len(cos)==2:
if cos[0] == 'mod':
mod = cos[1]
elif cos[0] == 'spec':
spec = cos[1]
elif cos[0] == 'RV0':
RV0 = float(cos[1])
elif cos[0] == 'vsini':
g... | mit | Python | |
9ffa7abeccbce24b037a644612681fd397e9d13a | add dict example | devlights/try-python | trypython/basic/dict_preserved_insert_order_py37.py | trypython/basic/dict_preserved_insert_order_py37.py | """
Python 3.7 で 辞書の挿入順序が保持されることを確認するサンプルです。
REFERENCES:: http://bit.ly/2VIggXP
http://bit.ly/2VySRIe
http://bit.ly/2VFhjI4
http://bit.ly/2VEq058
http://bit.ly/2VBKrzK
"""
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
... | mit | Python | |
f1b91a52b52dfab3b350191ede23731f0a30f4c4 | Add pythonrc | EnTeQuAk/dotfiles,EnTeQuAk/dotfiles,EnTeQuAk/dotfiles,EnTeQuAk/dotfiles,EnTeQuAk/dotfiles | python/pythonrc.py | python/pythonrc.py | #!/usr/bin/env python
# Inspired by https://github.com/dag/dotfiles/blob/master/python/.pythonrc
import os
import readline
readline.parse_and_bind('tab: complete')
history = os.path.expanduser("~/.pythonhist")
if os.path.exists(history):
try:
readline.read_history_file(history)
except IOError, e:
... | unlicense | Python | |
12ad56d1360d6140093f2871c32593751b8ae052 | Add modeset_event.py | tomba/kmsxx,tomba/kmsxx,tomba/kmsxx,tomba/kmsxx | py/tests/modeset_event.py | py/tests/modeset_event.py | #!/usr/bin/python3
import pykms
import selectors
import sys
def readdrm(fileobj, mask):
for ev in card.read_events():
ev.data(ev)
def waitevent(sel):
events = sel.select(1)
if not events:
print("Error: timeout receiving event")
else:
for key, mask in events:
key.da... | mpl-2.0 | Python | |
2ab8680c1a5e420de3f6b82db9a994eaeace164f | 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/unicode/unicode.py | python/unicode/unicode.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Jérémie DECOCK (http://www.jdhp.org)
# DEFINE
str1 = "Hello!"
unicode_obj1 = u"¡Buenos días!"
unicode_obj2 = u"你好!"
# PRINT
print
print str1
print unicode_obj1
print unicode_obj2
# CONCAT
print
print str1 + " " + unicode_obj1 + " " + unicode_obj2,... | mit | Python | |
f6acf955904765f57ba15837fd6440a524590268 | add migrations | Ilhasoft/ureport,xkmato/ureport,Ilhasoft/ureport,rapidpro/ureport,rapidpro/ureport,eHealthAfrica/ureport,rapidpro/ureport,auduaboki/ureport,Ilhasoft/ureport,Ilhasoft/ureport,eHealthAfrica/ureport,rapidpro/ureport,xkmato/ureport,xkmato/ureport,eHealthAfrica/ureport,auduaboki/ureport,auduaboki/ureport | ureport/polls/migrations/0024_auto_20160118_0934.py | ureport/polls/migrations/0024_auto_20160118_0934.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('polls', '0023_populate_flow_date'),
]
operations = [
migrations.AlterField(
model_name='poll',
name=... | agpl-3.0 | Python | |
5390abc3f53f18515cd9a658d6286ac8a9b09d81 | Create parrot_trouble.py | dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey | Python/CodingBat/parrot_trouble.py | Python/CodingBat/parrot_trouble.py | # http://codingbat.com/prob/p166884
def parrot_trouble(talking, hour):
if talking and (hour < 7 or hour > 20):
return True
else:
return False
| mit | Python | |
7c4df6bfa4d8d2370c96ffd9efe0017447629a5d | add dep-free baseclass for typing | graphistry/pygraphistry,graphistry/pygraphistry | graphistry/Plottable.py | graphistry/Plottable.py | from typing import Iterable, List, Optional, Union
from typing_extensions import Protocol
import pandas as pd
class Plottable(Protocol):
@property
def _point_title(self) -> Optional[str]:
return None
@property
def _point_label(self) -> Optional[str]:
return None
@property
def ... | bsd-3-clause | Python | |
14a9296056c4dede324465791052119890f40725 | add a TransactionTestCase to cover the flush command | novafloss/django-north,novafloss/django-north | tests/functionals/test_transactiontestcase.py | tests/functionals/test_transactiontestcase.py | from django.test import TransactionTestCase
from tests.north_app.models import Author
from tests.north_app.models import Book
class BookTestCase(TransactionTestCase):
def setUp(self):
self.author = Author.objects.create(name="George R. R. Martin")
self.book1 = Book.objects.create(
aut... | mit | Python | |
9b345bba13b572ebdd52c6dca534a7cf95e11335 | Add examples | cujomalainey/matrixtoolkit | examples/colors.py | examples/colors.py | from PIL import Image, ImageDraw
from time import sleep
OFF_TARGET = True
if OFF_TARGET:
from matrixtoolkit import Adafruit_RGBmatrix
else:
from rgbmatrix import Adafruit_RGBmatrix
class drawer():
"""
handles controls what is being drawn
"""
def __init__(self):
# this config switch ... | mit | Python | |
6fdf7cc68e05ce6e8e18306eca7d8e36d1a166ea | Add Client class to abstract from different datbase clients | wearhacks/hackathon_hotline | hotline/db/db_client.py | hotline/db/db_client.py | import importlib
import os
class DBClient:
db_defaults = {'mongo': 'mongodb://localhost:27017/',
'redis': 'redis://localhost:6379',
'postgresql': 'postgresql://localhost:5432'
}
def __init__(self, url=None, db_type=None, db_name=None):
self.db_ty... | mit | Python | |
aac6b16b3c532d74d788cbad942af6a147a06f4b | add broadcast org | alphagov/notifications-api,alphagov/notifications-api | migrations/versions/0331_add_broadcast_org.py | migrations/versions/0331_add_broadcast_org.py | """
Revision ID: 0331_add_broadcast_org
Revises: 0330_broadcast_invite_email
Create Date: 2020-09-23 10:11:01.094412
"""
from alembic import op
import sqlalchemy as sa
import os
revision = '0331_add_broadcast_org'
down_revision = '0330_broadcast_invite_email'
environment = os.environ['NOTIFY_ENVIRONMENT']
organisa... | mit | Python | |
353edcdcfae15f06b998a4ad1481b3ad99e514bd | Remove easeventuid migration. | closeio/nylas,closeio/nylas,Eagles2F/sync-engine,PriviPK/privipk-sync-engine,ErinCall/sync-engine,closeio/nylas,nylas/sync-engine,PriviPK/privipk-sync-engine,Eagles2F/sync-engine,Eagles2F/sync-engine,jobscore/sync-engine,ErinCall/sync-engine,ErinCall/sync-engine,ErinCall/sync-engine,gale320/sync-engine,wakermahmud/sync... | migrations/versions/127_remove_easeventuid.py | migrations/versions/127_remove_easeventuid.py | """remove easeventuid
Revision ID: 581e91bd7141
Revises: 262436681c4
Create Date: 2015-01-10 00:57:50.944460
"""
# revision identifiers, used by Alembic.
revision = '581e91bd7141'
down_revision = '262436681c4'
from alembic import op
def upgrade():
from inbox.ignition import main_engine
engine = main_engin... | agpl-3.0 | Python | |
5f7344b8a99880bec7195b951b495970116f0b0d | Initialize P2_blankRowInserter | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P2_blankRowInserter.py | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P2_blankRowInserter.py | # Create a program blankRowInserter.py that takes two integers and a filename
# string as command line arguments. Let’s call the first integer N and the second
# integer M. Starting at row N, the program should insert M blank rows into the
# spreadsheet.
| mit | Python | |
37f5ddd7e8802b5d5213b5cadb905c39abe92dfc | Add test.. | Clinical-Genomics/scout,Clinical-Genomics/scout,Clinical-Genomics/scout | tests/adapter/mongo/test_case_group_handling.py | tests/adapter/mongo/test_case_group_handling.py | import pytest
import copy
import pymongo
import logging
logger = logging.getLogger(__name__)
def test_init_case_group(adapter, institute_obj):
# given a database and an institute
owner = institute_obj["_id"]
# when attempting to create a case group
result = adapter.init_case_group(owner)
# the ... | bsd-3-clause | Python | |
28ad4d2770921c7d148b00ed0533b9051fb08122 | enable utils.get to get any url with or without selector/username/password | kissiel/btc,bittorrent/btc | utils.py | utils.py | #! /usr/bin/env python
import httplib, mimetypes, base64
def encode_multipart_formdata(fields, files):
"""
fields is a sequence of (name, value) elements for regular form fields.
files is a sequence of (name, filename, value) elements for data to be uploaded as files
Return (content_type, body) ready ... | #! /usr/bin/env python
import httplib, mimetypes, base64
def encode_multipart_formdata(fields, files):
"""
fields is a sequence of (name, value) elements for regular form fields.
files is a sequence of (name, filename, value) elements for data to be uploaded as files
Return (content_type, body) ready ... | mit | Python |
ecbc691307c43ad06d7f539f008fccbff690d538 | Add unit tests for the precomputed_io module | HumanBrainProject/neuroglancer-scripts | unit_tests/test_precomputed_io.py | unit_tests/test_precomputed_io.py | # Copyright (c) 2018 CEA
# Author: Yann Leprince <yann.leprince@cea.fr>
#
# This software is made available under the MIT licence, see LICENCE.txt.
import numpy as np
import pytest
from neuroglancer_scripts.accessor import get_accessor_for_url
from neuroglancer_scripts.chunk_encoding import InvalidInfoError
from neur... | mit | Python | |
de4f3d3b31b5336cb541c0e6d17f198799c4dc53 | Remove unnecessary argument | ProsperWorks/graphite-pager,seatgeek/graphite-pager,ProsperWorks/graphite-pager,seatgeek/graphite-pager | graphitepager/config.py | graphitepager/config.py | import os
import yaml
from alerts import Alert
def contents_of_file(filename):
open_file = open(filename)
contents = open_file.read()
open_file.close()
return contents
def get_config(path):
return Config(path)
class Config(object):
def __init__(self, path):
alert_yml = contents_o... | import os
import yaml
from alerts import Alert
def contents_of_file(filename):
open_file = open(filename)
contents = open_file.read()
open_file.close()
return contents
def get_config(path):
return Config(path)
class Config(object):
def __init__(self, path):
alert_yml = contents_o... | bsd-2-clause | Python |
3ce64bd781b59fffe42a59155a6f81f641647653 | add package information | neuropower/neurodesign | source/src/info.py | source/src/info.py | # -*- coding: utf-8 -*-
"""
Base module variables
"""
__version__ = '0.2.00'
__author__ = 'Joke Durnez'
__license__ = 'MIT'
__email__ = 'joke.durnez@gmail.com'
__status__ = 'Prototype'
__url__ = 'https://www.neuropowertools.org'
__packagename__ = 'neurodesign'
| mit | Python | |
117ddac033b0b337ced9589851e74056740cdb3e | patch to create workflow for existing leave applications | gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext | erpnext/patches/v10_0/workflow_leave_application.py | erpnext/patches/v10_0/workflow_leave_application.py | # Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("hr", "doctype", "leave_application")
frappe.reload_doc("workflow", "doctype", "workflow")
doc = frappe.get_doc({
'doctyp... | agpl-3.0 | Python | |
3aaa64c7ca9721e74fd52d3274a91fdd4c4cb678 | add initial test cron | mozilla/service-map | cron.py | cron.py | import boto3
import credstash
import gspread
import json
from oauth2client.service_account import ServiceAccountCredentials
from oauth2client import file, client, tools
from models.v1.assets.asset import Asset
from models.v1.asset_groups.asset_group import AssetGroup
from models.v1.services.service import Service
def ... | mpl-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.