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 |
|---|---|---|---|---|---|---|---|---|
ea74801222231145421187a005756db752e9a2f8 | Add a test for HTML retrieval. | jwg4/flask-autodoc,jwg4/flask-autodoc | tests/test_flask_get.py | tests/test_flask_get.py | import unittest
from flask import Flask
from flask.ext.autodoc import Autodoc
class TestAutodocWithFlask(unittest.TestCase):
def setUp(self):
self.app = Flask(__name__)
self.autodoc = Autodoc(self.app)
@self.app.route('/')
@self.autodoc.doc()
def index():
"""R... | mit | Python | |
89870314ce1f0599fbe1faf38474c58d6b502f95 | Add setup.py | sunu/localshare | setup.py | setup.py | # -*- coding: utf-8 -*-
from distutils.core import setup
setup(
name='localshare',
version='0.1',
py_modules=['localshare'],
install_requires=[
'Click',
'zeroconf',
'netifaces'
],
entry_points='''
[console_scripts]
localshare=localshare:cli
''',
... | mit | Python | |
475af17735887864d923eb452dc56722ba03afbf | add setup.py for docs compilation | radical-cybertools/ExTASY | setup.py | setup.py | #!/usr/bin/env python
"""Setup file for ExTASY
"""
__author__ = "Vivek"
__email__ = "vivek.balasubramanian@rutgers.edu"
__copyright__ = "Copyright 2014, The RADICAL Project at Rutgers"
__license__ = "MIT"
""" Setup script. Used by easy_install and pip. """
from setuptools import setup, find_packages, Command
impor... | mit | Python | |
323246e447dc55dd5ea2b22ac6c56e97f0a6f9ed | Add setup.py | vberlier/nbtlib | setup.py | setup.py |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='nbtlib',
version='0.1.0',
description='A pytho... | mit | Python | |
0bb11618466d5277989e61419054ff8be7e47e41 | Add setup.py | csdms/bmi-live,csdms/bmi-live | setup.py | setup.py | from setuptools import setup, find_packages
setup(name='bmi-live-2018',
version='0.1',
author='Mark Piper',
author_email='mark.piper@colorado.edu',
license='MIT',
description='Source for the 2018 BMI Live clinic',
long_description=open('README.md').read(),
install_requires=('... | mit | Python | |
8c575d9e408d4b6661a2836e59373ab9f91ba158 | Add maintainer information. | Aloomaio/facebook-sdk,mobolic/facebook-sdk | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='facebook-sdk',
version='0.3.2',
description='This client library is designed to support the Facebook '
'Graph API and the o... | #!/usr/bin/env python
from distutils.core import setup
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='facebook-sdk',
version='0.3.2',
description='This client library is designed to support the Facebook '
'Graph API and the o... | apache-2.0 | Python |
26ec347c0b7cc78c596b8731712c0a9e2c89f62b | Add setup.py file in preparation for release | meyersbs/uncertainty | setup.py | setup.py | from setuptools import setup
setup(
name='uncertainty',
version='0.1.0',
packages=['uncertainty', 'uncertainty.data', 'uncertainty.features'],
package_data={
'uncertainty': ['models/*.p', 'vectorizers/*.p']
},
install_requires=[
'numpy==1.12.1',
... | mit | Python | |
ce5903002aaf98861fdc589f40c5747d7e14895a | Create setup.py | robert7k/PyRaumfeld | setup.py | setup.py | from setuptools import setup
setup (name='raumfeld',
install_requires='mock')
| mit | Python | |
0730c43956504eb369618d75263cd7f47dd38bc0 | Create setup.py file. | casimp/edi12,casimp/pyxe,Simclass/EDXD_Analysis | setup.py | setup.py | from distutils.core import setup
setup(
name='EDI12',
version='0.1.0',
author='C. Simpson',
author_email='c.a.simpson01@gmail.com',
packages=['edi12'],
url='http://pypi.python.org/pypi/EDI12/',
license='LICENSE.txt',
description='Analysis of data produced on the I12 beam line. Notably a... | mit | Python | |
9edfd6159963eddb175cc1fdbd762b949e7d6884 | Include oauth2.store.dbapi in build | CoolCloud/python-oauth2,candango/python-oauth2,gcd0318/python-oauth2,mygola/python-oauth2,candango/python-oauth2,candango/python-oauth2,mygola/python-oauth2,wndhydrnt/python-oauth2,gcd0318/python-oauth2,gcd0318/python-oauth2,wndhydrnt/python-oauth2,CoolCloud/python-oauth2,wndhydrnt/python-oauth2,mygola/python-oauth2,Co... | setup.py | setup.py | from setuptools import setup
VERSION = "0.7.0"
setup(name="python-oauth2",
version=VERSION,
description="OAuth 2.0 provider for python",
long_description=open("README.rst").read(),
author="Markus Meyer",
author_email="hydrantanderwand@gmail.com",
url="https://github.com/wndhydrnt/p... | from setuptools import setup
VERSION = "0.7.0"
setup(name="python-oauth2",
version=VERSION,
description="OAuth 2.0 provider for python",
long_description=open("README.rst").read(),
author="Markus Meyer",
author_email="hydrantanderwand@gmail.com",
url="https://github.com/wndhydrnt/p... | mit | Python |
959110a9ae9b0e141600a678ceedb454e1fc5c76 | Add setup.py | paytm/django-supermigrate | setup.py | setup.py | import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
README = readme.read()
setup(
name='django-supermigrate',
version='0.1',
packages=['supermigrate'],
include_package_data=True,
license='MIT License',
description='package to m... | mit | Python | |
4c8bcfb53d12cf6b11ce6dc7759670eae9387b93 | Initialize setup file | erayaydin/xgraphic,erayaydin/xgraphic | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name='XGraphic',
version='0.1',
description='Switching between nvidia and bumblebee',
author='Eray AYDIN',
author_email='eray@labkod.com',
url='https://www.github.com/erayaydin/xgraphic',
data_files=[('stubs', ['stubs/bum... | mit | Python | |
97e2c921e6dee6a355f1e18c0c995b97ff6cd172 | Add setup script | kirbyfan64/hyskell | setup.py | setup.py | try:
# assert False
from setuptools import setup
from setuptools.command.install import install
from setuptools.command.install_lib import install_lib
kw = {'install_requires': 'hy >= 0.9.12'}
except:
from distutils.core import setup
from distutils.command.install import install
from dis... | mit | Python | |
160faff5164f89c9adb8f78abbf898067576ba56 | Add setup.py | znerol/astminer | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name='astminer',
version='0.1',
description='Asterisk integration for the Redmine issue tracker.',
author='Lorenz Schori',
author_email='lo@znerol.ch',
url='http://github.com/znerol/astminer',
scripts=['astminer.py']
)
| mit | Python | |
ec9fe89c91ce95313331522f6659effcffb55fd7 | add tests for debsources.fs_storage | devoxel/debsources,oorestisime/debsources,clemux/debsources,oorestisime/debsources,Debian/debsources,matthieucan/debsources,clemux/debsources,zacchiro/debsources,matthieucan/debsources,oorestisime/debsources,vivekanand1101/debsources,Debian/debsources,oorestisime/debsources,zacchiro/debsources,vivekanand1101/debsources... | debsources/tests/test_fs_storage.py | debsources/tests/test_fs_storage.py | # Copyright (C) 2015 The Debsources developers <info@sources.debian.net>.
# See the AUTHORS file at the top-level directory of this distribution and at
# https://anonscm.debian.org/gitweb/?p=qa/debsources.git;a=blob;f=AUTHORS;hb=HEAD
#
# This file is part of Debsources. Debsources is free software: you can
# redistrib... | agpl-3.0 | Python | |
3bdcb36910734d0c3b904cc8306140050fd839f0 | Create ChangePasswords.py | BenjaminJilasoan/ChangePasswordsProject | ChangePasswords.py | ChangePasswords.py | import os
import subprocess
import getpass
import time
import sys
import datetime
############################################
#
# Author: Benjamin Lykins
# Date: 11/16/2015
# Version 0.10
#
# Notes: For this program to work, the settings of the computers
# where the passwords must allow for remote users to run comman... | mit | Python | |
1a283cb6cd78b58e846aba2549e675fd77ae935e | Put custom Javascript minifier in a script javascript_minifier.py | kikocorreoso/brython,Hasimir/brython,JohnDenker/brython,Lh4cKg/brython,Hasimir/brython,kikocorreoso/brython,Isendir/brython,Mozhuowen/brython,kikocorreoso/brython,Lh4cKg/brython,molebot/brython,jonathanverner/brython,rubyinhell/brython,brython-dev/brython,kevinmel2000/brython,Mozhuowen/brython,JohnDenker/brython,olemis... | scripts/javascript_minifier.py | scripts/javascript_minifier.py | """Javascript minifier"""
def minify(src):
_res, pos = '', 0
while pos < len(src):
if src[pos] in ('"', "'"):
# the end of the string is the next quote if it is not
# after an odd number of backslashes
start = pos
while True:
end = sr... | bsd-3-clause | Python | |
cf171a7ba84422b1ac3ef00ee09ab855987ff553 | Create quiz.py | jeimynoriega/uip-prog3 | Laboratorios/quiz.py | Laboratorios/quiz.py |
base=5
altura=7
perimetro=2*5+2*7
print ("mi perimetro es" + str(perimetro))
area=5*7
print ("mi area es" + str (area))
metrop=perimetro/100
print ("mi perimetro en metro es" + str(metrop))
pulgadap=perimetro/2.54
print ("mi perimetro en pulgada es" + str(pulgadap))
metroa=area/100
print ("mi area en metro es" + ... | mit | Python | |
aed3201b9e077b0f7d43575b254bcceb3e35fb2b | Add database setup script | Tomcuzz/OctaHomeAutomation,Tomcuzz/OctaHomeAutomation,Tomcuzz/OctaHomeAutomation,Tomcuzz/OctaHomeAutomation | SupportingFiles/SetupDatabaseObjects.py | SupportingFiles/SetupDatabaseObjects.py | from Account.models import *
from Weather.views import *
updateLocations()
user = CustomUser.objects.create_user('admin@admin.com', 'N/A', 'N/A', 'Fish01')
user.username = 'admin@admin.com'
user.first_name = 'Thomas'
user.last_name = 'Cousin'
user.is_active = True
user.is_superuser = True
user.home_location = '35240... | mit | Python | |
625f357fbcb1f6c1fa07b0857e20ee13ca1fb042 | add settings_values context processor | v0y/django-FIUT | fiut/context_processors.py | fiut/context_processors.py | #!/usr/bin/env python
# encoding: utf-8
from django.conf import settings
def settings_values(request):
"""
Context processor, which sends setting values to templates.
"""
return {'settings': settings}
| mit | Python | |
6893c684eb45270d35b2c7a64f297c6db3e74535 | delete Django User and his Mailboxes | hdknr/paloma,hdknr/paloma,hdknr/paloma | src/paloma/management/commands/membership.py | src/paloma/management/commands/membership.py | # -*- coding: utf-8 -*-
from paloma.management.commands import GenericCommand
from paloma.mails import send_mail_simple,send_mail_from_file
from paloma.tasks import trigger_schedule
from django.utils import timezone, dateparse
from optparse import make_option
from datetime import datetime
import commands
import os
... | bsd-2-clause | Python | |
cfbdd0d1dfd0f10cd0f161a6da060c5326d03efc | Initialize level data. | malaonline/Android,malaonline/Server,malaonline/Server,malaonline/Server,malaonline/Server,malaonline/Android,malaonline/Android,malaonline/iOS,malaonline/iOS,malaonline/iOS | server/app/migrations/0006_level.py | server/app/migrations/0006_level.py | import os
from django.db import migrations
def add_level(apps, schema_editor):
Level = apps.get_model('app', 'Level')
for name in ('初级', '中级', '高级', '麻辣合伙人'):
level = Level(name=name)
level.save()
print(level.name)
class Migration(migrations.Migration):
dependencies = [
(... | mit | Python | |
f9733f0fcbf94aabda179e50a4eb694f117c208d | Add base renderer and an index page renderer | ana-balica/classy-django-forms,ana-balica/classy-django-forms,ana-balica/classy-django-forms | cdf/renderers.py | cdf/renderers.py | from cdf.config import DJANGO_VERSIONS, VERSION
from cdf.jinja_utils import template_env
class BasePageRenderer(object):
def __init__(self, klasses):
self.klasses = klasses
def render(self, filename):
template = template_env.get_template(self.template_name)
context = self.get_context... | mit | Python | |
4fdadd1efba179297d2efd68426450d0d24aa3b1 | tweak example | theDataGeek/pyhsmm,wgmueller1/pyhsmm,wgmueller1/pyhsmm,wgmueller1/pyhsmm,theDataGeek/pyhsmm,mattjj/pyhsmm,theDataGeek/pyhsmm,fivejjs/pyhsmm,wgmueller1/pyhsmm,fivejjs/pyhsmm,wgmueller1/pyhsmm,theDataGeek/pyhsmm,fivejjs/pyhsmm,fivejjs/pyhsmm,theDataGeek/pyhsmm,fivejjs/pyhsmm,mattjj/pyhsmm | examples/hmm.py | examples/hmm.py | from __future__ import division
import numpy as np
np.seterr(divide='ignore') # these warnings are usually harmless for this code
from matplotlib import pyplot as plt
import matplotlib
import os
matplotlib.rcParams['font.size'] = 8
import pyhsmm
from pyhsmm.util.text import progprint_xrange
print \
'''
This demo show... | from __future__ import division
import numpy as np
np.seterr(divide='ignore') # these warnings are usually harmless for this code
from matplotlib import pyplot as plt
import matplotlib
import os
matplotlib.rcParams['font.size'] = 8
import pyhsmm
from pyhsmm.util.text import progprint_xrange
print \
'''
This demo show... | mit | Python |
357b902fb0f7cb74b51c8074f9c04de234e3bd02 | Create extract_usgs.py | KitWallace/terrain | extract_usgs.py | extract_usgs.py | """"
Read single tiles from USGS each tile covers a degree of lat and long
parameters
1 tile id eg w005n54e
""""
import sys
import zipfile
import numpy as np
import shapefile
def load_tile(tile) : #return the elevation array for this tile
an= "usgs/"+tile+"/"+tile+".shp"
print(an)
... | cc0-1.0 | Python | |
abe6272dcf78a80de448bb733ed3aff245cfdddd | Add `slack.py` | avinassh/slackipy,avinassh/slackipy,avinassh/slackipy | slack.py | slack.py | import json
from slackipycore import invite
from slackipycore import (AlreadyInTeam, InvalidInviteeEmail,
InvalidAuthToken, AlreadyInvited, APIRequestError)
from flask import current_app
def invite_user(email):
api_token = current_app.config['slack_api_token']
team_name = current_app... | mit | Python | |
7c65be707a6497c9cd6fb7bfbe5e7056cf65048b | Create general_purp.py | wolfdale/Scraper | general_purp.py | general_purp.py | """ PROJECT SCRAPER """
from bs4 import BeautifulSoup
import urllib2
def scrape_img( url, tag_name, attr, attr_name ):
''' BEAUTIFUL SOUP INIT '''
web=urllib2.urlopen(url)
soup=BeautifulSoup(web,'html.parser',from_encoding='utf-8')
''' CONTENT LIST '''
content=[]
for link in soup.find_all(tag_name):
... | mit | Python | |
22dad7c51eeff0d7cc5024ce05e7c404389ebcc0 | Create hofstadter_q.py | Kunalpod/codewars,Kunalpod/codewars | hofstadter_q.py | hofstadter_q.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Hofstadter Q
#Problem level: 6 kyu
def load(n):
hof=[0, 1, 1]
for i in range(3,n+1):
hof.append(hof[i - hof[i-1]] + hof[i - hof[i-2]])
return hof
def hofstadter_Q(n):
hof = load(n)
return hof[n]
| mit | Python | |
11c5b497d2a8a0178d0da0d0753354e00fce2840 | Create script to compute the METE SAR prediction for a middle ground model in which Pi is recursively downscale but psi of the SAD is not. This model is used in the DDR analysis. | weecology/mete-spatial,weecology/mete-spatial,weecology/mete-spatial,weecology/mete-spatial | scripts/spat_mete_sar_middle_ground.py | scripts/spat_mete_sar_middle_ground.py | """
Author: Dan McGlinn
Date: 2/11/13
Purpose: to calculate the recursive downscaling of Pi but not psi to predict the
SAR, this is a middle ground model between the recursive and non-recursive models. Uses only the METE predicted SADS.
"""
import numpy as np
import csv
import sys
import os
import mete
print 'Comput... | mit | Python | |
8a1360624aacc44410b8b29478938147615711bf | use priority queue. | zhuxiang/LeetCode-Python | src/23-MergeKSortedLists.py | src/23-MergeKSortedLists.py | from Queue import PriorityQueue
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def mergeKListsInferior(self, lists):
"""
:type lists: List[ListNode]
:rtype: ListNode
"""
... | apache-2.0 | Python | |
84e2b9abfaf0f9f22ca914bbaf02c2231894846a | Create xml-feed.py | agusmakmun/Some-Examples-of-Simple-Python-Script,agusmakmun/Some-Examples-of-Simple-Python-Script | Django/xml-feed.py | Django/xml-feed.py | #DEFAULT SOURCE FROM: https://github.com/pythonanywhere/jab/blob/master/jab/feeds.py
from django.conf import settings
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Rss201rev2Feed
from jab.models import Post
# Keep Chrome happy as per http://stackoverflow.com/a/1081023/32846... | agpl-3.0 | Python | |
981a0a3bf7e07e8e1df43e2823badabd28e218ce | add besic benchmarking script for the DataContainer | simphony/simphony-common | simphony/bench/data_container_bench.py | simphony/bench/data_container_bench.py | from __future__ import print_function
import random
from simphony.bench.util import bench
from simphony.core.data_container import DataContainer
from simphony.core.cuba import CUBA
dict_data = {key: key + 3 for key in CUBA}
data_container = DataContainer(dict_data)
indices = [random.randint(0, len(CUBA) - 1) for i i... | bsd-2-clause | Python | |
688a7ed830a33b9057c39be90be966e4e8df595c | set up initial test for csv2 | hep-gc/cloudscheduler,hep-gc/cloudscheduler,hep-gc/cloudscheduler,hep-gc/cloudscheduler | unit_tests/test_web_group.py | unit_tests/test_web_group.py | import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class TestWebGroup(unittest.TestCase):
"A class to test group operations via the web interface."""
... | apache-2.0 | Python | |
adefbd9aced78e82ce5bbdfd26f088f664c4731a | add spatial query | shadow3x3x3/renew-skyline-path-query | skyline_path/query/spatial_query.py | skyline_path/query/spatial_query.py | from skyline_path.algorithms.dijkstra import Dijkstra
from skyline_path.algorithms.dijkstra_heap import calculate_distances
from skyline_path.query.skyline_query import skyline_query
# params query_nodes_data: {nodes: values}
class SpatialQuery:
def __init__(self, mag, target_edge):
self.graph = mag
... | mit | Python | |
32de58c3a36bf9f9f8ec98e904aee989ebe3428e | Install different deps for Python 3 vs. Python 2. | gthank/pto,gthank/pto | install_deps.py | install_deps.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Installs dependencies appropriate for the Python version."""
import subprocess
import sys
subprocess.call("pip", "install --use-mirrors -r requirements.txt")
if sys.version_info[0] >= 3: # Python 3
# No Python 3-specific dependencies right now
pass
else: # Pyth... | mit | Python | |
dd95add10c7f6d6db5f5e624ee1c123c80fa9099 | Create exploit.py | DavidAwad/Python-RootKit-Exploit-OSX,pandazheng/Python-RootKit-Exploit-OSX | exploit.py | exploit.py | import os
import sys
import platform
import re
import ctypes
import objc
import sys
from Cocoa import NSData, NSMutableDictionary, NSFilePosixPermissions
from Foundation import NSAutoreleasePool
def load_lib(append_path):
return ctypes.cdll.LoadLibrary("/System/Library/PrivateFrameworks/" + append_path);
def use_... | mit | Python | |
114de8ad8254d3f67d73027adaa804273fe7ef9b | Add utils to track the version information | vmthunder/volt | voltracker/common/version.py | voltracker/common/version.py | # Copyright 2011 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 l... | apache-2.0 | Python | |
9d717664d9b1fafffe5882f0bd22a0ba93b11ba7 | make the top level directory of the repo a python module | piskvorky/gensim,akutuzov/gensim,gojomo/gensim,davechallis/gensim,quole/gensim,tzoiker/gensim,ELind77/gensim,ziky90/gensim,mattilyra/gensim,ELind77/gensim,summanlp/gensim,isohyt/gensim,gojomo/gensim,manasRK/gensim,tzoiker/gensim,dsquareindia/gensim,quole/gensim,loisaidasam/gensim,robotcator/gensim,isohyt/gensim,dsquare... | __init__.py | __init__.py | import os
modules_path = os.path.join('site-packages', 'gensim', 'src', 'gensim')
__path__.append(os.path.join(os.path.dirname(os.__file__), modules_path))
| lgpl-2.1 | Python | |
476407140bffd3b1299b40106f3372a9bfcab41c | Create solution2.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | hackerrank/algorithms/sorting/easy/correctness_and_the_loop_invariant/py/solution2.py | hackerrank/algorithms/sorting/easy/correctness_and_the_loop_invariant/py/solution2.py | #!/bin/python
def insertion_sort(L):
for i in xrange(1, len(L)):
key = L[i]
lo = 0
hi = j = i
while lo < hi:
mid = lo + (hi - lo) // 2
if L[mid] > key:
hi = mid
else:
lo = mid + 1
L[lo + 1:j + 1] = L[lo:j]
... | mit | Python | |
37566c392ee4fad7a06d2659370416f0ea4818eb | add a binding.gyp file for node-gyp support | improvisio-software/libxmljs,Visya/libxmljs,rc0x03/libxmljs,CodeFridge/libxmljs_mem,Visya/libxmljs,libxmljs/libxmljs,gagern/libxmljs,rchipka/libxmljs,rchipka/libxmljs,hildjj/libxmljs,Konsus/libxml,Visya/libxmljs,Konsus/libxml,hildjj/libxmljs,polotek/libxmljs,libxmljs/libxmljs,polotek/libxmljs,sergeche/libxmljs,libxmljs... | binding.gyp | binding.gyp | {
'targets': [
{
# have to specify 'liblib' here since gyp will remove the first one :\
'target_name': 'liblibxmljs',
'sources': [
'src/libxmljs.cc',
'src/xml_attribute.cc',
'src/xml_document.cc',
'src/xml_element.cc',
'src/xml_namespace.cc',
'src/... | mit | Python | |
d2f265c01696695351aee4ee775a76056dfe80b8 | add unzip | akrherz/pyWWA,akrherz/pyWWA | unzip.py | unzip.py | """
Do the rotation action that some products need
$Id: $:
"""
import sys
import os
import gzip
if __name__ == '__main__':
# blah/file_
data = sys.stdin.read()
filename = sys.argv[1]
dirname = "/home/ldm/data/" + "/".join( filename.split("/")[:-1] )
if not os.path.isdir(dirname):
os.makedi... | mit | Python | |
f4506debefa4fbc7286876462966e7dac52c5f9f | Check the return value of SCardConnect() on a reader already used in SCARD_SHARE_EXCLUSIVE mode | vicamo/pcsc-lite-android,vicamo/pcsc-lite-android,vicamo/pcsc-lite-android,vicamo/pcsc-lite-android,vicamo/pcsc-lite-android | UnitaryTests/SCardExclusiveBehaviour.py | UnitaryTests/SCardExclusiveBehaviour.py | #!/usr/bin/env python
# Check the return value of SCardConnect() on a reader already used in
# SCARD_SHARE_EXCLUSIVE mode
# Copyright (c) 2010 Jean-Luc Giraud (jlgiraud@mac.com)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that th... | bsd-3-clause | Python | |
ba452d0bea5174b79a6ddbd0a2b8143b06b03c5e | Create pypi-test.py | PyThaiNLP/pythainlp | .github/workflows/pypi-test.py | .github/workflows/pypi-test.py | name: PyPI Unit test
on:
push:
paths-ignore:
- '**.md'
- 'docs/**'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@... | apache-2.0 | Python | |
194f45e45e09958a75235176af6e614eb60f9e6f | Create bottoken.py | nkbolg/p2p-chess-telebot,nkbolg/p2p-chess-telebot,nkbolg/p2p-chess-telebot | bottoken.py | bottoken.py | token = '123456789sampletoken'
| mit | Python | |
1394800c7c7bd62e0191cdb85612fa3066789424 | Add basic Slackbot script with reporting enabled | jleung51/scripts,jleung51/scripts,jleung51/scripts | weekday_greeting_slackbot.py | weekday_greeting_slackbot.py | #!/usr/bin/env python3
from slackclient import SlackClient
import json
import time
slack_token = ""
channel = ""
message = ""
report_slack_token = ""
report_channel = ""
report_slackbot_name = ""
report_alert_list = ""
def report_result(result):
if result.get("ok"):
report_message = ... | mit | Python | |
3660d8f4ffe6c0efd6b1b00af571e3c2cf0b8147 | Create WarpTo.py | lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples | src/Python/Filtering/WarpTo.py | src/Python/Filtering/WarpTo.py | #!/usr/bin/env python
import vtk
def main():
colors = vtk.vtkNamedColors()
# Create the RenderWindow, Renderer and both Actors
renderer = vtk.vtkRenderer()
renderWindow = vtk.vtkRenderWindow()
renderWindow.AddRenderer(renderer)
renderWindowInteractor = vtk.vtkRenderWindowInteractor()
render... | apache-2.0 | Python | |
e65641c7a2d944a39cf0cf4988d6b03e74a9712b | Add small example of sqlite FTS with compression. | coleifer/peewee,coleifer/peewee,coleifer/peewee | examples/sqlite_fts_compression.py | examples/sqlite_fts_compression.py | #
# Small example demonstrating the use of zlib compression with the Sqlite
# full-text search extension.
#
import zlib
from peewee import *
from playhouse.sqlite_ext import *
db = SqliteExtDatabase(':memory:')
class SearchIndex(FTSModel):
content = SearchField()
class Meta:
database = db
@db.fun... | mit | Python | |
5bf0dfbf166716ecc7fd82e1057f2d354bbf494d | Add HeadlessScraper | ransomwarezz/instagram-scraper | HeadlessScraper.py | HeadlessScraper.py | import mechanize
from DictUtils import listToDict
from Scraper import Scraper
import pprint
prettyPrinter = pprint.PrettyPrinter(indent=4,width=50)
class HeadlessScraper():
def __init__(self, username):
self.browser = mechanize.Browser()
self.browser.set_handle_robots(False)
self.baseUrl... | mit | Python | |
656da90f8acd1922a36725c35e60e45bc4f251ae | Update tests suite | TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker,TamiaLab/carnetdumaker | apps/staticpages/tests/test_sitemap.py | apps/staticpages/tests/test_sitemap.py | """
Tests suite for the sitemap of the static pages app.
"""
from django.test import SimpleTestCase
from django.core.urlresolvers import reverse
from ..sitemap import StaticPagesSitemap
class StaticPagesSitemapTestCase(SimpleTestCase):
"""
Tests suite for the sitemap of the static pages app.
"""
de... | """
Tests suite for the sitemap of the static pages app.
"""
from django.test import SimpleTestCase
from django.core.urlresolvers import reverse
from ..sitemap import StaticPagesSitemap
class StaticPagesSitemapTestCase(SimpleTestCase):
"""
Tests suite for the sitemap of the static pages app.
"""
de... | agpl-3.0 | Python |
40b7190d3b87c9318b4182c3d7106769c6ad45cb | Create lc1787.py | FiveEye/ProblemSet,FiveEye/ProblemSet | LeetCode/lc1787.py | LeetCode/lc1787.py | class Solution:
def minChanges(self, nums: List[int], m: int) -> int:
n = len(nums)
z = 2**10
s = [[] for _ in range(m)]
for i in range(n):
s[i % m].append(nums[i])
def keyfunc(s):
return len(set(s))
s.sort(key=keyfunc)
ss = [{} for _ i... | mit | Python | |
af5d262fecb7d1ac0d4f2710b22bece591ba5587 | Add checkver.py | rasa/scoops | checkver.py | checkver.py | #!/usr/bin/env python
from __future__ import print_function
import fnmatch
import json
import re
import os
import sys
specs = sys.argv
specs.pop(0)
if len(specs) == 0:
specs = ['*.json']
for file in os.listdir('.'):
accept = False
for spec in specs:
if fnmatch.fnmatch(file, spec):
a... | mit | Python | |
856785c535fa9ebcb1ba749a68d7846d8bb24d2e | Add script to test head behavior look at | bit-bots/bitbots_behaviour | bitbots_head_behavior/scripts/test_look_at.py | bitbots_head_behavior/scripts/test_look_at.py | #!/usr/bin/env python
from __future__ import print_function
import rospy
import tf2_ros as tf2
from bio_ik_msgs.msg import IKRequest, LookAtGoal
from bio_ik_msgs.srv import GetIK
from bitbots_ros_control.msg import JointCommand
from geometry_msgs.msg import Point
from time import sleep
from tf2_geometry_msgs import Poi... | bsd-3-clause | Python | |
df6fba6742e4fddfebd305a1ed624927f26e0f45 | Bump minor version (2.3.1 -> 2.4.0) | cloudendpoints/endpoints-python,inklesspen/endpoints-python,inklesspen/endpoints-python,cloudendpoints/endpoints-python | endpoints/__init__.py | endpoints/__init__.py | #!/usr/bin/python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | #!/usr/bin/python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | apache-2.0 | Python |
7ecd467e3670a552409e92e284046d1ac0a9a2c9 | Create Latency.py | rimpybharot/CMPE273 | Quiz1/Latency.py | Quiz1/Latency.py | import subprocess
import operator
ip_region_ip = {"us-east-1":"23.23.255.255",
"us-west-1":"13.56.63.251",
"eu-west-1":"34.240.0.253",
"ap-northeast-1":"13.112.63.251",
"us-west-2":"34.208.63.251",
"ap-northeast-2":"13.124.63.251",
... | mit | Python | |
f5b30b8872dd9d1c187435cb6d167c6cfb90b226 | Update test_flowlist.py | Kriechi/mitmproxy,Kriechi/mitmproxy,mhils/mitmproxy,vhaupert/mitmproxy,xaxa89/mitmproxy,StevenVanAcker/mitmproxy,mosajjal/mitmproxy,StevenVanAcker/mitmproxy,mhils/mitmproxy,laurmurclar/mitmproxy,vhaupert/mitmproxy,mosajjal/mitmproxy,ujjwal96/mitmproxy,mhils/mitmproxy,mitmproxy/mitmproxy,ddworken/mitmproxy,vhaupert/mitm... | test/mitmproxy/console/test_flowlist.py | test/mitmproxy/console/test_flowlist.py | import mitmproxy.tools.console.flowlist as flowlist
from mitmproxy.tools import console
from mitmproxy import proxy
from mitmproxy import options
from .. import tservers
import pytest
from unittest import mock
class ScriptError(Exception):
pass
def mock_add_log(message):
raise ScriptError(message)
class T... | import mitmproxy.tools.console.flowlist as flowlist
from mitmproxy.tools import console
from mitmproxy import proxy
from mitmproxy import options
from .. import mastertest
import pytest
from unittest import mock
class ScriptError(Exception):
pass
def mock_add_log(message):
raise ScriptError(message)
class... | mit | Python |
ed367255eb19106ae49a346e6bf65a1e49241384 | add char_cnn.py | yasfmy/chainer_charcnn | lib/char_cnn.py | lib/char_cnn.py | from math import ceil
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import import cuda
from chainer import import serializers
class BaseModel(chainer.Chain):
def use_gpu(self, gpu_id):
cuda.get_device(gpu_id).use()
self.to_gpu()
class CharCNN(BaseModel):
... | mit | Python | |
ebc88a28e2f8018b2887970bddb0423243ee8292 | Add template tag for debugging | BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway | src/core/templatetags/nose_tools.py | src/core/templatetags/nose_tools.py | from nose import tools
from django import template
register = template.Library()
class NoseNode(template.Node):
def render(self, context):
tools.set_trace() # Debugger will stop here
return ''
@register.tag
def set_trace(parser, token):
return NoseNode()
| agpl-3.0 | Python | |
149f070972d4b1850de4d8005f4aff3c373f7ca7 | create url for detail view with slug | noxan/django-mini-cms | cms/urls.py | cms/urls.py | from django.conf.urls import patterns, include, url
from views import PageDetailView
urlpatterns = patterns('',
url(r'^(?P<slug>[a-zA-Z0-9]+)/$', PageDetailView.as_view(), name='page'),
)
| bsd-3-clause | Python | |
8668f8979d28f4378e208250b79668adeea0e6b7 | ADD merge version alembic | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | packages/grid/backend/alembic/versions/2021-10-02_1bdbdf7f26ce.py | packages/grid/backend/alembic/versions/2021-10-02_1bdbdf7f26ce.py | """Merge commit
Revision ID: 1bdbdf7f26ce
Revises: 239c5dd652ba, 886589613d4d
Create Date: 2021-10-02 00:13:27.177662
"""
# third party
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "1bdbdf7f26ce"
down_revision = ("239c5dd652ba", "886589613d4d")
branch_labels = No... | apache-2.0 | Python | |
6fdebbe95b4f06b71e8a6db4b86e49c515a55359 | Add indexes | Ilhasoft/ureport,Ilhasoft/ureport,Ilhasoft/ureport,rapidpro/ureport,rapidpro/ureport,Ilhasoft/ureport,rapidpro/ureport,rapidpro/ureport | ureport/stats/migrations/0004_add_indexes.py | ureport/stats/migrations/0004_add_indexes.py | # Generated by Django 2.2.5 on 2019-10-11 14:11
from django.db import migrations
# language=SQL
INDEX_SQL_CONTACTACTIVITY_ORG_DATE_GENDER = """
CREATE INDEX CONCURRENTLY IF NOT EXISTS stats_contactactivity_org_id_date_gender
on stats_contactactivity (org_id, date, gender);
"""
# language=SQL
INDEX_SQL_CONTACTACTIV... | agpl-3.0 | Python | |
6740f5b1ccd1e1f4d9788cb3438bd2f9ec55365b | Add slim wrapper for notifications | opatut/i3pystatus,drwahl/i3pystatus,juliushaertl/i3pystatus,yang-ling/i3pystatus,MaicoTimmerman/i3pystatus,m45t3r/i3pystatus,enkore/i3pystatus,paulollivier/i3pystatus,m45t3r/i3pystatus,plumps/i3pystatus,ncoop/i3pystatus,Arvedui/i3pystatus,asmikhailov/i3pystatus,onkelpit/i3pystatus,asmikhailov/i3pystatus,teto/i3pystatus... | i3pystatus/core/desktop.py | i3pystatus/core/desktop.py |
from gi.repository import Notify
if not Notify.init("i3pystatus"):
raise ImportError("Couldn't initialize libnotify")
URGENCY_LUT = (
Notify.Urgency.LOW,
Notify.Urgency.NORMAL,
Notify.Urgency.CRITICAL,
)
# List of some useful icon names:
# battery, battery-caution, battery-low
# …
def display_notif... | mit | Python | |
dde936f7d28d41dcd9557e2f03de3bfeac0e1e41 | Create Sweety_motors_test.py | mecax/pyrobotlab,MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,mecax/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/beetlejuice/Sweety_motors_test.py | home/beetlejuice/Sweety_motors_test.py | # Sweety's motors test
import random
Runtime.createAndStart("sweety", "Sweety")
sweety.arduino.setBoard("atmega2560")
sweety.connect("COM8")
sleep(1) # give a second to the arduino for connect
sweety.attach()
sweety.posture("neutral")
sweety.mouthState("smile")
sleep(1)
joystick = runtime.createAndStart("joystick","J... | apache-2.0 | Python | |
c893166b19330b3bb4cdc0ea4365152d1489a319 | add solution for Valid Anagram | zhyu/leetcode,zhyu/leetcode | algorithms/validAnagram/validAnagram.py | algorithms/validAnagram/validAnagram.py | class Solution:
# @param {string} s
# @param {string} t
# @return {boolean}
def isAnagram(self, s, t):
return collections.Counter(s) == collections.Counter(t)
| mit | Python | |
c7313c7c4704bad7b9ef9a639d633d19bfb1235c | add a test for resuming started queries | ceb8/astroquery,imbasimba/astroquery,ceb8/astroquery,imbasimba/astroquery | astroquery/tests/test_resume.py | astroquery/tests/test_resume.py | import string
import requests
from astropy.tests.helper import remote_data
from .. import query
def test_resume():
# Test that a resumed query will finish
length = 2048
# 'range' will return abcd...xyz repeating
target_url = 'http://127.0.0.1:5000/range/{0}'.format(length)
# simple check: make ... | bsd-3-clause | Python | |
2afc2bafa8ea5836dd58b2e158e7fb5d1935161d | Add LinearBN and MLPBN | toslunar/chainerrl,toslunar/chainerrl | links/mlp_bn.py | links/mlp_bn.py | from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from builtins import super
from builtins import range
from future import standard_library
standard_library.install_aliases()
import random
import numpy as np
import chain... | mit | Python | |
ded62d97d9e8ebe52708e0723a85735efd9f91b2 | Add neurons super class | synergetics/neuron | src/neurons/neurons.py | src/neurons/neurons.py |
import numpy as np
import logging as log
import uuid
from synergetics.config import config as cfg
from synergetics.learning.default import Default as Default_update
from synergetics.networks.default import Default as Default_discovery
class Neuron(object):
def __init__(self, position, excitatory=True,
... | mit | Python | |
b8c7fa096982a7a3c1c9e10d6558127048ab00fa | Add driver that only installs salt, on an existing machine | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | saltcloud/clouds/saltify.py | saltcloud/clouds/saltify.py | '''
Saltify Module
==============
The Saltify module is designed to install Salt on a remote machine, virtual or
bare metal, using SSH. This module is useful for provisioning machines which
are already installed, but not Salted.
Use of this module requires no configuration in the main cloud config file.
However, profi... | apache-2.0 | Python | |
8b9b3a63b23cc4cd8328594c1569ea80b3f01b63 | add class example | Instanssi/effectserver | examples/instanssi.py | examples/instanssi.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import socket
import time
class Instanssi(object):
def __init__(self, nick, ip, port):
self.ip = ip
self.port = port
self.nick = nick
self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.reset()
def reset(self... | mit | Python | |
319d95404df7d4c9e97ee81585de0668bb1037fc | Add Logistic Regression example. | drsstein/PyRat | Examples/LogisticRegression.py | Examples/LogisticRegression.py | # short lecture on learning logistic neurons by Geoffrey Hinton:
# https://www.youtube.com/watch?v=--_F0rbPH9M
import math
import matplotlib.pyplot as plt
import numpy as np
def run():
#generate n samples of random 2d data from each class
n = 100
x_pos = np.random.randn(2, n)
y_pos = np.ones(n)
x... | mit | Python | |
4142ed567f5300cb2f85f0558452ed025b4bcd7c | Make It Anagram | tejasnikumbh/Algorithms,tejasnikumbh/Algorithms,tejasnikumbh/Algorithms | ArraysAndSorting/TwoArrays.py | ArraysAndSorting/TwoArrays.py | # Importing standard libraries
import sys
'''
Main function for the program.
'''
if __name__ == "__main__":
t = int(sys.stdin.readline().rstrip())
for i in range(t):
[size,k] = [int(x) for x in sys.stdin.readline().rstrip().split()]
a = [int(x) for x in sys.stdin.readline().rstrip().split()]
... | bsd-2-clause | Python | |
2060b7d4669a007e2ed36f1c4e7158a12c5fa576 | Disable robohornet pro because it is broken on Android. | M4sse/chromium.src,ondra-novak/chromium.src,hgl888/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,dushu1203/chromium.src,jaruba/chromium.src,M4sse/chromium.src,axinging/chromium-crosswalk,axinging/chromium-crosswalk,bright-sparks/chromium-spacewalk,Pluto-tv/chromium-crosswalk,ltilve/chromium,littlstar/chromium.sr... | tools/perf/benchmarks/robohornet_pro.py | tools/perf/benchmarks/robohornet_pro.py | # Copyright (c) 2012 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.
"""Runs Microsoft's RoboHornet Pro benchmark."""
import os
from metrics import power
from telemetry import test
from telemetry.page import page_measure... | # Copyright (c) 2012 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.
"""Runs Microsoft's RoboHornet Pro benchmark."""
import os
from metrics import power
from telemetry import test
from telemetry.page import page_measure... | bsd-3-clause | Python |
a7b96d80086215fcf0b01b486576bd489a32c791 | Apply SA naming convention | ThiefMaster/indico-plugins,indico/indico-plugins,ThiefMaster/indico-plugins,indico/indico-plugins,ThiefMaster/indico-plugins,indico/indico-plugins,indico/indico-plugins,ThiefMaster/indico-plugins | livesync/indico_livesync/migrations/201503101351_5a9176bca07d_apply_naming_convention.py | livesync/indico_livesync/migrations/201503101351_5a9176bca07d_apply_naming_convention.py | """Apply naming convention
Revision ID: 5a9176bca07d
Revises: 1c2b0e17447d
Create Date: 2015-03-10 13:51:26.353667
"""
from alembic import op
from indico.core.db.sqlalchemy.util.bulk_rename import bulk_rename
# revision identifiers, used by Alembic.
revision = '5a9176bca07d'
down_revision = '1c2b0e17447d'
mappin... | mit | Python | |
1549ddf1fa3d0c612ee45c11b3ef1fe3185add61 | ADD test sample code | chocopy-telco/EmptyRoomCheck,chocopy-telco/EmptyRoomCheck | sample_code/light_sensor.py | sample_code/light_sensor.py | #!/usr/bin/env python
# Example for RC timing reading for Raspberry Pi
# Must be used with GPIO 0.3.1a or later - earlier verions
# are not fast enough!
import RPi.GPIO as GPIO, time, os
DEBUG = 1
GPIO.setmode(GPIO.BCM)
def RCtime (RCpin):
reading = 0
GPIO.setup(RCpin, GPIO.OUT)
GP... | mit | Python | |
bef2d17d172e30fb6b6a5a1c45799ea20f406078 | Create addingBinary.py | NendoTaka/CodeForReference,NendoTaka/CodeForReference,NendoTaka/CodeForReference | CodeWars/6kyu/addingBinary.py | CodeWars/6kyu/addingBinary.py | def btoi(a):
x = 0
for i in xrange(len(a)):
if a[i] == '1':
x += 2 ** i
return x
def itob(a):
if a == 0:
return '0'
x = ''
while a > 0:
if a % 2 == 1:
x += '1'
else:
x += '0'
a /= 2
return x[::-1]
def add(a,b):
x = btoi(a[::-1])
y = btoi(b[::-1])
z = x + y
return itob(z)
| mit | Python | |
a50c7f2e61d47b8ffca642c03248e72486bd7ecd | Add test script for #i319 smif prepare-convert functionality | tomalrussell/smif,tomalrussell/smif,nismod/smif,nismod/smif,tomalrussell/smif,nismod/smif,nismod/smif,tomalrussell/smif | src/smif/sample_project/test_convert.py | src/smif/sample_project/test_convert.py | from smif import cli
from argparse import ArgumentParser
from smif.data_layer.file import (CSVDataStore, FileMetadataStore,
ParquetDataStore, YamlConfigStore)
arguments = ['prepare-convert', 'energy_central']
parser = cli.parse_arguments()
args = parser.parse_args(arguments)
print... | mit | Python | |
80697488443f8e86047cbe9baaebd85e52d3297a | Create D3_viz.py | BillmanH/Personal-Finance,BillmanH/Personal-Finance | D3_viz.py | D3_viz.py | #These are the packages that I used:
import pandas as pd
import numpy as np
import json
#Step one getting the data:
#specify my working directory:
path = "C:\Users\BillsComputer\Finance\{}"
#I put it in this way so that I could just add CSV files as they come in.
myfiles = ["transactions2014.csv",
"transactions201... | mit | Python | |
56319a8562d10b43189ffa968b5ecc477f50a6c9 | Add a basic avg example | kpraveen420/learning-spark,mmirolim/learning-spark,shimizust/learning-spark,jindalcastle/learning-spark,JerryTseng/learning-spark,GatsbyNewton/learning-spark,tengteng/learning-spark,tengteng/learning-spark,feynman0825/learning-spark,SunGuo/learning-spark,bhagatsingh/learning-spark,baokunguo/learning-spark-examples,diog... | src/python/BasicAvg.py | src/python/BasicAvg.py | """
>>> from pyspark.context import SparkContext
>>> sc = SparkContext('local', 'test')
>>> b = sc.parallelize([1, 2, 3, 4])
>>> basicAvg(b)
2.5
"""
import sys
from pyspark import SparkContext
def basicAvg(nums):
"""Compute the avg"""
sumCount = nums.map(lambda x: (x,1)).fold((0, 0), (lambda x, y: (x[0] + y[... | mit | Python | |
5dc6e65c013fbfacd3317986c7b18f2e1a963f4f | Add solid_pde.py | jnez71/demos,jnez71/demos | solid_pde.py | solid_pde.py | #!/usr/bin/env python3
"""
Solving a PDE that models finite-strain elastic solids.
"""
import numpy as np
import pygame
################################################## DOMAIN
# Extent of space and time
lx = 1.0
ly = 1.0
lt = np.inf
# Discretization of space and time
dx = 0.01
dy = 0.01
dt = 0.005
# Space and ti... | mit | Python | |
19d792a6a40edd1593dcf11103d81e9653be643c | create new model trial | imwiththou/PathwayNet | Glucose.Hexokinase/GlucoseNew.py | Glucose.Hexokinase/GlucoseNew.py | #new model
import ode
#Glucose
glucose_vmax = 0.0
glucose_rate = 1e-07
glucose_km = 1e-07
glucose_gamma = 0.0
#Hexokinase
hexokinase_vmax = 0.0
hexokinase_rate = 1e-07
hexokinase_km = 1e-07
hexokinase_gamma = 0.0
#G6P
G6P_vmax = 0.0
G6P_rate = 1e-07
G6P_km = 1e-07
G6P_gamma = 0.0
#Phosphoglucoisomerase
Phospho... | mit | Python | |
557eb6ecf87da2c3c8f2947e40bfcaf0d367de0c | test for model saving/loading | analysiscenter/dataset | batchflow/tests/model_save_load_test.py | batchflow/tests/model_save_load_test.py | """ Test for model saving and loading """
import pytest
import numpy as np
from batchflow import Pipeline, ImagesBatch, Dataset
from batchflow import B, V, C
from batchflow.models.tf import VGG7 as TF_VGG7
# TODO Extract to utilities
# @pytest.fixture()
def model_setup():
""" Pytest fixture to generate fake da... | apache-2.0 | Python | |
fc54300b0d306fd020fe2419bd123a8df0ff35e2 | Delete dicts. | vsemionov/wordbase | src/tools/del_pgsql.py | src/tools/del_pgsql.py | #!/usr/bin/env python3
# Copyright (C) 2011 Victor Semionov
# 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 | |
84d19f2a91cae72085c2299e94bbb402a383d311 | add local subprocess server script to bin | genome/flow-core,genome/flow-core,genome/flow-core | bin/local_subprocess_service.py | bin/local_subprocess_service.py | #!/usr/bin/env python
import logging
import os
from amqp_service import ConnectionManager, AMQPService, dispatcher, responder
LOG_LEVEL = logging.DEBUG
LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) '
'-35s %(lineno) -5d: %(message)s')
LOG = logging.getLogger()
if '__main__' == ... | agpl-3.0 | Python | |
c609c9d4342161d2fe8de8ec94293e7551ecb546 | Add files via upload | ngokchaoho/Amazon-Ratings-and-Reviews,ngokchaoho/Amazon-Ratings-and-Reviews | Amazon.py | Amazon.py | '''
Created on 20 Jan 2017
@author: Yuezhou He (John)
'''
def p2f(x):
return float(x.strip('%'))/100
def ratings(Product_ID):
import requests
page_param=''.join(("contextId=dpx&asin=",Product_ID))
page=requests.get("https://www.amazon.com/gp/customer-reviews/widgets/average-customer-review/popover/ref... | mit | Python | |
d53c5b956ea0fb78706923de9bdf2227a78dc834 | Create 0000.py | Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python | Liez-python-code/0000/0000.py | Liez-python-code/0000/0000.py |
from PIL import Image, ImageDraw, ImageFont
def add_num():
im = Image.open('in.jpg')
xsize, ysize = im.size
draw = ImageDraw.Draw(im)
font = ImageFont.truetype("arial.ttf", xsize // 3)
draw.text((ysize // 5 * 4, 0), '3', (250,128,114), font)
im.save('out.jpg')
add_num()
| mit | Python | |
0adbbdd146f9f7b8050f2cfe9aab068e7a18d0de | Create ipc_lista1.14.py | any1m1c/ipc20161 | lista1/ipc_lista1.14.py | lista1/ipc_lista1.14.py | apache-2.0 | Python | ||
11ddda875e7cde871cce0bda17d0d2e8ac576758 | Add x86helper module | programa-stic/barf-project,programa-stic/barf-project | barf/arch/x86/x86helper.py | barf/arch/x86/x86helper.py | # Copyright (c) 2017, Fundacion Dr. Manuel Sadosky
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of condit... | bsd-2-clause | Python | |
5fe6d3e499a463594e4ba7a5b4b312971b56da9a | Add script which extracts subset of birdclef | johnmartinsson/bird-species-classification,johnmartinsson/bird-species-classification | birdclef.py | birdclef.py | import numpy as np
np.random.seed(42)
import xml.etree.ElementTree as ET
import glob
import csv
import os
xml_paths = glob.glob("datasets/birdClef2016/xml/*.xml")
xml_roots = [ET.parse(f) for f in xml_paths]
root2path = {}
species_count = {}
for r in xml_roots:
species = r.find("Species").text
if species in... | mit | Python | |
c72f649616239cf46d475486590d9923589cda5e | Add code to convert `git blame` to JSON | tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes | src/utils/code_etl/blame_to_json.py | src/utils/code_etl/blame_to_json.py | #!/usr/bin/env python
"""
"""
from subprocess import check_output
import json
from copy import deepcopy
# The JSON object to
JSON_LINE = {
"repo_name": None,
"commit_id": None,
"author": None,
"author_mail": None,
"author_time": None,
"author_timezone": None,
"committer": None,
"commi... | apache-2.0 | Python | |
25d76f60fe94a0e467c47d8cb184f110118c0f43 | Add secure cell python wrapper | Lagovas/themis,Lagovas/themis,mnaza/themis,Lagovas/themis,storojs72/themis,storojs72/themis,cossacklabs/themis,mnaza/themis,Lagovas/themis,mnaza/themis,Lagovas/themis,cossacklabs/themis,mnaza/themis,storojs72/themis,storojs72/themis,Lagovas/themis,cossacklabs/themis,cossacklabs/themis,mnaza/themis,Lagovas/themis,cossac... | src/wrappers/themis/python/scell.py | src/wrappers/themis/python/scell.py | import exception;
from ctypes import *
themis = cdll.LoadLibrary('./libthemis.so')
class scell_full(object):
def __init__(self, key_):
self.key=key_;
def encrypt(self, message):
encrypted_message_length=c_int(0);
if themis.themis_secure_cell_encrypt_full(self.key ,len(self.key), message, len(message), None... | apache-2.0 | Python | |
6c81b75704a2aba7cc8c8477a8ff90cf0d3e209e | Add files via upload | lolodo/algorithm,lolodo/algorithm,lolodo/algorithm,lolodo/algorithm,lolodo/algorithm,lolodo/algorithm | python/greedy_algo.py | python/greedy_algo.py | def find_best_stations(needed, states):
all_names = set()
while needed:
joint = set()
saved = set()
names = None
for name, serial in states.items():
joint = serial & needed
if len(joint) > len(saved):
saved = joint
... | lgpl-2.1 | Python | |
797144c0c45f28d3cdd7c6f396b199985039c91c | add coroutine | AlexWoo/pyed | pyworker/corouting.py | pyworker/corouting.py | import traceback
class coroutine(object):
def __init__(self, log, func, *args):
self._log = log
self._state = "init"
try:
self._gen = func(*args)
except:
self._log.logError("Corouting", "Spawn func failed: %s",
traceback.format_exc())
... | bsd-2-clause | Python | |
a35495b81803064be0f71ab154c4d25622634530 | Validate user create request | projectweekend/Falcon-PostgreSQL-API-Seed,projectweekend/Falcon-PostgreSQL-API-Seed | app/user/validation.py | app/user/validation.py | import falcon
from cerberus import Validator
def validate_user_create(req, res, resource, params):
schema = {
'email': {
'type': 'string',
'regex': '^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$',
'required': True
},
'password': {
'type': ... | mit | Python | |
972e00ceaaebca0ee7f6618a50d65901f31d126a | Add urwid-based TUI module | khardix/mccurse | mccurse/tui.py | mccurse/tui.py | """Interactive text user interface parts."""
import curses
from typing import Callable, Sequence, Iterable, Optional
import urwid
from .curse import Mod
#: Signature of valid menu callbacks
ModItemCallback = Callable[[Mod, urwid.Button], None]
class ModMenu(urwid.ListBox):
"""Menu presenting a choice from a ... | agpl-3.0 | Python | |
8003a4b4b2aaaaba54570f670c7a5df93fe8434d | Add specific tests for compression. | vortec/pykafka,benauthor/pykafka,yungchin/pykafka,aeroevan/pykafka,sammerry/pykafka,thedrow/samsa,wikimedia/operations-debs-python-pykafka,tempbottle/pykafka,yungchin/pykafka,thedrow/samsa,wikimedia/operations-debs-python-pykafka,jofusa/pykafka,thedrow/samsa,jofusa/pykafka,appsoma/pykafka,vortec/pykafka,appsoma/pykafka... | tests/pykafka/utils/test_compression.py | tests/pykafka/utils/test_compression.py | import unittest2
from pykafka.utils import compression
class CompressionTests(unittest2.TestCase):
"""Keeping these simple by verifying what goes in is what comes out."""
text = "The man in black fled across the desert, and the gunslinger followed."
def test_gzip(self):
encoded = compression.enco... | apache-2.0 | Python | |
a89a9bfb788718b233d8cc98d3b943b97f1a6cc9 | add code file | ericfourrier/pandas-patch | pandas_patch.py | pandas_patch.py | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 4 00:34:33 2015
@author: efourrier
"""
from pandas import Dataframe
| mit | Python | |
6eca5cd06da3a195f226d2b864b8af41b62bda45 | Create the top-down longestPath with optimization | Chasego/codi,Chasego/cod,Chasego/codirit,Chasego/codirit,Chasego/codirit,Chasego/codirit,cc13ny/algo,Chasego/codi,cc13ny/Allin,cc13ny/algo,cc13ny/algo,Chasego/cod,Chasego/cod,cc13ny/algo,cc13ny/Allin,cc13ny/algo,cc13ny/Allin,Chasego/codi,Chasego/codi,cc13ny/Allin,Chasego/codirit,Chasego/cod,Chasego/codi,Chasego/cod,cc1... | kargtom/twodim/LongestChain/longestChain_002.py | kargtom/twodim/LongestChain/longestChain_002.py | def longestChain(words):
lendict = {}
lenlist = []
# build the dictory where
# the key is the length of a word,
# and the value is the set of words with the length
for word in words:
l = len(word)
if len(word) in lendict:
lendict[l][word] = -1
else:
... | mit | Python | |
992dfde7576e64dacee0f096598b80f879a9b198 | Add log_scale snippet for matplotlib. | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | matplotlib/log_scale.py | matplotlib/log_scale.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(1000)
y = x * x
plt.plot(x, y)
plt.yscale('log')
plt.title('x^2')
plt.show()
| mit | Python | |
08ef58fec7f872db5d8536608ebc622c3b4f10ab | Add an example that shows the impact of using the spread of orientation angles. | dopplershift/Scattering | test/compare_angles.py | test/compare_angles.py | import matplotlib.pyplot as plt
import numpy as np
import scattering, dsd
import scipy.constants as consts
db_factor = 10.0 * np.log10(np.e)
ref_adjust = 180
def plot_csec(scatterer, l, var, name):
plt.plot(l, var, label = '%.1f cm' % (scatterer.wavelength / consts.centi))
plt.xlabel('Rain Content (g m^-3)')
... | bsd-2-clause | Python | |
9e0d0b6d615ff626798012c6c008fb7e391e7089 | test for issue 1761 | RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib | test/test_issue1761.py | test/test_issue1761.py | import sys
def test_stderr_is_none():
"""
Issue 1761 - Issues with installing rdflib
Due to standard input/output overwrites, there is possibility that `sys.stderr.isatty`
raises `AttributeError`. So it should be checked before executing.
"""
sys.stderr = None
import rdflib
| bsd-3-clause | Python | |
a906d3523bb9d6a1ca233a9d5e0e33c477c96e60 | Add some basic unit tests for functions with no dependencies | embaldridge/retriever,bendmorris/retriever,goelakash/retriever,embaldridge/retriever,henrykironde/deletedret,davharris/retriever,henrykironde/deletedret,goelakash/retriever,bendmorris/retriever,davharris/retriever,davharris/retriever,bendmorris/retriever,embaldridge/retriever | test/test_retriever.py | test/test_retriever.py | """Tests for the EcoData Retriever"""
from StringIO import StringIO
from engine import Engine
def test_escape_single_quotes():
"""Test escaping of single quotes"""
test_engine = Engine()
assert test_engine.escape_single_quotes("1,2,3,'a'") == "1,2,3,\\'a\\'"
def test_escape_double_quotes():
"""Test e... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.