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 |
|---|---|---|---|---|---|---|---|---|
659af8d29ec1839217c74522d8fa5bcf61e48451 | FIX category | linkitspa/l10n-italy,alessandrocamilli/l10n-italy,maxhome1/l10n-italy,linkitspa/l10n-italy,andrea4ever/l10n-italy,odoo-isa/l10n-italy,abstract-open-solutions/l10n-italy,yvaucher/l10n-italy,scigghia/l10n-italy,OpenCode/l10n-italy,luca-vercelli/l10n-italy,hurrinico/l10n-italy,ApuliaSoftware/l10n-italy,linkitspa/l10n-ital... | l10n_it_CEE_balance/__openerp__.py | l10n_it_CEE_balance/__openerp__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 Italian OpenERP Community (<http://www.openerp-italia.com>)
#
# This program is free software: you can redistrib... | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 Italian OpenERP Community (<http://www.openerp-italia.com>)
#
# This program is free software: you can redistrib... | agpl-3.0 | Python |
e920d0dc413dacd2b1084c2cdcacb4bae3bc3d8b | Create problem10.py | Amapolita/MITx--6.00.1x- | W2/L4/problem10.py | W2/L4/problem10.py | #L4 PROBLEM 10
def isVowel(char):
if char == 'a' or char == 'e' or char == 'i' or char == 'o' or char == 'u' or char == 'A' or char == 'E' or char == 'I' or char == 'O' or char == 'U':
return True
else:
return False
| unlicense | Python | |
799599e1b841db8c9eff9de4cdf7dbc5cb396c37 | Create dml.py | sheabrown/faraday_complexity | dml.py | dml.py | dml
| mit | Python | |
349e63385ea71d1a69e094aeee1268c44e951b53 | Update code funny | Murillo/Hackerrank-Algorithms | Strings/funny-string.py | Strings/funny-string.py | # Funny String
# Developer: Murillo Grubler
# Link: https://www.hackerrank.com/challenges/funny-string/problem
import string
# ca - xz
# xc - cx
# zx - ac
#acxz - 3
#acxza
def funnyString(s):
str_inverted = s[::-1]
for i in range(len(s) - 1):
print(s[i])
return ""
q = int(input().strip())
for ... | mit | Python | |
4091fbf0051d022730b11da6d6786a25c38a6dd3 | Add a simple audio recorder. Note that this would normally not work on a raspberry pi as it has no audio in. You'll have to add an usb microphone for this to work. | bramvonk/blind-dialer | src/util/audiorecorder.py | src/util/audiorecorder.py | # simple audio recorder... source: http://stackoverflow.com/questions/892199/detect-record-audio-in-python
# you need pyaudio, install with python -m pip install pyaudio
from sys import byteorder
from array import array
from struct import pack
import pyaudio
import wave
THRESHOLD = 500
CHUNK_SIZE = 1024
FORMAT = py... | mit | Python | |
45b0e958aa377afed2c62bf1e6f7c4933ccde39b | Add a test for main | robbie-c/git-lang-guesser | test/test_main.py | test/test_main.py | from git_lang_guesser import main
from git_lang_guesser import git_requester
LANGUAGE = "language"
test_username = "TestUser"
example_data = [
{LANGUAGE: "HTML"},
{LANGUAGE: "Java"},
{LANGUAGE: "Python"},
{LANGUAGE: "Python"},
{LANGUAGE: "C"},
]
expected_count = {
"HTML": 1,
"Java": 1,
... | mit | Python | |
2dc94daed7c0475e84f829d48d97afc63f2e803d | add type_vec4 test | mackst/glm | test/type_vec4.py | test/type_vec4.py | # -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014 mack stone
#
# 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... | mit | Python | |
c80a015151fb6648aa34e7b79cd29f4cd2c97560 | add a example | mongodb/mongo-disco,johntut/MongoDisco,sajal/MongoDisco,10genNYUITP/MongoDisco | test_disco_job.py | test_disco_job.py | from DiscoJob import DiscoJob
import logging
config = {
"split_size": 1, #MB
"input_uri": "mongodb://localhost/test.modforty",
"create_input_splits": True,
"split_key": {'_id' : 1},
"output_uri":"mongodb://localhost/test.out",
#"job_output_key":"I am the key",
... | apache-2.0 | Python | |
ee78590d2a6f0a509b08bf1b59b3f27560375524 | add conftest | CamDavidsonPilon/lifetimes,statwonk/lifetimes,aprotopopov/lifetimes,luke14free/lifetimes | tests/conftest.py | tests/conftest.py | from __future__ import print_function
import numpy as np
def pytest_runtest_setup(item):
seed = np.random.randint(1000)
print("Seed used in np.random.seed(): %d" % seed)
np.random.seed(seed)
| mit | Python | |
e8853997b7ba28da48e1620fd1466fbe8ca1d0c0 | Add setup.py | plajjan/pyarrfs | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
from pyarrfs import pyarrfs
ver = pyarrfs.__version__
long_desc = open("README").read()
short_desc = long_desc.split('\n')[0].split(' - ')[1].strip()
setup(
name = 'pyarrfs',
version = pyarrfs.__version__,
description = short_desc,
long_descript... | mit | Python | |
b0ada080d8c8890152a57168e6b7b449a5588f10 | Add setup.py for PyPI | kyleconroy/clocktower | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='clocktower',
version='0.1.0',
author='Kyle Conroy',
author_email='kyle@twilio.com',
url='https://github.com/derferman/clocktower',
description='Download websites from Wayback Machine',
install_requires=['lxml'],
... | mit | Python | |
9c6ba2717fb71755d31d8c7b7066730171be8b20 | bump version, add missing dependency - Django | bradleyg/django-ajaximage,subhaoi/kioskuser,subhaoi/kioskuser,bradleyg/django-ajaximage,bradleyg/django-ajaximage,subhaoi/kioskuser | setup.py | setup.py | import os
from setuptools import setup
f = open(os.path.join(os.path.dirname(__file__), 'README.md'))
readme = f.read()
f.close()
setup(
name='django-ajaximage',
version='0.1.16-rohanza',
description='Add ajax image upload functionality with a progress bar to file input fields within Django admin. Images ... | import os
from setuptools import setup
f = open(os.path.join(os.path.dirname(__file__), 'README.md'))
readme = f.read()
f.close()
setup(
name='django-ajaximage',
version='0.1.16',
description='Add ajax image upload functionality with a progress bar to file input fields within Django admin. Images are opti... | mit | Python |
fac7c76ea056179653574dffd297f927f76daa42 | add setuptools routine | bertmcmeyer/opti_ssr,fietew/opti_ssr | setup.py | setup.py | import os
from setuptools import setup
setup(
name = "opti_ssr",
version = "0.0.4",
py_modules=['opti_ssr', 'ssr_network', 'opti_network'],
author = "Felix Immohr, Fiete Winter",
author_email = "test@te.st, fiete.winter@gmail.com",
description = ("Using the OptiTrack system for different applic... | mit | Python | |
230cae4f6cce8e064b5b74f87ec09181e41f57c2 | Add MDR setup file | EpistasisLab/scikit-mdr,EpistasisLab/scikit-mdr | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
def calculate_version():
initpy = open('mdr/_version.py').read().split('\n')
version = list(filter(lambda x: '__version__' in x, initpy))[0].split('\'')[1]
return version
package_version = calculate_version()
setup(... | mit | Python | |
612517b15a40af29fa57d3a5507ba778ff32fa51 | Add setup.py | HearSys/pattern_finder_gpu,HearSys/pattern_finder_gpu | setup.py | setup.py | from setuptools import setup
setup(name='pattern_finder_gpu',
version='1.0',
description='Brute force OpenCL based pattern localization in images that supports masking and weighting.',
url='https://github.com/HearSys/pattern_finder_gpu',
author='Samuel John (HörSys GmbH)',
author_email='j... | mit | Python | |
380fb1e3b5b8fbde868f7fffbe0a6f22fc037e55 | Remove download_url from setup.py | bsipocz/astropy-helpers,bsipocz/astropy-helpers,larrybradley/astropy-helpers,Cadair/astropy-helpers,bsipocz/astropy-helpers,larrybradley/astropy-helpers,astropy/astropy-helpers,larrybradley/astropy-helpers,dpshelio/astropy-helpers,dpshelio/astropy-helpers,astropy/astropy-helpers,Cadair/astropy-helpers | setup.py | setup.py | #!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import ah_bootstrap
import pkg_resources
from setuptools import setup
from astropy_helpers.setup_helpers import register_commands, get_package_info
from astropy_helpers.version_helpers import generate_version_py
NAME = 'astropy_help... | #!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import ah_bootstrap
import pkg_resources
from setuptools import setup
from astropy_helpers.setup_helpers import register_commands, get_package_info
from astropy_helpers.version_helpers import generate_version_py
NAME = 'astropy_help... | bsd-3-clause | Python |
a9f0d310e967bea276f01cd558f48fc102ea24fc | add setup file for installation as module | JamesJeffryes/MINE-Database | setup.py | setup.py | from setuptools import setup
setup(name='minedatabase',
version='0.1',
description='Metabolic In silico Network Expansions',
url='http://github.com/JamesJeffryes/mine-database',
author='James Jeffryes',
author_email='jamesgjeffryes@gmail.com',
license='MIT',
packages=['minedat... | mit | Python | |
77700d265fbf3fafa21b335585b8060a0b025143 | add setup.py | indygreg/lua-protobuf,mickem/lua-protobuf | setup.py | setup.py | # Copyright 2010 Gregory Szorc
#
# 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 w... | apache-2.0 | Python | |
092bf8bc2e558420ca51384a3dd1019ab1115ad2 | Fix conditional dependencies when using wheels | grigno/djangocms-link,brente/djangocms-link,addgene/djangocms-link,garmoncheg/djangocms-link,yakky/djangocms-link,yakky/djangocms-link,brente/djangocms-link,addgene/djangocms-link,grigno/djangocms-link,garmoncheg/djangocms-link | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
from djangocms_link import __version__
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: B... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
from djangocms_link import __version__
INSTALL_REQUIRES = [
#'Django-Select2',
]
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience ::... | bsd-3-clause | Python |
a9e2e225e083575c66c33986db06b496c1596449 | Create setup.py | Bachmann1234/weight-watchers-sync | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='wwsync',
version='1.0',
author='Matt Bachmann',
url='https://github.com/Bachmann1234/weight-watchers-sync',
description='Syncs Weight Watcher food log to Fitbit',
license='MIT',
packages=find_packages(),
install_requires=['requests==2.9.1... | mit | Python | |
265e1b6177552e13f332b1f39885433789f27d94 | add setup.py | brysontyrrell/Jook | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
import re
with open('jook/__init__.py', 'r') as fobj:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fobj.read(), re.MULTILINE).group(1)
with open('README.rst', 'r') as fobj:
long_description = fobj.read()
setup(
... | mit | Python | |
90faa98cf8d0a11e8cfd1ff1b91b505a43f956c5 | Add setup.py | Jwuthri/Mozinor | setup.py | setup.py | """Module to prepare you python environment."""
import importlib
def run_package(package):
"""Try to run the package just installed."""
try:
globals()[package] = importlib.import_module(package)
print("================================")
except Exception:
print("We can't install {}"... | mit | Python | |
1bf649207f850b21e99eb6a9479ecdb1cb03a93d | Update version to 0.7.1 | Dreamsolution/django-auth-policy,mcella/django-auth-policy,Dreamsolution/django-auth-policy,mcella/django-auth-policy | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
install_requires = ['Django>=1.5']
try:
from collections import OrderedDict
except ImportError:
install_requires.append('ordereddict>=1.1')
setup(
name='django-auth-policy',
version='0.7.1',
description='Enforces a couple of common authenticati... | #!/usr/bin/env python
from setuptools import setup
install_requires = ['Django>=1.5']
try:
from collections import OrderedDict
except ImportError:
install_requires.append('ordereddict>=1.1')
setup(
name='django-auth-policy',
version='0.7',
description='Enforces a couple of common authentication... | bsd-3-clause | Python |
b37b2976398f52032379c916714e4b6360614e78 | create packaging file | mkolodny/3taps | setup.py | setup.py | #!/usr/bin/env python
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
with open('README.rst') as f:
readme = f.read()
with open('LICENSE') as f:
lice... | mit | Python | |
18688b67e2dfc36ff6b1c28a618a289f46cc494d | Add Slide class | cferwin/Command-Line-Repetition | slide.py | slide.py | class Slide:
""" Stores data to be studied. """
def __init__(self, prompt, answer):
self.prompt = prompt
self.answer = answer
| mit | Python | |
b418ff779c79afd0eca85ed1479ba633f25ce73c | Fix variable referenced before assginment in vmwareapi code. | n0ano/ganttclient | nova/tests/test_vmwareapi_vm_util.py | nova/tests/test_vmwareapi_vm_util.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 Canonical Corp.
# 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.or... | apache-2.0 | Python | |
c3f1e723e13598deb53a8454787204f00841c34a | Add extension method type | seibert/numba,seibert/numba,stefanseefeld/numba,pitrou/numba,numba/numba,numba/numba,gmarkall/numba,pombredanne/numba,stonebig/numba,gdementen/numba,cpcloud/numba,gdementen/numba,seibert/numba,sklam/numba,gdementen/numba,stonebig/numba,stuartarchibald/numba,ssarangi/numba,pitrou/numba,shiquanwang/numba,stonebig/numba,p... | numba/typesystem/exttypes/methods.py | numba/typesystem/exttypes/methods.py |
from numba.typesystem import *
#------------------------------------------------------------------------
# Extension Method Types
#------------------------------------------------------------------------
class ExtMethodType(NumbaType, minitypes.FunctionType):
"""
Extension method type, a FunctionType plus t... | bsd-2-clause | Python | |
b41206dd44948a4a99f0f3fabb3ffc04f0d781a1 | Create spatial_pooler_compute_test.py | subutai/nupic.research,subutai/nupic.research,numenta/nupic.research,numenta/nupic.research | packages/spatial_pooler/tests/spatial_pooler_compute_test.py | packages/spatial_pooler/tests/spatial_pooler_compute_test.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2022, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | agpl-3.0 | Python | |
7162926576b6136c17a4f1d889d7ecd2541a763c | Add examples_plot_features.py | mgeplf/NeuroM,liesbethvanherpe/NeuroM,lidakanari/NeuroM,juanchopanza/NeuroM,wizmer/NeuroM,BlueBrain/NeuroM,eleftherioszisis/NeuroM | examples/plot_features.py | examples/plot_features.py | #!/usr/bin/env python
# Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project
# All rights reserved.
#
# This file is part of NeuroM <https://github.com/BlueBrain/NeuroM>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fo... | bsd-3-clause | Python | |
ebceea82af38e4c7f11678841bfbce3635a66f7d | Add twitter_parser.py | chengdujin/newsman,chengdujin/newsman,chengdujin/newsman | newsman/scraper/twitter_parser.py | newsman/scraper/twitter_parser.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
Twitter parser parses specific twitter account in real time
"""
# @author chengdujin
# @contact chengdujin@gmail.com
# @created Nov. 19, 2013
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
import twitter
import urllib2
access_token_key = "24129666-M47Q6p... | agpl-3.0 | Python | |
3912e9ab49e10f2490da36b17e8525d2c97c1844 | add fabric | Answeror/aip,Answeror/aip | fabfile.py | fabfile.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from fabric.api import run, env, cd
# the user to use for the remote commands
env.user = 'answeror'
# the servers where the commands are executed
env.hosts = ['aip.io']
def deploy():
run('pyenv virtualenvwrapper')
run('workon aip')
with cd('/www/aip/repo'... | mit | Python | |
643b4867627feb2810257f99b0b7865b43bb6454 | Add fabfile to deploy documentation | GauravButola/angular-tryton,fulfilio/angular-tryton,tarunbhardwaj/angular-tryton,fulfilio/angular-tryton,fulfilio/angular-tryton,GauravButola/angular-tryton,tarunbhardwaj/angular-tryton,openlabs/angular-tryton,tarunbhardwaj/angular-tryton,GauravButola/angular-tryton,openlabs/angular-tryton,openlabs/angular-tryton | fabfile.py | fabfile.py | # -*- coding: utf-8 -*-
"""
fabfile
Fab file to build and push documentation to github
:copyright: © 2013-2014 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
import time
import getpass
import os
from fabric.api import (
local, lcd, cd, sudo, exe... | bsd-3-clause | Python | |
b63f6a83f86808df0a2fea66b47478e3c5ec0994 | Create neymanPearson2.py | probml/pyprobml,probml/pyprobml,probml/pyprobml,probml/pyprobml | scripts/neymanPearson2.py | scripts/neymanPearson2.py | # Convert Neyman-Pearson testing paradigm(Fig 5.15 (a)) to python/JAX
# Author: Garvit9000c
import jax.scipy.stats.multivariate_normal as gaussprob
import jax.numpy as jnp
import matplotlib.pyplot as plt
#constants
pi=jnp.pi
sigma=1.5
xmin = -4
xmax = 8
ymin = 0
ymax = 0.3
res = 0.01
#Domain
x=jnp.arange(xmin,xmax,r... | mit | Python | |
e7a41ed29f6ec097e19f4c9beec9821a2804585c | Add organizations.py | irqed/octokit.py | octokit/resources/organizations.py | octokit/resources/organizations.py | # encoding: utf-8
"""Methods for the Organizations API
http://developer.github.com/v3/orgs/
"""
| mit | Python | |
337c48648f3a891642fc58c7161fdb48e705160f | add timer | Larhard/tsp | timer.py | timer.py | # Copyright (c) 2015, Bartlomiej Puget <larhard@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this... | bsd-3-clause | Python | |
cbde3323e790717fa593d75ca282e2875bb67dca | Add stacker ecs hook | remind101/stacker,mhahn/stacker,mhahn/stacker,remind101/stacker,EnTeQuAk/stacker,federicobaldo/stacker | stacker/hooks/ecs.py | stacker/hooks/ecs.py | # A lot of this code exists to deal w/ the broken ECS connect_to_region
# function, and will be removed once this pull request is accepted:
# https://github.com/boto/boto/pull/3143
import logging
logger = logging.getLogger(__name__)
from boto.regioninfo import get_regions
from boto.ec2containerservice.layer1 import... | bsd-2-clause | Python | |
421b99ffb0cf84a8ccea0c4c0fe2496f895603a0 | Add migration | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/initiatives/migrations/0011_auto_20190522_0931.py | bluebottle/initiatives/migrations/0011_auto_20190522_0931.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-05-22 07:31
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('initiatives', '0010_auto_20190521_0954'),
]
operations = [
migrations.RemoveField(... | bsd-3-clause | Python | |
51e516f260858e699ee828ac6fc91af39c67254c | Add script for automatically updating schemas | spacetelescope/asdf-standard | update-schemas.py | update-schemas.py | #!/usr/bin/env python
import os
import re
import sys
import subprocess as sp
def get_schemas(pattern):
cmd = ['git', 'grep', '--name-only']
output = sp.check_output(cmd + [pattern, '--', 'schemas']).decode('utf8')
names = output.split()
print(names)
dedupe = dict()
for name in names:
... | bsd-3-clause | Python | |
7e8ffcef7111fc3cd2f1d58831afb09741d9d8fc | Create my-calendar-i.py | kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode | Python/my-calendar-i.py | Python/my-calendar-i.py | # Time: O(n^2)
# Space: O(n)
# Implement a MyCalendar class to store your events.
# A new event can be added if adding the event will not cause a double booking.
#
# Your class will have the method, book(int start, int end).
# Formally, this represents a booking on the half open interval [start, end),
# the range of ... | mit | Python | |
e1993d4d3c3199dce2be2b475a9236e95732a0f0 | Verify computer executing the script is of OS X 10.6.1 or higher type | yoda-yoda/osx-dock-dodger,denisKaranja/osx-dock-dodger | dodge.py | dodge.py | import platform
class OSXDodger(object):
allowed_version = "10.12.1"
def __init__(self, applications_dir):
self.app_dir = applications_dir
def load_applications(self):
"""
Read all applications in the `/Applications/` dir
"""
pass
def select_applications(self... | mit | Python | |
e965147ef7bc89e6c8885d1521d92305604de6f8 | add problem | caoxudong/code_practice,caoxudong/code_practice,caoxudong/code_practice,caoxudong/code_practice | others/find_array_index_of_sum.py | others/find_array_index_of_sum.py | """
题目:给定一个整数数组和一个整数,返回两个数组的索引,这两个索引指向的数字的加和等于指定的整数。需要最优的算法,分析算法的空间和时间复杂度
"""
if __name__ == "__main__":
numbers = [1,2,3,4,5,6,7,8,9]
n = 10
index_map = {}
supplment_map = {}
index = 0
for i in numbers:
index_map[i] = index
supplment_map[i] = n - i
index = index + 1
... | mit | Python | |
ef8b909beb4de8435c20ed0b45bca9478d476ed8 | Add python script to get coordinates from the csv | awensaunders/BuSHAX0rZ,awensaunders/BuSHAX0rZ,awensaunders/BuSHAX0rZ | geocode.py | geocode.py | #! /bin/python3
import csv
import time
from geopy.geocoders.googlev3 import GoogleV3
geocoder = GoogleV3(api_key="AIzaSyAy6XiyZG-6u99q-qacOz-dtT9ILbYzb-4")
with open("../ReadingBusesOrig.csv") as cf:
with open("../out.csv", "a") as cw:
reader = csv.DictReader(cf)
writer = csv.DictWriter(cw, ["lati... | mit | Python | |
bb928a0c0a4ddc11b05771e9eaa33f1058cc022a | Add pageset for ugamsolutions.com | vanish87/skia,nvoron23/skia,YUPlayGodDev/platform_external_skia,aosp-mirror/platform_external_skia,tmpvar/skia.cc,VRToxin-AOSP/android_external_skia,rubenvb/skia,BrokenROM/external_skia,MarshedOut/android_external_skia,boulzordev/android_external_skia,VRToxin-AOSP/android_external_skia,samuelig/skia,Igalia/skia,BrokenR... | tools/skp/page_sets/skia_ugamsolutions_desktop.py | tools/skp/page_sets/skia_ugamsolutions_desktop.py | # Copyright 2014 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.
# pylint: disable=W0401,W0614
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class SkiaBuildbotDesk... | bsd-3-clause | Python | |
68e5bdc3c3a8a59f820ea15e706e85e14f2a654b | Add mgmt cmd to fix bad loc-type references | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/locations/management/commands/fix_loc_type_reference.py | corehq/apps/locations/management/commands/fix_loc_type_reference.py | from optparse import make_option
from django.core.management.base import BaseCommand
from corehq.apps.locations.models import SQLLocation, LocationType
class Command(BaseCommand):
help = "Make "
option_list = (
make_option('--dry_run',
action='store_true',
dest='dry_run',
... | bsd-3-clause | Python | |
0ca7ec8da8fffbfe057038e832bb12a33384c07b | add date format to date column in ctable mapping | dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,gmimano/commcaretest,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,gmimano/commcaretest,puttaraj... | custom/apps/gsid/ctable_mappings.py | custom/apps/gsid/ctable_mappings.py | from ctable.fixtures import CtableMappingFixture
from ctable.models import ColumnDef, KeyMatcher
class PatientSummaryMapping(CtableMappingFixture):
name = 'patient_summary'
domains = ['gsid']
couch_view = 'gsid/patient_summary'
schedule_active = True
@property
def columns(self):
colum... | from ctable.fixtures import CtableMappingFixture
from ctable.models import ColumnDef, KeyMatcher
class PatientSummaryMapping(CtableMappingFixture):
name = 'patient_summary'
domains = ['gsid']
couch_view = 'gsid/patient_summary'
schedule_active = True
@property
def columns(self):
colum... | bsd-3-clause | Python |
5d6dabcad4f2467f07765f1e28752b5cbba61d53 | add xfailing test for #693 | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | test/util/test_options.py | test/util/test_options.py | from __future__ import absolute_import, division, print_function
import os
import pytest
from dials.util.options import OptionParser
from dials.util.options import flatten_datablocks
pytestmark = pytest.mark.skipif(
not os.access('/dls/i04/data/2019/cm23004-1/20190109/Eiger', os.R_OK),
reason='Test images not av... | bsd-3-clause | Python | |
32471e9abff0d11b001ad0024a8f917e9ddadd60 | Test for commandline.py | karlch/vimiv,karlch/vimiv,karlch/vimiv | tests/commandline_test.py | tests/commandline_test.py | #!/usr/bin/env python
# encoding: utf-8
import os
import time
from unittest import TestCase, main
from gi import require_version
require_version('Gtk', '3.0')
from gi.repository import Gtk
import vimiv.main as v_main
from vimiv.parser import parse_config
def refresh_gui(delay=0):
time.sleep(delay)
while Gtk.e... | mit | Python | |
00bba22c2fb62b378efb40d86ff633881c55991d | Add tests | divmain/GitSavvy,divmain/GitSavvy,divmain/GitSavvy | tests/test_commit_view.py | tests/test_commit_view.py | import os
from textwrap import dedent
import sublime
from unittesting import DeferrableTestCase
from GitSavvy.tests.mockito import unstub, when
from GitSavvy.tests.parameterized import parameterized as p
from GitSavvy.core.commands.commit import extract_commit_message, GsCommitCommand
examples = [
(
de... | mit | Python | |
d1eac6f370f4a06151870be25cb362370d9ec53d | Add salt/utils/cli.py | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/utils/cli.py | salt/utils/cli.py | # -*- coding: utf-8 -*-
'''
Functions used for CLI argument handling
'''
# Import python libs
import re
import yaml
# Import salt libs
from salt._compat import string_types, integer_types
#KWARG_REGEX = re.compile(r'^([^\d\W][\w-]*)=(?!=)(.*)$', re.UNICODE) # python 3
KWARG_REGEX = re.compile(r'^([^\d\W][\w-]*)=(?!... | apache-2.0 | Python | |
13e6f6967298173d4979c1bc4eb9d7ec6b1f9354 | add a wrapper, not finished yet | gstoner/gpudb,gstoner/gpudb,gstoner/gpudb,gstoner/gpudb | gpudb.py | gpudb.py | #! /usr/bin/python
import sys
import os
import shutil
def dbHelp():
print "Command:"
print "\tcreate DBName: create the database"
print "\tdelete DBName: delete the database"
print "\tlist: list the table infomation in the database"
print "\ttranslate SQL: translate SQL into CUDA file"
print "... | apache-2.0 | Python | |
3a14fa67e4d35fa2865d20e08c03272cff7fcd4e | test wechat post | jtr109/Alpha2kindle | hello.py | hello.py | from flask import Flask, request
app = Flask(__name__)
@app.route('/')
def index():
return '<h1>Hello World!</h1>'
@app.route('/kindle_push', methods=['POST'])
def kindle_push():
print(request.data)
return 'success'
if __name__ == '__main__':
app.run(debug=True) | mit | Python | |
2d0950df803d45c486cbf87d49ff055b818d4999 | Create cvrfile.py | fnielsen/cvrminer,fnielsen/cvrminer,fnielsen/cvrminer | cvrminer/cvrfile.py | cvrminer/cvrfile.py | """CVR miner.
Handles JSONL files from CVR in Erhvervsstyrelsen with information about
companies, places and participants.
Command-line usage
------------------
$ python -m cvrminer.cvrfile
JSON file structure
-------------------
_id : ID of some form
_index :
_source : Actual data
_type: 'virksomhed', 'prod... | apache-2.0 | Python | |
ffdcc9d523daa5a610de1534f3ed10f4d629aaf2 | add 'inspect' filter | serge-name/myansible,serge-name/myansible,serge-name/myansible | filter_plugins/inspect.py | filter_plugins/inspect.py | class FilterModule(object):
''' A comment '''
def filters(self):
return {
'inspect': self.inspect,
}
def inspect(self, input_value, verbose=None):
if (type(input_value) is list) and verbose:
return "[{}]".format(",".join([str(type(i)) for i in input_value]))... | mit | Python | |
737936b91a4a908a02338373b716161f487e44c9 | add factories | byteweaver/django-skrill | skrill/tests/factories.py | skrill/tests/factories.py | from decimal import Decimal
import random
from django.contrib.auth.models import User
import factory
from skrill.models import PaymentRequest
from skrill.settings import ISO4217
class UserFactory(factory.Factory):
FACTORY_FOR = User
username = factory.Sequence(lambda n: "Test User %s" % n)
class Payment... | bsd-3-clause | Python | |
5b54313e08ddf7176583f4776c804a482b111de1 | add test | baishancloud/pykit,baishancloud/pykit,sejust/pykit,sejust/pykit | mysqlutil/test/test_privileges.py | mysqlutil/test/test_privileges.py | #!/usr/bin/env python
# coding: utf-8
import logging
import unittest
from pykit import mysqlutil
from pykit import ututil
dd = ututil.dd
logger = logging.getLogger(__name__)
class TestPrivileges(unittest.TestCase):
def test_load_dump(self):
ks = (
"ALL",
"ALTER",
"... | mit | Python | |
860580119cc6ae9241e866275eccc7d71ae95e8c | Build fis assets on deploy updated. | liwushuo/fapistrano | fapistrano/plugins/fis.py | fapistrano/plugins/fis.py | # -*- coding: utf-8 -*-
from fabric.api import show, run, env, cd
from .. import signal
def init():
signal.register('deploy.updated', build_fis_assets)
def build_fis_assets():
with show('output'):
run('''
fis release --file %(releases_path)s/%(new_release)s/%(fis_conf)s \
--dest %(... | mit | Python | |
471f5738e82fbb57c1028bdf2f1556edb0b074ed | Rename concurrent log handler | Netuitive/netuitive-diamond,Netuitive/netuitive-diamond,Netuitive/netuitive-diamond,Netuitive/netuitive-diamond | src/diamond/logging/handlers/concurrentloghandler.py | src/diamond/logging/handlers/concurrentloghandler.py | # coding=utf-8
from concurrent_log_handler import ConcurrentRotatingFileHandler as CRFH
import sys
class ConcurrentRotatingFileHandler(TRFH):
def flush(self):
try:
super(ConcurrentRotatingFileHandler, self).flush()
except IOError:
sys.stderr.write('ConcurrentRotatingFileH... | mit | Python | |
910fb34ec6ef8544d4de5d8baf52fbd1c2c48027 | Create Hello World Example | MarkGalloway/RIS,MarkGalloway/RIS | hello.py | hello.py | from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return '<h1>Hello 391 team!<h1>'
if __name__ == '__main__':
app.run() | apache-2.0 | Python | |
1290fc572bfc862ab7c8ee579257e00486a3c921 | add a really tiny wsgi | fedora-infra/hrf | hrf.wsgi | hrf.wsgi | from hrf.hrf import app as application
| lgpl-2.1 | Python | |
a4200e281279370f1ef6b4527c5340cec9c729b4 | add lexer for Elm language | dscorbett/pygments,dscorbett/pygments,pygments/pygments,pygments/pygments,dscorbett/pygments,dscorbett/pygments,pygments/pygments,dscorbett/pygments,dscorbett/pygments,pygments/pygments,pygments/pygments,pygments/pygments,dscorbett/pygments,dscorbett/pygments,dscorbett/pygments,dscorbett/pygments,pygments/pygments,pygm... | pygments/lexers/elm.py | pygments/lexers/elm.py | # -*- coding: utf-8 -*-
"""
pygments.lexers.elm
~~~~~~~~~~~~~~~~~~~
Lexer for the Elm programming language.
"""
import re
from pygments.lexer import bygroups, RegexLexer, words, include, using
from pygments.token import Comment, Keyword, Name, Number, Operator, Punctuation, String, Text, Error
__all__ ... | bsd-2-clause | Python | |
c242589075aa4fc9af0a17461f235348b53284a1 | Add sample code decorator | rawswift/python-collections | decorator/cli-sample-decorator.py | decorator/cli-sample-decorator.py | #!/usr/bin/env python
class Deco(object):
def __init__(self, func):
self.func = func
def __call__(self, *args, **kwargs):
result = self.func(*args, **kwargs)
# multiple it by itself
result = result * result
return result
@Deco
def process(x=0, y=0):
return x+y
pr... | mit | Python | |
bf6cfcaa1ac20c1cb65d2d803f64f35026c099f3 | Add Event class as well as connect and fire methods. | bsmukasa/stock_alerter | event.py | event.py | class Event:
def __init__(self):
self.listeners = []
def connect(self, listener):
self.listeners.append(listener)
def fire(self, *args, **kwargs):
for listener in self.listeners:
listener(*args, **kwargs) | mit | Python | |
8d38a72548f3bfc62bac9f49d537fa2cdee7a6df | Add vanilla sequential face detection example. | vmlaker/sherlock | face1.py | face1.py | """Sequential, vanilla face detection."""
import datetime
import sys
import cv2
import numpy as np
import util
import cascade
DEVICE = int(sys.argv[1])
WIDTH = int(sys.argv[2])
HEIGHT = int(sys.argv[3])
DURATION = float(sys.argv[4]) # In seconds.
# Create the OpenCV video capture object.
cap = cv2.VideoCapt... | mit | Python | |
78ce22e302d749e56352e6ec8f592dca4e2287f6 | Add IATISerializer | akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr | akvo/api/serializers.py | akvo/api/serializers.py | # -*- coding: utf-8 -*-
# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
from lxml import etree
import os
from ... | agpl-3.0 | Python | |
6cbd414a670e4b25e8e1e8df9c0e32bee541478c | Create ember.py | scardine/django-ember-tag | ember.py | ember.py | from django import template
register = template.Library()
@register.tag(name='linkto')
def do_linkto(parser, token):
nodelist = parser.parse(('endlinkto',))
args = token.split_contents()[1:]
if not args:
raise template.TemplateSyntaxError("{0} tag requires at least one argument".format(token.cont... | mit | Python | |
6d80c414944bfdd6632b6068d98805a6f67353fb | add test script for interfaces | kellrott/gopy,go-python/gopy,lifei/gopy,go-python/gopy-gen,lifei/gopy,go-python/gopy-gen,kellrott/gopy,go-python/gopy | _examples/iface/test.py | _examples/iface/test.py | # Copyright 2015 The go-python Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
## py2/py3 compat
from __future__ import print_function
import iface
### test docs
print("doc(iface): %r" % (iface.__doc__,))
print("t = iface.T()")
t =... | bsd-3-clause | Python | |
bb4f81f86d5b7bc5869da9f29cc5ea6013d4b4cf | Add plot speed analysis | bskari/sparkfun-avc,bskari/sparkfun-avc,bskari/sparkfun-avc,bskari/sparkfun-avc,bskari/sparkfun-avc,bskari/sparkfun-avc | analysis/plot_speeds.py | analysis/plot_speeds.py | """Plots the speed readings."""
#from dateutil import parser as dateparser
from matplotlib import pyplot
import collections
import datetime
import json
import sys
def main():
"""Main function."""
if sys.version_info.major <= 2:
print('Please use Python 3')
sys.exit(1)
if len(sys.argv) !=... | mit | Python | |
d19899981a77faa9c2017b6991c8e0c4ca4b7b97 | Create db_migrate.py | rockwolf/python,rockwolf/python,rockwolf/python,rockwolf/python,rockwolf/python,rockwolf/python | fade/db_migrate.py | fade/db_migrate.py | #!flask/bin/python
"""
See LICENSE.txt file for copyright and license details.
"""
import imp
from migrate.versioning import api
from app import db
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
migration =... | bsd-3-clause | Python | |
1646916ce204b51a2900fd9edd4626e145f0d873 | Create objects_impl.py | spatial-ucsb/ConceptsOfSpatialInformation,liangcun/ConceptsOfSpatialInformation,spatial-ucsb/ConceptsOfSpatialInformation,liangcun/ConceptsOfSpatialInformation,spatial-ucsb/ConceptsOfSpatialInformation,liangcun/ConceptsOfSpatialInformation | CoreConceptsPy/objects_impl.py | CoreConceptsPy/objects_impl.py | from coreconcepts import AObjects
from osgeo import gdal, gdal_array
import ogr, os, osr
from gdalconst import *
import numpy as np
class ArcShpObjects(AObjects):
@staticmethod
def getBounds (obj):
#Get geometery
geom = obj.GetGeometryRef()
env = geom.GetEnvelope()
#Return boun... | apache-2.0 | Python | |
fa1e8f21347d41712b03817e4fac5a07a1a991eb | Add `btheadphone.py` to find headphones' BTADDR | benizi/dotfiles,benizi/dotfiles,benizi/dotfiles,benizi/dotfiles,benizi/dotfiles,benizi/dotfiles,benizi/dotfiles,benizi/dotfiles | bin/btheadphone.py | bin/btheadphone.py | #!/usr/bin/env python
import dbus
from xml.etree import ElementTree
bluez_bus = 'org.bluez'
bluez_root = '/org/bluez'
intro_iface = 'org.freedesktop.DBus.Introspectable'
props_iface = 'org.freedesktop.DBus.Properties'
dev_iface = 'org.bluez.Device1'
a2dp_uuid = '0000110d-0000-1000-8000-00805f9b34fb'
avrcp_uuid = '00... | mit | Python | |
e7b5f2a91cbf55666e29ec6ac4775e8cee1cc574 | Add ob_atom class | tommyogden/maxwellbloch,tommyogden/maxwellbloch | maxwellbloch/ob_atom.py | maxwellbloch/ob_atom.py | # -*- coding: utf-8 -*-
import json
from maxwellbloch import ob_base
class OBAtom(ob_base.OBBase):
def __init__(self, num_states=0, energies=[], decays=[], fields=[]):
self.num_states = num_states
self.energies = energies
self.decays = decays
self.build_fields(fields)
def ... | mit | Python | |
87790d3a1916a75dd6787f6154e3a76611ec0f0d | Create lc1000.py | FiveEye/ProblemSet,FiveEye/ProblemSet | LeetCode/lc1000.py | LeetCode/lc1000.py | # import heapq
# class Solution:
# def mergeStones(self, stones: List[int], K: int) -> int:
# heapq.heapify(stones)
# ans = 0
# while len(stones) >= K:
# t = 0
# for _ in range(K):
# x = heapq.heappop(stones)
# print(x)
... | mit | Python | |
0f0d48230c07b7c5ce2f8ecc1138d360c67fa8ce | add fusion seq_concat_fc op test | chengduoZH/Paddle,PaddlePaddle/Paddle,tensor-tang/Paddle,luotao1/Paddle,baidu/Paddle,reyoung/Paddle,luotao1/Paddle,PaddlePaddle/Paddle,QiJune/Paddle,chengduoZH/Paddle,PaddlePaddle/Paddle,PaddlePaddle/Paddle,baidu/Paddle,QiJune/Paddle,baidu/Paddle,reyoung/Paddle,PaddlePaddle/Paddle,luotao1/Paddle,PaddlePaddle/Paddle,luo... | python/paddle/fluid/tests/unittests/test_fusion_seq_concat_fc_op.py | python/paddle/fluid/tests/unittests/test_fusion_seq_concat_fc_op.py | # Copyright (c) 2018 PaddlePaddle Authors. 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 app... | apache-2.0 | Python | |
e6b1a590a47a806e0a717d94c2dc112c7671bb2c | add script to merge Aaron's unWISE astrometric offsets into the WISE tile file | legacysurvey/legacypipe,legacysurvey/legacypipe | py/legacyanalysis/wise-offsets.py | py/legacyanalysis/wise-offsets.py | from astrometry.util.fits import fits_table
'''
This is a little script for merging Aaron's astrometric offsets into our
WISE tile file.
'''
#/project/projectdirs/cosmo/work/wise/outputs/merge/neo4/fulldepth/fulldepth_neo4_index.fits
W = fits_table('legacypipe/data/wise-tiles.fits')
offsets = fits_table('fulldepth_... | bsd-3-clause | Python | |
fbebb94cd621f0d7b37dbe46272fe9a09a9905a7 | Add cram package. | LLNL/spack,mfherbst/spack,iulian787/spack,krafczyk/spack,matthiasdiener/spack,LLNL/spack,LLNL/spack,iulian787/spack,TheTimmy/spack,krafczyk/spack,mfherbst/spack,lgarren/spack,lgarren/spack,skosukhin/spack,TheTimmy/spack,iulian787/spack,lgarren/spack,lgarren/spack,matthiasdiener/spack,matthiasdiener/spack,tmerrick1/spac... | var/spack/packages/cram/package.py | var/spack/packages/cram/package.py | from spack import *
class Cram(Package):
"""Cram runs many small MPI jobs inside one large MPI job."""
homepage = "https://github.com/scalability-llnl/cram"
url = "http://github.com/scalability-llnl/cram/archive/v1.0.1.tar.gz"
version('1.0.1', 'c73711e945cf5dc603e44395f6647f5e')
depends_on("... | lgpl-2.1 | Python | |
e7a5f511a87ce80b4db9939904163d19e58738c4 | Add send game_version script | innogames/igcollect | game_sent_game_version.py | game_sent_game_version.py | #!/usr/bin/env python
#
# igcollect - Sent currently deployed game version.
#
# Copyright (c) 2016 InnoGames GmbH
#
import os
import re
import socket
# All possible revision files for all games.
revision_file = [
'/www/ds/revision',
'/www/grepo/branch',
'/www/foe/version',
'/www/onyx/branch',
]
if __... | mit | Python | |
cad82b50c8115cd92b6c1bbc1c18c9a825bad368 | Add interactive graph with terms | CristianCantoro/thes-discover | graph.py | graph.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib
import matplotlib.pyplot as plt
from unicodecsv import UnicodeReader
NEW_ANNOTATIONS = 'new_annotations.map'
def graph():
readlist = []
with open(NEW_ANNOTATIONS, 'r') as infile:
reader = UnicodeReader(infile)
readlist += [re f... | mit | Python | |
408af1320637063bacdd105cf00cdf71ef1ff9b2 | Add labeled implementation | AuthEceSoftEng/rnn2source | multi.py | multi.py | from keras.layers import Input, LSTM, TimeDistributed, Dense, merge, Dropout
from keras.models import Model
vocab_size = 200
seq_len = 25
label_size = 10
batch_size = 50
lstm_size = 512
char_input = Input(batch_shape=(batch_size, seq_len, vocab_size), name='char_input')
label_input = Input(batch_shape=(batch_size, se... | mit | Python | |
43fd2b8bd64e684ee47c91f582c8c2578e420105 | Test check_visitors | edx/edx-lint | test/plugins/test_common.py | test/plugins/test_common.py | """Tests of edx_lint/pylint/common.py"""
import pytest
from edx_lint.pylint.common import check_visitors
# pylint: disable=missing-docstring, unused-variable
def test_check_good_visitors():
@check_visitors
class ItsRight(object):
def visit_call(self):
pass # pragma... | apache-2.0 | Python | |
c841fccb6099fb00b0a66a11c837bf2afd32e2f1 | Create shell_cmd_test.py | stephaneAG/Python_tests,stephaneAG/Python_tests,stephaneAG/Python_tests,stephaneAG/Python_tests | shell_cmd_test.py | shell_cmd_test.py | import subprocess
subprocess.call(['say', ' Hello World from Python.'])
listing_holder = subprocess.call(['ls','-l'])
if listing_holder > 0:
print "here the files listing resulting from the shell command ran from within python: \n %s" %listing_holder
| mit | Python | |
6988dab0256ce6b6e0d5cbb4b3ac06727956ee37 | Create a new file to calculate features from sets of points | shankari/e-mission-server,shankari/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,yw374cornell/e-mission-server,joshzarrabi/e-mission-server,joshzarrabi/e-mission-server,shankari/e-mission-server,yw374cornell/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,yw374cornell/e-mi... | emission/analysis/point_features.py | emission/analysis/point_features.py | # Standard imports
import math
import logging
import numpy as np
import emission.core.common as ec
def calSpeed(point1, point2):
distanceDelta = ec.calDistance([point1.mLongitude, point1.mLatitude], [point2.mLongitude, point2.mLatitude])
timeDelta = point2.mTime - point1.mTime
# print "Distance delta = %s ... | bsd-3-clause | Python | |
bef97246f77aaa1030b17e1213850c95786f51d7 | Add state tests | njbbaer/unicorn-remote,njbbaer/unicorn-remote,njbbaer/unicorn-remote | app/tests/test_state.py | app/tests/test_state.py | import unittest
import time
from app.state import state, ProgramNotFound
class TestState(unittest.TestCase):
def tearDown(self):
if state._process is not None:
state._process.terminate()
def test_start_all(self):
programs= ["ascii_text", "cheertree", "cross", "demo", "dna",
... | mit | Python | |
54033b438900e17d8e3e852222dc25c981cdb7e7 | add model_helper, forgot to commit it previously | jcfr/mystic,jcfr/mystic | models/_model_helper.py | models/_model_helper.py |
chebyshev2coeffs = [2., 0., -1.]
chebyshev4coeffs = [8., 0., -8., 0., 1.]
chebyshev6coeffs = [32., 0., -48., 0., 18., 0., -1.]
chebyshev8coeffs = [128., 0., -256., 0., 160., 0., -32., 0., 1.]
chebyshev16coeffs = [32768., 0., -131072., 0., 212992., 0., -180224., 0., 84480., 0., -21504., 0., 2688., 0., -128., 0., 1]
de... | bsd-3-clause | Python | |
91bab4277a8875f7248af698773938d54e19724f | Create InputNeuronGroup_Liquid.py | ricardodeazambuja/BrianConnectUDP | examples/InputNeuronGroup_Liquid.py | examples/InputNeuronGroup_Liquid.py | '''
Example of a spike generator (only outputs spikes)
In this example spikes are generated and sent through UDP packages. At the end of the simulation a raster plot of the
spikes is created.
'''
from brian import *
import numpy
from brian_multiprocess_udp import BrianConnectUDP
number_of_neurons_total = 45
numbe... | cc0-1.0 | Python | |
a11d33f5e1df23f044cac709ebbbb5d369d0e6ca | Add first test for update_language_list function | caleb531/youversion-suggest,caleb531/youversion-suggest | tests/test_add_language/test_update_language_list.py | tests/test_add_language/test_update_language_list.py | # test_update_language_list
from __future__ import unicode_literals
import json
import os
import os.path
import nose.tools as nose
import yvs.shared as yvs
import utilities.add_language as add_lang
from tests.test_add_language import set_up, tear_down
from tests.test_add_language.decorators import redirect_stdout
... | mit | Python | |
bd5fc565c5106d609a7dc65a663515920e29caa4 | Add example of multi-layer chart | jakevdp/altair,altair-viz/altair,ellisonbg/altair | altair/vegalite/v2/examples/multiple_marks.py | altair/vegalite/v2/examples/multiple_marks.py | """
Multiple Marks
==============
This example demonstrates creating a single chart with multiple markers
representing the same data.
"""
import altair as alt
from vega_datasets import data
stocks = data.stocks()
chart = alt.LayerChart(stocks).encode(
x='date:T',
y='price:Q',
color='symbol:N'
).add_layers... | bsd-3-clause | Python | |
41acbf471edce3babeed4a59a7f5f2a923d6fed6 | Create sampe_1.py | jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi,jeonghoonkang/BerePi | apps/mongodb/sampe_1.py | apps/mongodb/sampe_1.py | import pandas as pd
import bson
FILE="/folder/file.bson"
with open(FILE,'rb') as f:
data = bson.decode_all(f.read())
main_df=pd.DataFrame(data)
main_df.describe()
| bsd-2-clause | Python | |
043ec867e3407fad1afa9d767961c92ede3a05c2 | Add initial support for KHR_lights extension | Kupoman/blendergltf | extension_exporters/khr_lights.py | extension_exporters/khr_lights.py | from ..blendergltf import Reference
class KhrLights:
ext_meta = {
'name': 'KHR_lights',
'url': (
'https://github.com/andreasplesch/glTF/blob/ec6f61d73bcd58d59d4a4ea9ac009f973c693c5f/'
'extensions/Khronos/KHR_lights/README.md'
),
'isDraft': True,
}
d... | apache-2.0 | Python | |
e7c6a1d5ca6c6ebd85976698e8c00ca761747b59 | ADD FEATURE : simple C/C++ compiler | dgu-dna/DNA-Bot | apps/simple_compiler.py | apps/simple_compiler.py | from apps.decorators import on_command
from apps.slackutils import cat_token
from subprocess import check_output, CalledProcessError, STDOUT
import os
import re
@on_command(['!컴파일'])
def run(robot, channel, tokens, user, command):
'''C, C++, Python 소스 실행시켜드림'''
msg = ''
if len(tokens) < 2:
return ... | mit | Python | |
ccae8514f184d612c515f1c17b8832b89b0982db | Create phylo.py | jdanav/alife | phylo.py | phylo.py | def phy_descend(parent, dictionary, out={}):
if parent not in out:
out[parent] = {}
for i in dictionary.keys():
if dictionary[i] == parent: phy_descend(i, dictionary, out[parent])
return out
def phy_ancestry(child, dictionary, out=[]):
if child in dictionary.keys():
out.... | mit | Python | |
5bed3cf9ec4ccbc94529a4d7b37802f5340803a6 | add utilities for unicode-friendly csv file reading & writing | qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq | dimagi/utils/csv.py | dimagi/utils/csv.py | """
extend csv.writer and csv.reader to support Unicode
from http://docs.python.org/library/csv.html
"""
from __future__ import absolute_import
import csv
import codecs
import cStringIO
class UTF8Recoder:
"""
Iterator that reads an encoded stream and reencodes the input to UTF-8
"""
def __init__... | bsd-3-clause | Python | |
066ba7f846f9cf32e29e82f6ba90db4f4f27029f | Create superBall.py | NendoTaka/CodeForReference,NendoTaka/CodeForReference,NendoTaka/CodeForReference | CodeWars/8kyu/superBall.py | CodeWars/8kyu/superBall.py | class Ball(object):
def __init__(self, type = "regular"):
self.ball_type = type
| mit | Python | |
8579e10ad13f2a9b5680edfbe185d3e1b597f9c6 | add hello.py | Jessime/Excision,Jessime/Excision,Jessime/Excision | hello.py | hello.py | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 16 20:11:07 2015
@author: jessime
"""
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run() | mit | Python | |
852ecb67e11f4ad9662c832d8be5f5bf1b8327b1 | Add tests for action groups. | geggo/pyface,brett-patterson/pyface,geggo/pyface | pyface/action/tests/test_group.py | pyface/action/tests/test_group.py | from __future__ import absolute_import
from traits.testing.unittest_tools import UnittestTools, unittest
from ...image_cache import ImageCache
from ...window import Window
from ..action import Action
from ..action_item import ActionItem
from ..group import Group
class TestActionItem(unittest.TestCase, UnittestTools... | bsd-3-clause | Python | |
76f636d38d6f3947efe6d58eacbd655027fc1a0e | Add post-hook to handle the difference between project name and role name. | FGtatsuro/cookiecutter-ansible-role,FGtatsuro/cookiecutter-ansible-role | hooks/post_gen_project.py | hooks/post_gen_project.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
# Use symlink to handle the difference between project name and role name.
os.symlink('../../{{ cookiecutter.role_project_name }}', 'roles/{{ cookiecutter.role_name }}')
| mit | Python | |
fd7949d9fba182b19fc0de3cb32bca142cf8c801 | Add missing file. | ProjetPP/PPP-datamodel-Python,ProjetPP/PPP-datamodel-Python | tests/test_triple_parser.py | tests/test_triple_parser.py | from unittest import TestCase
from ppp_datamodel import Triple, Resource, Missing
from ppp_datamodel.triple_parser import parse_triples
class TripleParserTestCase(TestCase):
def testBasics(self):
self.assertEqual(parse_triples('(foo, (bar, ?, (?, qux, quux)), ?)'), [
Triple(
... | agpl-3.0 | Python | |
882b016d7cc084b2b6071bd128c060083d0aecd6 | Create __init__.py | MKLab-ITI/prophet | rdflib/plugins/parsers/__init__.py | rdflib/plugins/parsers/__init__.py | """
"""
| apache-2.0 | Python | |
7022b47ed984d11474b1aa5721099620cc20956c | Fix updating issue with Qtile widget | magus424/powerline,bezhermoso/powerline,seanfisk/powerline,dragon788/powerline,prvnkumar/powerline,IvanAli/powerline,darac/powerline,xxxhycl2010/powerline,dragon788/powerline,magus424/powerline,Luffin/powerline,DoctorJellyface/powerline,s0undt3ch/powerline,firebitsbr/powerline,xfumihiro/powerline,cyrixhero/powerline,ar... | powerline/bindings/qtile/widget.py | powerline/bindings/qtile/widget.py | # -*- coding: utf-8 -*-
from libqtile import bar
from libqtile.widget import base
from powerline.core import Powerline as PowerlineCore
class Powerline(base._TextBox):
def __init__(self, timeout=2, text=" ", width=bar.CALCULATED, **config):
base._TextBox.__init__(self, text, width, **config)
self.timeout_add(t... | # -*- coding: utf-8 -*-
from libqtile import bar
from libqtile.widget import base
from powerline.core import Powerline as PowerlineCore
class Powerline(base._TextBox):
def __init__(self, timeout=2, text=" ", width=bar.CALCULATED, **config):
base._TextBox.__init__(self, text, width, **config)
self.timeout_add(t... | mit | Python |
aa9160875482debdf6eacc0cbfa6ca1906cf5cb1 | Add a script to run tests in a virtual machine | rvykydal/blivet,jkonecny12/blivet,AdamWill/blivet,vojtechtrefny/blivet,jkonecny12/blivet,vojtechtrefny/blivet,AdamWill/blivet,rvykydal/blivet | tests/vmtests/runvmtests.py | tests/vmtests/runvmtests.py | import argparse
import libvirt
import paramiko
import sys
import time
from contextlib import contextmanager
TESTS = ["tests.vmtests.blivet_reset_vmtest.LVMTestCase",
"tests.vmtests.blivet_reset_vmtest.LVMSnapShotTestCase",
"tests.vmtests.blivet_reset_vmtest.LVMThinpTestCase",
"tests.vmtests... | lgpl-2.1 | Python | |
e3793a076606e8200a38cb9504f04730470bd741 | Create Source.py | prakharmohan0809/OpenCV-Upper-Body-Python | Source.py | Source.py | import numpy as np
import cv2
vid=cv2.VideoCapture(0)
_, instant=vid.read()
avg=np.float32(instant)
file=cv2.CascadeClassifier("C:\opencv2.4.6\data\haarcascades\haarcascade_mcs_upperbody.xml")
obj=0
while(1):
_,frame=vid.read()
cv2.accumulateWeighted(frame, avg, 0.1)
background=cv2.convertScaleAbs(avg)
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.