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 |
|---|---|---|---|---|---|---|---|---|
17654378a6039203ead1c711b6bb8f7fb3ad8680 | add Ermine ELF dumper. | ccpgames/mumble-releng,ccpgames/mumble-releng | tools/dump-ermine-elfs.py | tools/dump-ermine-elfs.py | #!/usr/bin/env python
#
# Copyright (C) 2013 Mikkel Krautz <mikkel@krautz.dk>
#
# 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 copyrig... | bsd-3-clause | Python | |
4a1e46d279df1d0a7eaab2ba8175193cd67c1f63 | Add some template filters: sum, floatformat, addslashes, capfirst, stringformat (copied from django), dictsort, get, first, join, last, length, random, sort. Needed to write tests for all those filters | GrAndSE/lighty-template,GrAndSE/lighty | lighty/templates/templatefilters.py | lighty/templates/templatefilters.py | '''Package contains default template tags
'''
from decimal import Decimal, ROUND_DOWN
import random as random_module
from filter import filter_manager
# Numbers
def sum(*args):
'''Calculate the sum of all the values passed as args and
'''
return reduce(lambda x, y: x + float(y), args)
filter_manager.reg... | bsd-3-clause | Python | |
654e2bf70b4a47adb53d8a0b17f0257e84c7bdf8 | read in data, check things look sensible. Note: need to change unknowns in group col so we have a more usable data type in the pandas dataframe. | bourbonspecial/challenge | main.py | main.py | # Data modelling challenge.
__author__ = 'Remus Knowles <remknowles@gmail.com>'
import pandas as pd
F_DATA = r'data challenge test.csv'
def main():
df = pd.read_csv(F_DATA)
print df.head()
if __name__ == '__main__':
main() | mit | Python | |
0046f5276c9572fbc40080cc2201a89ee37b96b2 | Create mwis.py | sbugrov/biutils_PY | mwis.py | mwis.py | weights = [int(l) for l in open('mwis.txt')][1:]
def mwis(weights):
n = len(weights)
weights = [0] + weights
maxsetweight = [0, weights[1]]
for i in range(2, n + 1):
maxsetweight.append(max(maxsetweight[i - 1], maxsetweight[i - 2] + weights[i] ))
i = n
maxset = []
while i > 1:... | mit | Python | |
837382f44d91a44c14884f87c580b969e5ef5a4a | add example for tensorboard | gundramleifert/exp_tf | models/toyexample_03_tensorboard.py | models/toyexample_03_tensorboard.py | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True, reshape=False, validation_size=0)
K = 200
L = 100
M = 60
N = 30
# initialization
X = tf.placeholder(tf.float32, [None, 28, 28, 1])
# placeholder for correct answers
Y_ = t... | apache-2.0 | Python | |
572a47ab8b05f8e93ec5e1b415cb56387d4279ca | add m_restart.py | sunqm/pyscf,gkc1000/pyscf,sunqm/pyscf,sunqm/pyscf,gkc1000/pyscf,gkc1000/pyscf,sunqm/pyscf,gkc1000/pyscf,gkc1000/pyscf | pyscf/nao/m_restart.py | pyscf/nao/m_restart.py |
#An HDF5 file is a container for two kinds of objects: datasets (array-like collections of data), and groups (folder-like containers that hold datasets).
#Groups work like dictionaries, and datasets work like NumPy arrays
def read_rst_h5py (filename=None):
import h5py ,os
if filename is None:
path = ... | apache-2.0 | Python | |
a0c303e9c1f7ac75e078e6f3ae9586ba68a24f63 | add the solution | markshao/leetcode,markshao/leetcode | python/oj/mergeSort.py | python/oj/mergeSort.py | #!/usr/bin/python
# coding:utf8
'''
@author: shaoyuliang
@contact: mshao@splunk.com
@since: 7/16/14
'''
# https://oj.leetcode.com/problems/merge-sorted-array/
class Solution:
# @param A a list of integers
# @param m an integer, length of A
# @param B a list of integers
# @param n an integer, len... | apache-2.0 | Python | |
863ec839e24f2f17ba9d1dfb1177592f34cfc5e3 | Create Transaction.py | ojosipeayo/pythonVogue | pyvogue/Transaction.py | pyvogue/Transaction.py |
import requests
import json
import urllib
class Transaction():
def getall(self,trx,res,decode_content=False):
"""
Gets all your transactions
args:
trx -- the transaction id to be fetched
res -- the response type expected : json or xml
"""
url ... | mit | Python | |
3ae0ea21cc6b1afadb0dd72e29016385d18167ab | Add FifoReader class to utils | xtaran/debian-devel-changes-bot,lamby/debian-devel-changes-bot,lamby/debian-devel-changes-bot,xtaran/debian-devel-changes-bot,sebastinas/debian-devel-changes-bot,lamby/debian-devel-changes-bot | DebianDevelChangesBot/utils/fiforeader.py | DebianDevelChangesBot/utils/fiforeader.py | # -*- coding: utf-8 -*-
#
# Debian Changes Bot
# Copyright (C) 2008 Chris Lamb <chris@chris-lamb.co.uk>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the... | agpl-3.0 | Python | |
5c3304ffbd78ee47b2c4d197165de08200e77632 | Fix the `week` behavour to match api2 | willkg/standup,rlr/standup,mozilla/standup,willkg/standup,mozilla/standup,safwanrahman/standup,mozilla/standup,rehandalal/standup,rlr/standup,rehandalal/standup,willkg/standup,rlr/standup,safwanrahman/standup,mozilla/standup,safwanrahman/standup,rehandalal/standup,safwanrahman/standup,willkg/standup | standup/apps/status/helpers.py | standup/apps/status/helpers.py | import re
from datetime import date, datetime, timedelta
from standup.database.helpers import paginate as _paginate
def paginate(statuses, page=1, startdate=None, enddate=None, per_page=20):
from standup.apps.status.models import Status
if startdate:
statuses = statuses.filter(Status.created >= start... | import re
from datetime import date, datetime, timedelta
from standup.database.helpers import paginate as _paginate
def paginate(statuses, page=1, startdate=None, enddate=None, per_page=20):
from standup.apps.status.models import Status
if startdate:
statuses = statuses.filter(Status.created >= start... | bsd-3-clause | Python |
6e096fc10c7eb580ec11fbee585dd2aa3210e2b3 | add settings example | colbypalmer/cp-blog,colbypalmer/cp-blog | blog/settings_example.py | blog/settings_example.py | SITE_URL = "http://project.com"
SITE_NAME = "Project Name"
COMMENTS_APP = 'threadedcomments' # for example
RECAPTCHA_PUBLIC_KEY = 'put-your-key-here'
RECAPTCHA_PRIVATE_KEY = 'put-your-key-here'
SOUTH_MIGRATION_MODULES = {
'taggit': 'taggit.south_migrations',
}
TAGGIT_TAGCLOUD_MIN = 1
TAGGIT_TAGCLOUD_MAX = 8
GRA... | mit | Python | |
edfba32b5dd24c0fe58da9bbbe84267e81754233 | add demo.py | maliubiao/chrome_remote_debugger | demo.py | demo.py | import pdb
import json
from pprint import pprint
from chrome_debugger import protocol
from chrome_debugger import interface
from chrome_debugger import websocket
context = protocol.connect("ws://localhost:9222/devtools/page/D08C4454-9122-6CC8-E492-93A22F9C9727")
header = websocket.parse_response(context["sock"].recv(... | mit | Python | |
863ae7a76567913f60a758a9fb974a27e9bc58d2 | add 21 | ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler | p021.py | p021.py | from utils import divisors
def d(n):
return sum(divisors(n))
print sum(filter(lambda n: n != d(n) and n == d((d(n))), range(1, 10000))) | bsd-3-clause | Python | |
a3a92435781300966ca59d5316693d0306abd600 | Create osrm_OD_matrix.py | jamaps/fun_with_gdal,jamaps/open_geo_scripts,jamaps/open_geo_scripts,jamaps/open_geo_scripts,jamaps/fun_with_gdal,jamaps/gdal_and_ogr_scripts,jamaps/gdal_and_ogr_scripts,jamaps/shell_scripts,jamaps/shell_scripts | osrm_OD_matrix.py | osrm_OD_matrix.py | # using osrm to create a big dirty OD matrix
import csv
import requests
import polyline
import time
import json
db_points = []
# grab points from csv file - just grab, x, y, and a unique ID
# the headers may be different depending on your data!
with open("db.csv", 'r') as csvfile:
reader = csv.DictReader(csvfile... | mit | Python | |
41a533ffddfebc3303a1e882bfaf1fcdd243828e | add api like test | dubirajara/django_my_ideas_wall,dubirajara/django_my_ideas_wall,dubirajara/django_my_ideas_wall,dubirajara/django_my_ideas_wall | myideas/core/tests/test_like_api.py | myideas/core/tests/test_like_api.py | from django.test import TestCase
from django.test.client import Client
from django.shortcuts import resolve_url as r
from django.contrib.auth.models import User
from myideas.core.models import Ideas
class LikeApiTest(TestCase):
def setUp(self):
self.client = Client()
self.username = 'diego'
... | agpl-3.0 | Python | |
10c19d0c7d7cdb2c823a698db8ca128134f32c5a | Add beam potential generation | ghallsimpsons/optical_tweezers | otz/Beam.py | otz/Beam.py | import pdb
import numpy as np
import scipy as sp
h = 6.626E-34
c = 3.0E8
def uniform(max_angle, intensity):
def profile(phi):
if (abs(phi) < max_angle):
return intensity
else:
return 0
return profile
def default_profile(angle):
return uniform(np.pi/8.0, 1)(angle)
... | unlicense | Python | |
ad5018c045a14f2e8360e8118d73d021df10baab | add solution for Course Schedule II | zhyu/leetcode,zhyu/leetcode | algorithms/courseScheduleII/courseScheduleII.py | algorithms/courseScheduleII/courseScheduleII.py | class Solution:
# @param {integer} numCourses
# @param {integer[][]} prerequisites
# @return {integer[]}
def findOrder(self, numCourses, prerequisites):
g = {v: [] for v in xrange(numCourses)}
deg = {v: 0 for v in xrange(numCourses)}
s = set(range(numCourses))
for u, v in... | mit | Python | |
4557cce84ff91e830f1f1fd241223cff70ceb46e | add directions and a script for how I found duplicate functions | rhansen/rpstir,rhansen/rpstir,rhansen/rpstir,rhansen/rpstir,rhansen/rpstir | deprecated/utils/tags-to-dup-functions.py | deprecated/utils/tags-to-dup-functions.py | # Run the below command to generate the TAGS file, then run this script with TAGS as stdin to see duplicate function names
#
# find . -name \*.c -not -path ./deprecated/\* -print0 | xargs -0 etags --declarations -D --no-globals -I --no-members
import collections
import sys
src_file = None
got_section_header = 0
# fu... | bsd-3-clause | Python | |
4331b380e43751a7223e0ee1dee6c1c45ad09a67 | add levy function | aaronkl/RoBO,numairmansur/RoBO,automl/RoBO,aaronkl/RoBO,automl/RoBO,numairmansur/RoBO,aaronkl/RoBO | robo/task/levy.py | robo/task/levy.py | '''
Created on 12.07.2015
@author: Aaron Klein
'''
import numpy as np
from robo.task.base_task import BaseTask
class Levy(BaseTask):
def __init__(self):
X_lower = np.array([-15])
X_upper = np.array([10])
opt = np.array([[1.0]])
fopt = 0.0
super(Levy, self).__init__(X_low... | bsd-3-clause | Python | |
f2c6e7cf6e60eac5222658d89baf28e1e7d12939 | Test minimal snoop2 | lab11/M-ulator,lab11/M-ulator,lab11/M-ulator,lab11/M-ulator,lab11/M-ulator,lab11/M-ulator,lab11/M-ulator | platforms/m3/programming/mbus_snoop_img2.py | platforms/m3/programming/mbus_snoop_img2.py | #!/usr/bin/python
import os
import sys
import logging
import csv
import time
import datetime
from datetime import datetime
import m3_common
#m3_common.configure_root_logger()
#logger = logging.getLogger(__name__)
from m3_logging import get_logger
logger = get_logger(__name__)
def Bpp_callback(address, data, cb0... | apache-2.0 | Python | |
a8c7c6f08571449b618fd57f298546da6ef80ee9 | Add a pyastro16.py file to use as an auto doc demo | cdeil/sphinx-tutorial | astrospam/pyastro16.py | astrospam/pyastro16.py | """
Python in Astronomy 2016 is the second iteration of the Python in Astronomy
conference series.
This is the docstring for the pyastro module, this gets included as the
description for the module.
"""
import numpy as np
def times(a, b):
"""
Multiply a by b.
Parameters
----------
a : `numpy.n... | mit | Python | |
9af2a8341b59098d0ebb88f1e71a3452c338b191 | Add a plotting example. | scipy/scipy,Srisai85/scipy,jakevdp/scipy,jamestwebber/scipy,trankmichael/scipy,sonnyhu/scipy,haudren/scipy,kalvdans/scipy,mortonjt/scipy,teoliphant/scipy,ortylp/scipy,ChanderG/scipy,WillieMaddox/scipy,ilayn/scipy,apbard/scipy,behzadnouri/scipy,gfyoung/scipy,kleskjr/scipy,woodscn/scipy,arokem/scipy,larsmans/scipy,domini... | Lib/sandbox/pyem/examples/plotexamples.py | Lib/sandbox/pyem/examples/plotexamples.py | #! /usr/bin/env python
# Last Change: Mon Jun 11 03:00 PM 2007 J
# This is a simple test to check whether plotting ellipsoides of confidence and
# isodensity contours match
import numpy as N
from numpy.testing import set_package_path, restore_path
import pylab as P
set_package_path()
import pyem
restore_path()
# Ge... | bsd-3-clause | Python | |
71ac93da2eed58bbd53bb13d4ade308404be18ad | Add auth0.v2.connection | auth0/auth0-python,auth0/auth0-python | auth0/v2/connection.py | auth0/v2/connection.py | from .rest import RestClient
class Connection(object):
"""Auth0 connection endpoints"""
def __init__(self, domain, jwt_token):
url = 'https://%s/api/v2/connections' % domain
self.client = RestClient(endpoint=url, jwt=jwt_token)
def all(self, strategy=None, fields=[], include_fields=True... | mit | Python | |
7e600a791bec2f8639aae417a1ea052ca94cf7b9 | Add a largish auto-generated test for the aligned bundling feature, along with the script generating it. The test should never be modified manually. If anyone needs to change it, please change the script and re-run it. | lodyagin/bare_cxx,lodyagin/bare_cxx,lodyagin/bare_cxx,lodyagin/bare_cxx,lodyagin/bare_cxx | testgen/mc-bundling-x86-gen.py | testgen/mc-bundling-x86-gen.py | #!/usr/bin/python
# Auto-generates an exhaustive and repetitive test for correct bundle-locked
# alignment on x86.
# For every possible offset in an aligned bundle, a bundle-locked group of every
# size in the inclusive range [1, bundle_size] is inserted. An appropriate CHECK
# is added to verify that NOP padding occu... | bsd-3-clause | Python | |
15150516e1915948b10abed70e964a5b6109013b | Add ExtractAttribute | maxalbert/tohu | tohu/derived_generators_NEW.py | tohu/derived_generators_NEW.py | import logging
from operator import attrgetter
from .base_NEW import TohuUltraBaseGenerator
__all__ = ['ExtractAttribute']
logger = logging.getLogger('tohu')
class ExtractAttribute(TohuUltraBaseGenerator):
"""
Generator which produces items that are attributes extracted from
the items produced by a diff... | mit | Python | |
c9afc35d2be96adea47e79a4c0042235e4ffd594 | add ldap-filter-cut.py | bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile | python/python/openldap/ldap-filter-cut.py | python/python/openldap/ldap-filter-cut.py | #!/usr/bin/env python
'''
Copyright (C) 2011 Bryan Maupin <bmaupincode@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later... | mit | Python | |
3a19187e8116e8dc20166786fb1ca4d14b527950 | Add missing IDL Visistor class | yitian134/chromium,adobe/chromium,gavinp/chromium,ropik/chromium,adobe/chromium,gavinp/chromium,yitian134/chromium,ropik/chromium,adobe/chromium,yitian134/chromium,gavinp/chromium,ropik/chromium,adobe/chromium,gavinp/chromium,yitian134/chromium,gavinp/chromium,adobe/chromium,adobe/chromium,adobe/chromium,adobe/chromium... | ppapi/generators/idl_visitor.py | ppapi/generators/idl_visitor.py | #!/usr/bin/python
#
# Copyright (c) 2011 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.
""" Visitor Object for traversing AST """
#
# IDLVisitor
#
# The IDLVisitor class will traverse an AST truncating portions of the tr... | bsd-3-clause | Python | |
bbed7b813b6c809ee9615eabf2fcf4d3156b1c36 | Add script to convert release notes from Markdown | adafruit/micropython,adafruit/circuitpython,adafruit/micropython,adafruit/circuitpython,adafruit/circuitpython,adafruit/micropython,adafruit/circuitpython,adafruit/micropython,adafruit/circuitpython,adafruit/micropython,adafruit/circuitpython | tools/convert_release_notes.py | tools/convert_release_notes.py | import sys
import mistune
print(sys.argv[1])
with open(sys.argv[1], "r") as source_file:
source = source_file.read()
html = mistune.Markdown()
print()
print("HTML")
print("=====================================")
print("From the <a href=\"\">GitHub release page</a>:\n<blockquote>")
print(html(source))
print("</b... | mit | Python | |
1db5cd0fddbbcc1d38a08bfe8ad6cfb8d0b5c550 | add migration to create new model fields | byteweaver/django-coupons,byteweaver/django-coupons | coupons/migrations/0004_auto_20151105_1456.py | coupons/migrations/0004_auto_20151105_1456.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('coupons', '0003_auto_20150416_0617'),
... | bsd-3-clause | Python | |
3bd7c50acfc8044fc33002530a5fcaa0b5c2152e | add module 'job' for reset queue | roramirez/qpanel,roramirez/qpanel,roramirez/qpanel,skazancev/qpanel,skazancev/qpanel,skazancev/qpanel,skazancev/qpanel,roramirez/qpanel | libs/qpanel/job.py | libs/qpanel/job.py | import backend
import config
from redis import Redis
from rq_scheduler import Scheduler
import datetime
def reset_stats_queue(queuename, when, hour):
'''
Reset stat for a queue on backend
queuename: Name of queue to reset
when, hour parameters for more easy
control for exist... | mit | Python | |
b0c3ed39916e25bed2900b653974672a39fcb254 | Use CHROME_HEADLESS to check if download_sdk_extras.py is running on a bot. | chuan9/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk,chuan9/chromium-crosswalk,axinging/chromium-crosswalk,ltilve/chromium,hgl888/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,chuan9/chromium-crosswalk,Just-D/chromium-1,Chilledheart/chromium,TheTypoMaster... | build/download_sdk_extras.py | build/download_sdk_extras.py | #!/usr/bin/env python
# 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.
"""Script to download sdk/extras packages on the bots from google storage.
The script expects arguments that specify zips file in the ... | #!/usr/bin/env python
# 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.
"""Script to download sdk/extras packages on the bots from google storage.
The script expects arguments that specify zips file in the ... | bsd-3-clause | Python |
80580b8667558e3a4034b31ac08773de70ef3b39 | Implement consumer for adjusting screen brightness. | ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display | display_control_consumer/run.py | display_control_consumer/run.py | from setproctitle import setproctitle
import json
import redis
import subprocess
import time
class DisplayControlConsumer(object):
STEP = 0.05
def __init__(self):
self.redis_instance = redis.StrictRedis()
self.env = {"DISPLAY": ":0"}
def get_brightness(self):
p = subprocess.Popen... | bsd-3-clause | Python | |
5a376ef0d49193df46fc127323bfa50376e3c968 | add lqr sample | AtsushiSakai/PyAdvancedControl,AtsushiSakai/PyAdvancedControl | lqr_sample/main.py | lqr_sample/main.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
u"""
Linear-Quadratic Regulator sample code
author Atsushi Sakai
"""
import matplotlib.pyplot as plt
import numpy as np
import scipy.linalg as la
simTime=3.0
dt=0.1
A=np.matrix([[1.1,2.0],[0,0.95]])
B=np.matrix([0.0,0.0787]).T
C=np.matrix([-2,1])
def Observation(x):
... | mit | Python | |
d83b18ec4faa513c7171a23af5ba46397141519e | add main __init__.py | helo9/wingstructure | wingstructure/__init__.py | wingstructure/__init__.py | from . import analysis
from . import data
from . import liftingline
from . import structure
| mit | Python | |
81df43350fdcbde85780dfbf1101e47fff04dc6c | Add missing migration | genialis/resolwe,jberci/resolwe,genialis/resolwe,jberci/resolwe | resolwe/flow/migrations/0025_set_get_last_by.py | resolwe/flow/migrations/0025_set_get_last_by.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-15 12:42
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('flow', '0024_add_relations'),
]
operations = [
migrations.AlterModelOptions(
... | apache-2.0 | Python | |
7b2e28f9604347ff396b220c8d2ab7bdfdc671c8 | test hbase TSocket | svebk/DeepSentiBank_memex,svebk/DeepSentiBank_memex,svebk/DeepSentiBank_memex,svebk/DeepSentiBank_memex | test/test_hbase_TSocker0Err32/test_hbase.py | test/test_hbase_TSocker0Err32/test_hbase.py | import happybase
# gives error
# TSocket read 0 bytes
# [Errno 32] Broken pipe
if __name__ == "__main__":
conn = happybase.Connection(host="10.1.94.57")
table_name = "escorts_images_sha1_infos_dev"
hbase_table = conn.table(table_name)
batch_list_queries = ["000421227D83DA48DB4A417FCEFCA68272398B8E"]
rows = hbase... | bsd-2-clause | Python | |
6d8e47f0b1bc70de7464303d6ac3b7684588a7aa | Add mpmodel | yukirin/RegionTF | mpmodel/mpmodel.py | mpmodel/mpmodel.py | import tensorflow as tf
| mit | Python | |
ad6e67d382df1018e4ae55ebdcb6fae1cca9bffe | Add merge migration | saradbowman/osf.io,CenterForOpenScience/osf.io,chennan47/osf.io,icereval/osf.io,HalcyonChimera/osf.io,mattclark/osf.io,HalcyonChimera/osf.io,aaxelb/osf.io,adlius/osf.io,Johnetordoff/osf.io,baylee-d/osf.io,chennan47/osf.io,icereval/osf.io,CenterForOpenScience/osf.io,Johnetordoff/osf.io,aaxelb/osf.io,sloria/osf.io,caseyr... | osf/migrations/0081_merge_20180212_0949.py | osf/migrations/0081_merge_20180212_0949.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-02-12 15:49
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0080_ensure_schemas'),
('osf', '0079_merge_20180202_1206'),
]
operations = [... | apache-2.0 | Python | |
ec6b65513baa4532af7cad1bd6c98e162b3db9ef | Add multiprocessing example | imitrichev/cantera,imitrichev/cantera,imitrichev/cantera,Heathckliff/cantera,Heathckliff/cantera,imitrichev/cantera,imitrichev/cantera,Heathckliff/cantera,Heathckliff/cantera,imitrichev/cantera,Heathckliff/cantera,Heathckliff/cantera | interfaces/cython/cantera/examples/transport/multiprocessing_viscosity.py | interfaces/cython/cantera/examples/transport/multiprocessing_viscosity.py | """
This example demonstrates how Cantera can be used with the 'multiprocessing'
module.
Because Cantera Python objects are built on top of C++ objects which cannot be
passed between Python processes, it is necessary to set up the computation so
that each process has its own copy of the relevant Cantera objects. One ... | bsd-3-clause | Python | |
3fbf2c29a54225e7d4dd882637e68cfe3a4d0101 | Add some tests for Message Queue | asteroide/immo_spider,asteroide/immo_spider,asteroide/immo_spider,asteroide/immo_spider | src/cobwebs/tests/test_mq.py | src/cobwebs/tests/test_mq.py | from cobwebs.mq.core import RPCLink, TopicsLink
from cobwebs.mq.backends.rabbitmq import driver
import pytest
import spider
import json
from unittest import mock
HOST = "127.0.0.1"
def test_driver_instance():
assert isinstance(driver.rpc, RPCLink)
assert isinstance(driver.topics, TopicsLink)
@mock.patch("c... | apache-2.0 | Python | |
eca48495bdba121a0719bb442f5ec30b70233e74 | Add a snippet (Python OpenCV). | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/opencv/opencv_2/gui/opencv_trackbar.py | python/opencv/opencv_2/gui/opencv_trackbar.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
"""
OpenCV - Trackbar widget.
Required: opencv library (Debian: aptitude install python-opencv)
See: https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_trackbar/py_trackbar.html#track... | mit | Python | |
9469bcf60a199b96d1fec778c44346df744a1d60 | add jieba | Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python | jieba/test_jieba.py | jieba/test_jieba.py | #!/usr/bin/env python
# encoding=utf-8
import jieba
seg_list = jieba.cut("我来到北京清华大学", cut_all=True)
print("Full Mode: " + "/ ".join(seg_list)) # 全模式
seg_list = jieba.cut("我来到北京清华大学", cut_all=False)
print("Default Mode: " + "/ ".join(seg_list)) # 精确模式
seg_list = jieba.cut("他来到了网易杭研大厦") # 默认是精确模式
print(", ".join(seg_... | mit | Python | |
291e7c8b2a69f26f6343269aaac2b9e3cd517220 | Add tests | rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org | readthedocs/proxito/tests/test_proxied_api.py | readthedocs/proxito/tests/test_proxied_api.py | from readthedocs.rtd_tests.tests.test_footer import TestFooterHTML
from django.test import override_settings
@override_settings(ROOT_URLCONF='readthedocs.proxito.urls')
class TestProxiedFooterHTML(TestFooterHTML):
def setUp(self):
super().setUp()
self.host = 'pip.readthedocs.io'
def render(s... | mit | Python | |
081b5aabae205ad7c23c512be15ee26276dc8a29 | Check whether Azure CLI is in ARM mode | GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,meteorfox/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,meteorfox/PerfKitBenchmarker | perfkitbenchmarker/providers/azure/util.py | perfkitbenchmarker/providers/azure/util.py | # Copyright 2016 PerfKitBenchmarker 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 appli... | apache-2.0 | Python | |
0d3ca7371bcf4d0d7b7db75e7e9130deefd706cb | add visualize.py | YusukeSuzuki/castanea | castanea/layers/visualize.py | castanea/layers/visualize.py | import tensorflow as tf
palette_data = [0, 0, 0, 128, 0, 0, 0, 128, 0, 128, 128, 0,
0, 0, 128, 128, 0, 128, 0, 128, 128, 128, 128, 128,
64, 0, 0, 192, 0, 0, 64, 128, 0, 192, 128, 0,
64, 0, 128, 192, 0, 128, 64, 128, 128, 192, 128, 128,
0, 64, 0, 128, 64, 0, 0, 192, 0, 128, 192, 0,
0, 64, 128, 1... | mit | Python | |
59edefb410b932a648347f76ca9a96013b40a08e | Add solution 303 | byung-u/ProjectEuler | Problem_300_399/euler_303.py | Problem_300_399/euler_303.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Problem 303
For a positive integer n, define f(n) as the least positive multiple of n that, written in base 10, uses only digits ≤ 2.
Thus f(2)=2, f(3)=12, f(7)=21, f(42)=210, f(89)=1121222.
Also, . n = 1 ~ 100, f(n)/n = 11363107
Find . n = 1 ~ 10000, f(n)/n = ?
''... | mit | Python | |
6705e0e23d13a94726556714e11dfbb7a916877d | Add basic mechanism to override the default EntryAdmin | django-blog-zinnia/zinnia-wysiwyg-wymeditor,layar/zinnia-wysiwyg-wymeditor,django-blog-zinnia/zinnia-wysiwyg-wymeditor,layar/zinnia-wysiwyg-wymeditor,layar/zinnia-wysiwyg-wymeditor,django-blog-zinnia/zinnia-wysiwyg-wymeditor,layar/zinnia-wysiwyg-wymeditor,django-blog-zinnia/zinnia-wysiwyg-wymeditor | zinnia_wymeditor/admin.py | zinnia_wymeditor/admin.py | """EntryAdmin for zinnia-wymeditor"""
from django.contrib import admin
from zinnia.models import Entry
from zinnia.admin.entry import EntryAdmin
class EntryAdminWYMEditorMixin(object):
"""
Mixin adding WYMeditor for editing Entry.content field.
"""
pass
class EntryAdminWYMEditor(EntryAdminWYMEditor... | bsd-3-clause | Python | |
6193786bb2307550ab9dfb9c218f6d8b3f407156 | Create is-graph-bipartite.py | kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015 | Python/is-graph-bipartite.py | Python/is-graph-bipartite.py | # Time: O(|V| + |E|)
# Space: O(|V|)
# Given a graph, return true if and only if it is bipartite.
#
# Recall that a graph is bipartite if we can split it's set of nodes into
# two independent subsets A and B such that every edge in the graph has
# one node in A and another node in B.
#
# The graph is given in the fol... | mit | Python | |
3204227799ce5f7a7d0df4cb6b480b42d6cdae1f | Add a snippet. | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/pyqt/pyqt5/widget_QPainter_OpenGL.py | python/pyqt/pyqt5/widget_QPainter_OpenGL.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# See https://doc.qt.io/archives/4.6/opengl-2dpainting.html
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QPainter, QBrush, QPen
from PyQt5.QtCore import Qt
from PyQt5.QtOpenGL import QGLWidget
class MyPaintWidget(QGLWidget):
def __in... | mit | Python | |
ae3bd406736f9235b442c52bf584a97d0760a588 | add api | tardyp/buildbot_travis,isotoma/buildbot_travis,tardyp/buildbot_travis,buildbot/buildbot_travis,tardyp/buildbot_travis,buildbot/buildbot_travis,isotoma/buildbot_travis,tardyp/buildbot_travis,buildbot/buildbot_travis | buildbot_travis/api.py | buildbot_travis/api.py | # Copyright 2012-2013 Isotoma Limited
#
# 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 wr... | unknown | Python | |
d19ab50f2d3b259bd6c5cfb21b4087ca4d3ec248 | create theano 2 | wangwei7175878/tutorials | theanoTUT/theano2_install.py | theanoTUT/theano2_install.py | # View more python tutorials on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
# 2 - Install theano
"""
requirements:
1. python 2 >=2.6 or python 3>=3.3
2. Numpy >= 1.7.1
3. Scipy >=0.11
If ... | mit | Python | |
389adca1fd52747814f370de2d066a1743544469 | Solve Game Time in python | deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playgr... | solutions/beecrowd/1046/1046.py | solutions/beecrowd/1046/1046.py | start, end = map(int, input().split())
if start == end:
result = 24
elif end - start >= 0:
result = end - start
else:
result = 24 + end - start
print(f'O JOGO DUROU {result} HORA(S)')
| mit | Python | |
3a9627f31846e06e04d7ae933712840d52616663 | Create main.py | jakovj/SuperHeroRush | main.py | main.py | import pygame
import game
file = 'music.mp3'
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load(file)
pygame.mixer.music.play(loops=-1)
pygame.mixer.music.set_volume(0.5)
run = True
SuperHeroTower = game.Game()
while run:
run = SuperHeroTower.startScreen()
pygame.quit()
quit()
| mit | Python | |
bc3f7e83bd35f1a6ae8add35932513c7da47076e | fix a typo. | uw-it-aca/uw-restclients,UWIT-IAM/uw-restclients,uw-it-aca/uw-restclients,uw-it-cte/uw-restclients,UWIT-IAM/uw-restclients,UWIT-IAM/uw-restclients,uw-it-cte/uw-restclients,uw-it-cte/uw-restclients | restclients/test/util/datetime_convertor.py | restclients/test/util/datetime_convertor.py | from django.test import TestCase
from datetime import date, datetime
from restclients.util.datetime_convertor import convert_to_begin_of_day,\
convert_to_end_of_day
class DatetimeConvertorTest(TestCase):
def test_convert_to_begin_of_day(self):
self.assertEquals(convert_to_begin_of_day(date(2013, 4,... | from django.test import TestCase
from datetime import date, datetime
from restclients.util.datetime_convertor import convert_to_begin_of_day,\
convert_to_end_of_day
class DatetimeConvertorTest(TestCase):
def test_convert_to_begin_of_day(self):
self.assertEquals(convert_to_begin_of_day(date(2013, 4,... | apache-2.0 | Python |
3b4f7b9792be0315aca7d71fafe1a972e5fd87f7 | Add Seh_bug_fuzzer.py | b09780978/SEH_Fuzzer | SEH_Fuzzer/Seh_bug_fuzzer.py | SEH_Fuzzer/Seh_bug_fuzzer.py | # -*- coding: utf-8 -*-
import time
import sys
import socket
import cPickle
import os
from pydbg import *
from pydbg.defines import *
from util import *
PICKLE_NAME = "fsws_phase1.pkl"
exe_path = "D:\\testPoc\\Easy File Sharing Web Server\\fsws.exe"
import threading
import time
host, port = "12... | mit | Python | |
2199f4c5ed563200d555315b9a8575e00486e667 | Add a simple script to generate monthly confirmed / fixed counts | mysociety/fixmytransport,mysociety/fixmytransport,mysociety/fixmytransport,mysociety/fixmytransport,mysociety/fixmytransport,mysociety/fixmytransport | script/confirmed-fixed-monthly-breakdown.py | script/confirmed-fixed-monthly-breakdown.py | #!/usr/bin/python
# A script to draw graphs showing the number of confirmed reports
# created each month, and those of which that have been fixed. This
# script expects to find a file called 'problems.csv' in the current
# directory which should be generated by:
#
# DIR=`pwd` rake data:create_problem_spreadshee... | agpl-3.0 | Python | |
417f1832dbb6a1d0742b2f01d56429139f8885ef | add conversion script | idaholab/raven,idaholab/raven,idaholab/raven,joshua-cogliati-inl/raven,joshua-cogliati-inl/raven,joshua-cogliati-inl/raven,joshua-cogliati-inl/raven,idaholab/raven,joshua-cogliati-inl/raven,joshua-cogliati-inl/raven,idaholab/raven,joshua-cogliati-inl/raven,idaholab/raven,idaholab/raven | scripts/conversionScripts/toValidationPP.py | scripts/conversionScripts/toValidationPP.py | # Copyright 2017 Battelle Energy Alliance, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | apache-2.0 | Python | |
bbae3e9fee30634a659276732f16a883500e8f45 | Create memcache.py | yangjiePro/cutout,jojoin/cutout,MrZhengliang/cutout | cutout/cache/memcache.py | cutout/cache/memcache.py | # -*- coding: utf-8 -*-
import os
import re
import tempfile
from time import time
from .basecache import BaseCache
from .posixemulation import rename, _items
try:
import cPickle as pickle
except ImportError:
import pickle
try:
from hashlib import md5
except ImportError:
from md5 import new as md5
... | mit | Python | |
bd2a70930ba67f3dd510b172fe4e00ddc2dc23c2 | Create voxelmodel.py | hi9hlander/odvm | odvm/voxelmodel.py | odvm/voxelmodel.py | from panda3d.core import *
from odvm.quads import Quads
class VoxelModel(Geom):
def __init__(self):
Geom.__init__( self, GeomVertexData( 'vertices', GeomVertexFormat.get_v3n3c4(), Geom.UH_static ) )
self.quads = Quads(self)
self.add_primitive(self.quads)
def add(self,p2s,i,j,k,c,p2i=0,p2j=0,p... | mit | Python | |
b4d82c21995fb2b9e2afd93eea8849ded8b7d489 | Update next-greater-element-iii.py | yiwen-luo/LeetCode,yiwen-luo/LeetCode,jaredkoontz/leetcode,jaredkoontz/leetcode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,jaredkoontz/leetcod... | Python/next-greater-element-iii.py | Python/next-greater-element-iii.py | # Time: O(logn) = O(1)
# Space: O(logn) = O(1)
# Given a positive 32-bit integer n, you need to find the smallest 32-bit integer
# which has exactly the same digits existing in the integer n and is greater in value than n.
# If no such positive 32-bit integer exists, you need to return -1.
@
# Example 1:
# Input: 12
... | # Time: O(logn)
# Space: O(logn)
# Given a positive 32-bit integer n, you need to find the smallest 32-bit integer
# which has exactly the same digits existing in the integer n and is greater in value than n.
# If no such positive 32-bit integer exists, you need to return -1.
@
# Example 1:
# Input: 12
# Output: 21
#... | mit | Python |
c6af2c9f11204dde361a9b1f8b14113e90a272b3 | add py prototype | vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam | 1/hazi.py | 1/hazi.py | #!/usr/bin/env python
import sys, codecs
class Node:
def __init__(self, name, g, h):
self.name = name
self.f = g + h
self.g = g
self.h = h
def sort_node(a, b):
return cmp(a.f, b.f)
def name_in_list(y, l):
for i in l:
if y == i.name:
return True
return False
def node_from_list(y, l):
for i in l:
... | mit | Python | |
d9ed78369e21b79e022e685ecb39babbb0c17315 | Create test_lcd.py | alienneo666/Rob_Bat | Raspberry_py/test_lcd.py | Raspberry_py/test_lcd.py | #!/usr/bin/python
#import
import RPi.GPIO as GPIO
import time
# Define GPIO to LCD mapping
LCD_RS = 7
LCD_E = 8
LCD_D4 = 25
LCD_D5 = 24
LCD_D6 = 23
LCD_D7 = 18
# Define some device constants
LCD_WIDTH = 16 # Maximum characters per line
LCD_CHR = True
LCD_CMD = False
LCD_LINE_1 = 0x80 # LCD RAM address for th... | mit | Python | |
f30c542a9714574dbcee15ca7f7b4ca4cdb9d965 | add atexit01.py | devlights/try-python | trypython/stdlib/atexit01.py | trypython/stdlib/atexit01.py | # coding: utf-8
"""
atexitモジュールについてのサンプルです。
"""
import atexit
import sys
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
class Sample(SampleBase):
def exec(self):
#
# atexitモジュールを利用するとシャットダウンフックを設定出来る
# register() で登録して、 unregister() で解除する
... | mit | Python | |
926fe25c4995b5ab1d2464159223e2c403b72570 | use python command line tool with tshark to parse pcap and convert to csv | econchick/tissue,econchick/tissue | pcap2csv.py | pcap2csv.py | import os
import csv
cmd = "tshark -n -r {0} -T fields -Eheader=y -e ip.addr > tmp.csv"
os.system(cmd.format("wireshark_sample.pcap"))
result = []
with open("tmp.csv", "r") as infile:
for line in infile:
if line == "\n":
continue
else:
result.append(line.strip().split(","... | mit | Python | |
81f4976645225b6cf4a422186a3419a06756bfc5 | add a set of test utils that will be useful for running tests | ocefpaf/ulmo,ocefpaf/ulmo,nathanhilbert/ulmo,nathanhilbert/ulmo,cameronbracken/ulmo,cameronbracken/ulmo | test/test_util.py | test/test_util.py | import contextlib
import os
import os.path
import mock
import requests
@contextlib.contextmanager
def mocked_requests(path):
"""mocks the requests library to return a given file's content"""
# if environment variable is set, then don't mock the tests just grab files
# over the network. Example:
# ... | bsd-3-clause | Python | |
0827fce61013172fa7183ee294189275030c0faf | Create code_5.py | jnimish77/Cloud-Computing-and-Programming-using-various-tools,jnimish77/Cloud-Computing-and-Programming-using-various-tools,jnimish77/Cloud-Computing-and-Programming-using-various-tools | MPI_Practice_Examples/code_5.py | MPI_Practice_Examples/code_5.py | #dotProductParallel_1.py
#"to run" syntax example: mpiexec -n 4 python26 dotProductParallel_1.py 40000
from mpi4py import MPI
import numpy
import sys
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
#read from command line
n = int(sys.argv[1]) #length of vectors
#arbitrary example vectors, gen... | apache-2.0 | Python | |
6454548da01dbc2b9f772a5c0ffb11a03dc933e7 | Add module capable of rendering a circle when ran | withtwoemms/pygame-explorations | draw_shape.py | draw_shape.py | import pygame
pygame.init()
#-- SCREEN CHARACTERISTICS ------------------------->>>
background_color = (255,255,255)
(width, height) = (300, 200)
#-- RENDER SCREEN ---------------------------------->>>
screen = pygame.display.set_mode((width, height))
screen.fill(background_color)
#pygame.draw.circle(canvas, color... | mit | Python | |
469b28aec45c9832e4cfe658143316fb15e103d1 | Add server | dotoscat/Polytank-ASIR | server.py | server.py | print("Hola mundo")
| agpl-3.0 | Python | |
6ac6f9f3f933a98af8722561ba181ca50c6ad1fe | Add performance test | tailhook/sortedsets | perftest.py | perftest.py | import resource
from time import clock
from sortedsets import SortedSet
def test(size):
tm = clock()
ss = SortedSet((str(i), i*10) for i in range(size))
create_time = clock() - tm
print("SORTED SET WITH", size, "ELEMENTS", ss._level, "LEVELS")
print("Memory usage", resource.getrusage(resource.RUSA... | mit | Python | |
a107d3c088e13c4bf1a600f0ebf2664321d6799f | add solution for Binary Tree Maximum Path Sum | zhyu/leetcode,zhyu/leetcode | src/binaryTreeMaximumPathSum.py | src/binaryTreeMaximumPathSum.py | # Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param root, a tree node
# @return an integer
def maxPathSum(self, root):
self.res = root.val if root else 0
... | mit | Python | |
4fdef464be6eabee609ecc4327493c277693c0e0 | Make content text mandatory | stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten | content/migrations/0023_auto_20160614_1130.py | content/migrations/0023_auto_20160614_1130.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-14 09:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('content', '0022_auto_20160608_1407'),
]
operations = [
migrations.AlterField... | agpl-3.0 | Python | |
5a857703de5fc1e67e958afb41a10db07b98bfa1 | Add migration script to fix valid users with date_confirmed==None | laurenrevere/osf.io,doublebits/osf.io,kch8qx/osf.io,mluo613/osf.io,petermalcolm/osf.io,GageGaskins/osf.io,ZobairAlijan/osf.io,caneruguz/osf.io,njantrania/osf.io,asanfilippo7/osf.io,zkraime/osf.io,petermalcolm/osf.io,himanshuo/osf.io,hmoco/osf.io,GaryKriebel/osf.io,jmcarp/osf.io,rdhyee/osf.io,monikagrabowska/osf.io,haoy... | scripts/migrate_unconfirmed_valid_users.py | scripts/migrate_unconfirmed_valid_users.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Script to migrate users with a valid date_last_login but no date_confirmed."""
import sys
import logging
from website.app import init_app
from website.models import User
from scripts import utils as script_utils
from tests.base import OsfTestCase
from tests.factories i... | apache-2.0 | Python | |
e12371408af1682904483341fd1f41ef6034a17f | add test | Jayin/ComputerScience,Jayin/ComputerScience,Jayin/ComputerScience,Jayin/ComputerScience,Jayin/ComputerScience | OperateSystem/Ex1/Test/SellTest.py | OperateSystem/Ex1/Test/SellTest.py | # -*- coding: utf-8 -*-
__author__ = 'jayin'
import requests
import threading
def buy_ticket():
res = requests.get('http://localhost:8000/buy1')
print threading.currentThread().getName() + u' buy ticket ' + res.content
def main():
for x in range(1, 40):
t = threading.Thread(target=buy_ticket, n... | mit | Python | |
edeffbcbe8fb239553c73fa37e73c0188ffc2479 | Add unit test for retrieving credentials from environment variables | ueg1990/imgur-cli | tests/test_cli.py | tests/test_cli.py | import sys
import fixtures
import imgurpython
import testtools
import imgur_cli.cli as cli
FAKE_ENV = {'IMGUR_CLIENT_ID': 'client_id',
'IMGUR_CLIENT_SECRET': 'client_secret',
'IMGUR_ACCESS_TOKEN': 'access_token',
'IMGUR_REFRESH_TOKEN': 'refresh_token',
'IMGUR_MASHAPE_K... | mit | Python | |
4c148281ee8071ea8f150362388a44cf5c0895bf | Add exception classes. | cwahbong/tgif-py | tgif/exception.py | tgif/exception.py | """ All exceptions go here.
"""
class Friday(Exception):
""" Base exception in Friday game.
"""
class GameOver(Friday):
""" Indicats that the game is overed.
"""
| mit | Python | |
ff079da977990b7d6e71c6d92c5a9299fa92d123 | Add module listtools implementing class LazyList. | RKrahl/photo-tools | photo/listtools.py | photo/listtools.py | """Some useful list classes.
**Note**: This module might be useful independently of photo-tools.
It is included here because photo-tools uses it internally, but it is
not considered to be part of the API. Changes in this module are not
considered API changes of photo-tools. It may even be removed from
future version... | apache-2.0 | Python | |
a6935d250dfdbc275ce450f813697b73ebc291e3 | Create addDigits.py | CptDemocracy/Python | Puzzles/leetcode/April-9th-2016/addDigits.py | Puzzles/leetcode/April-9th-2016/addDigits.py | /*
[ref.href] leetcode.com/problems/add-digits
"
Given a non-negative integer num, repeatedly add all its digits
until the result has only one digit.
For example:
Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2.
Since 2 has only one digit, return it.
Credits:
Special thanks to @jianc... | mit | Python | |
85142dd9f7413dcb7c214ec251d21c93517ce26c | add AcoraMatcher tool | AtmaHou/atma | AcoraMatcher.py | AcoraMatcher.py | # coding:utf-8
import cPickle
import json
import acora
from atma import tool
import collections
from itertools import groupby
class AcoraMatcher:
def __init__(self, spec_set, min_count=1, min_len=1):
key_lst = []
if type(spec_set) == dict or type(spec_set) == collections.Counter:
for s... | mit | Python | |
7a880376e098f60b1666833bb6b14b359b0ebda5 | add fitness_spider.py | bluedai180/PythonExercise,bluedai180/PythonExercise | Exercise/fitness_spider.py | Exercise/fitness_spider.py | from bs4 import BeautifulSoup
import requests
from selenium import webdriver
import time
import sqlite3
from selenium import webdriver
import json
driver = webdriver.PhantomJS()
class Fitness:
i = 0
url = "http://www.hiyd.com/dongzuo/"
headers = {
'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT ... | apache-2.0 | Python | |
a8fd0bfa974ff818ec105a42c585bae48030a086 | Create notebooknetc.py | picklecai/OMOOC2py,picklecai/OMOOC2py | _src/om2py3w/3wex0/notebooknetc.py | _src/om2py3w/3wex0/notebooknetc.py | # _*_coding:utf-8_*_
# 客户端程序
from socket import *
import time
import notebooknets
def main():
BUF_SIZE = 65565
ss_addr = ('127.0.0.1', 8800)
cs = socket(AF_INET, SOCK_DGRAM)
while True:
global data
data = raw_input('Please Input data>')
cs.sendto(data, ss_addr)
data, a... | mit | Python | |
68206c67739abf4f9f4d1ab8aa647a28649b5f5f | add figure one comparison between IME and random | WilmerLab/HTSOHM-dev,WilmerLab/HTSOHM-dev | analysis/figure_1_ime_vs_random.py | analysis/figure_1_ime_vs_random.py | #!/usr/bin/env python3
import os
import click
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
# from matplotlib import cm
import pandas as pd
font = {'family':'sans-serif',
'sans-serif':['Helvetica'],
'weight' : 'normal',
'size' : 8}
rc('font', **font)
@click... | mit | Python | |
13f495ddabd1997b7dfdc9e2933b82fd25ecd664 | Create LevelOrderTraversal.py from LeetCode | jcchuks/MiscCodes,jcchuks/Hackerrank,jcchuks/Hackerrank,jcchuks/MiscCodes,jcchuks/MiscCodes | LevelOrderTraversal.py | LevelOrderTraversal.py |
#https://leetcode.com/problems/binary-tree-level-order-traversal/#/description
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Node(object):
def __init__(self,node,level):
self... | mit | Python | |
66c00d10ddc1f137deaf9208572a287bbad33de7 | Add migration script | privacyidea/privacyidea,privacyidea/privacyidea,privacyidea/privacyidea,privacyidea/privacyidea,privacyidea/privacyidea,privacyidea/privacyidea | migrations/versions/d756b34061ff_.py | migrations/versions/d756b34061ff_.py | """Store privacyIDEA node in eventcounter table
Revision ID: d756b34061ff
Revises: 3d7f8b29cbb1
Create Date: 2019-09-02 13:59:24.244529
"""
# revision identifiers, used by Alembic.
from sqlalchemy import orm
from sqlalchemy.sql.ddl import CreateSequence
from privacyidea.lib.config import get_privacyidea_node
revisi... | agpl-3.0 | Python | |
891dc05f36ae9084d8511bf3e26e0631eadecef7 | add medications urls | slogan621/tscharts,slogan621/tscharts,slogan621/tscharts | medications/urls.py | medications/urls.py |
from django.conf.urls import url
from medications.views import MedicationsView
urlpatterns = [
url(r'^$', MedicationsView.as_view()),
url(r'^([0-9]+)/$', MedicationsView.as_view()),
]
| apache-2.0 | Python | |
aa4f1df448c6d01875ed667e37afe68c114892ed | Add initial verification endpoint. Add all balance endpoint | Nevtep/omniwallet,VukDukic/omniwallet,Nevtep/omniwallet,habibmasuro/omniwallet,habibmasuro/omniwallet,OmniLayer/omniwallet,OmniLayer/omniwallet,OmniLayer/omniwallet,Nevtep/omniwallet,VukDukic/omniwallet,habibmasuro/omniwallet,Nevtep/omniwallet,achamely/omniwallet,achamely/omniwallet,achamely/omniwallet,OmniLayer/omniwa... | api/mastercoin_verify.py | api/mastercoin_verify.py | import os
import glob
from flask import Flask, request, jsonify, abort, json
data_dir_root = os.environ.get('DATADIR')
app = Flask(__name__)
app.debug = True
@app.route('/addresses')
def addresses():
currency_id = request.args.get('currency_id')
print currency_id
response = []
addr_glob = glob.glob(data_dir... | agpl-3.0 | Python | |
23799c4a33b9d2da82ec0770f15e840459a940c6 | Add api comtrade | daniel1409/dataviva-api,DataViva/dataviva-api,jdmmiranda307/dataviva-api | app/apis/comtrade_api.py | app/apis/comtrade_api.py | from flask import Blueprint, jsonify, request
from sqlalchemy import func, distinct
from inflection import singularize
from app.models.comtrade import Comtrade as Model
from app import cache
from app.helpers.cache_helper import api_cache_key
blueprint = Blueprint('comtrade_api', __name__, url_prefix='/comtrade')
@blu... | mit | Python | |
670e5d017adb24c5adffb38fa59059fec5175c3c | Create hello.py | libennext/gluon-tutorials-zh,libennext/gluon-tutorials-zh,libennext/gluon-tutorials-zh | hello.py | hello.py | print('hello, world!')
| apache-2.0 | Python | |
1692161ad43fdc6a0e2ce9eba0bacefc04c46b5c | Add form generator module. | ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website | src/epiweb/apps/survey/utils.py | src/epiweb/apps/survey/utils.py | from django import forms
from epiweb.apps.survey.data import Survey, Section, Question
_ = lambda x: x
def create_field(question):
if question.type == 'yes-no':
field = forms.ChoiceField(widget=forms.RadioSelect,
choices=[('yes', _('Yes')), ('no', _('No'))])
elif que... | agpl-3.0 | Python | |
72a5f0d301b2169367c8bcbc42bb53b71c1d635c | Create utils.py | ch4rliem4rbles/slack-five | utils.py | utils.py | from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import blobstore_handlers
from google.appengine.api import memcache
import jinja2
import logging
import json
import os
class BaseHandler(webapp.RequestHandler):
context = {}
def initialize(self, req... | mit | Python | |
26bc11340590b0b863527fa12da03cea528feb46 | Add initial stub of GerritClient class | morucci/pygerrit,sonyxperiadev/pygerrit,dpursehouse/pygerrit,benjiii/pygerrit,gferon/pygerrit2,markon/pygerrit2,dpursehouse/pygerrit2 | pygerrit/client.py | pygerrit/client.py | """ Gerrit client interface. """
from Queue import Queue, Empty, Full
from pygerrit.error import GerritError
from pygerrit.events import GerritEventFactory
class GerritClient(object):
""" Gerrit client interface. """
def __init__(self, host):
self._factory = GerritEventFactory()
self._host... | mit | Python | |
10f99acc11051b37595751b9b9b84e11dd133a64 | Add functions for getting available checksums for a channel from remote and disk. | mrpau/kolibri,mrpau/kolibri,learningequality/kolibri,indirectlylit/kolibri,learningequality/kolibri,indirectlylit/kolibri,mrpau/kolibri,indirectlylit/kolibri,mrpau/kolibri,indirectlylit/kolibri,learningequality/kolibri,learningequality/kolibri | kolibri/core/content/utils/file_availability.py | kolibri/core/content/utils/file_availability.py | import json
import os
import re
import requests
from django.core.cache import cache
from kolibri.core.content.models import LocalFile
from kolibri.core.content.utils.paths import get_content_storage_dir_path
from kolibri.core.content.utils.paths import get_file_checksums_url
checksum_regex = re.compile("^([a-f0-9]{... | mit | Python | |
61ec190ca29187cbf9ad7b721fbf1936d665e4f6 | Revert "rm client.py" | icsnju/nap-core,icsnju/nap-core | orchestration/containerAPI/client.py | orchestration/containerAPI/client.py | from docker import Client as docker_client
class Client(object):
'''
Docker engine client
'''
def __init__(self, hostURL, version):
self.client = docker_client(base_url=hostURL, version=version)
self.url = hostURL
self.version = version
def get_url():
return self.ur... | apache-2.0 | Python | |
dcc08986d4e2f0e7940f485d0ece465b1325a711 | Add barebones FileBlob class | mrorii/github_lda,mrorii/github_lda,LanternYing/github_lda,LanternYing/github_lda,mrorii/github_lda,LanternYing/github_lda,LanternYing/github_lda,mrorii/github_lda | python/fileblob.py | python/fileblob.py | #!/usr/bin/env python
import os
MEGABYTE = 1024 * 1024
class FileBlob:
def __init__(self, path):
self.path = path
def data(self):
return open(self.path).read()
def size(self):
try:
return os.path.getsize(self.path)
except os.error:
return 0
d... | mit | Python | |
5c1e1744fa19bf900981d6a40c69195419861357 | Add snactor sanity-check command (#564) | leapp-to/prototype,leapp-to/prototype,leapp-to/prototype,leapp-to/prototype | leapp/snactor/commands/workflow/sanity_check.py | leapp/snactor/commands/workflow/sanity_check.py | from __future__ import print_function
import sys
from leapp.exceptions import LeappError, CommandError
from leapp.logger import configure_logger
from leapp.repository.scan import find_and_scan_repositories
from leapp.snactor.commands.workflow import workflow
from leapp.utils.clicmd import command_arg
from leapp.utils.... | lgpl-2.1 | Python | |
489004c5f81b8a5a2a639bc67f3ed5008f18960a | fix the naming error of the plotting script | berkeley-stat222/mousestyles,changsiyao/mousestyles,togawa28/mousestyles | doc/source/report/plots/plot_hc_dendrogram.py | doc/source/report/plots/plot_hc_dendrogram.py | from mousestyles import data
from mousestyles.classification import clustering
from mousestyles.visualization import plot_clustering
# load data
mouse_data = data.load_all_features()
# mouse inidividual
mouse_dayavgstd_rsl = clustering.prep_data(mouse_data, melted=False, std = True, rescale = True)
# optimal parame... | bsd-2-clause | Python | |
37d851bb34552edfc3b1abd4d1034d4fdf46408f | Implement --remote | mhinz/neovim-remote,mhinz/neovim-remote | nvim-remote.py | nvim-remote.py | #!/usr/bin/env python3
"""
Copyright (c) 2015 Marco Hinz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, ... | mit | Python | |
af1bb3d1eb5fa0e827d0484a620d99adbaaf207e | Select GC candiates by color | AlexaVillaume/Archive,SAGES-UCSC/Photometry,SAGES-UCSC/Photometry,AlexaVillaume/Archive | makeColorCut.py | makeColorCut.py | import math
import numpy as np
import matplotlib.pyplot as plt
from pylab import *
'''
def makePlots():
x = [1, 2, 3, 4]
y = calcY(x, 0.48, -.23)
y1 = calcY(x, 0.48, -.43)
y2 = calcY(x, 0.48, -.03)
plt.plot(x, y, linestyle='-', linewidth=3)
plt.plot(x, y1, linestyle='-', linewidth=3)
plt.pl... | unlicense | Python | |
49424b855f043ae2bbb3562481493b1fa83f5090 | add random selection wip code | aaronfang/personal_scripts | af_scripts/tmp/randSelect.py | af_scripts/tmp/randSelect.py | import random as rd
list = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
randList = list
#print randList
div=3
listSize=len(list)
#print listSize
numForOnePart=listSize/div
#print numForOnePart
rd.shuffle(randList)
#print randList
print [randList[i::3... | mit | Python | |
7d4281574a9ee2a8e7642f14402a452f82a807db | Create smarthome.py | kankiri/pabiana | demos/smarthome/smarthome.py | demos/smarthome/smarthome.py | import logging
from pabiana import area
from pabiana.area import autoloop, load_interfaces, pulse, register, scheduling, subscribe
from pabiana.node import create_publisher, run
NAME = 'smarthome'
publisher = None
# Triggers
@register
def increase_temp():
area.context['temperature'] += 0.25
autoloop(increase_temp... | mit | Python | |
a0493ff48b96056709880804f61e794621886c61 | Add CoNLL reader tests | vene/comparison-pattern | compattern/dependency/tests/test_conll.py | compattern/dependency/tests/test_conll.py | # encoding: utf8
from compattern.dependency import conll
def test_read_french():
"""Test that conll.read understands French Bonsai output"""
line = (u"6\tchauffé\tchauffer\tV\tVPP\tg=m|m=part|n=s|t=past\t"
u"1100011\t5\tdep_coord\t_\t_")
sentence = conll.read([line, '\n'])[0]
assert len(s... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.