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 |
|---|---|---|---|---|---|---|---|---|
8410b027987f088b86989898b4fade5b0960886a | Solve problem 2 | mazayus/ProjectEuler | problem002.py | problem002.py | #!/usr/bin/env python3
def fibs(maxnumber):
fib1, fib2 = 1, 2
while fib1 < maxnumber:
yield fib1
fib1, fib2 = fib2, fib1 + fib2
print(sum(f for f in fibs(4000000) if f % 2 == 0))
| mit | Python | |
278920272efd7ab959d7cad5b5f7d6c17935c7e6 | Add problem 35, circular primes | dimkarakostas/project-euler | problem_35.py | problem_35.py | from math import sqrt
from time import time
PRIME_STATUS = {}
def is_prime(n):
if n == 2:
return True
if n % 2 == 0 or n <= 1:
return False
for i in range(3, int(sqrt(n))+1, 2):
if n % i == 0:
return False
return True
def check_prime_circles(num):
circles = [... | mit | Python | |
dad430fd56b8be22bd1a3b9773f9948c3e305883 | Add unit tests for lazy strings | CovenantEyes/py_stringlike | stringlike/test/lazy_tests.py | stringlike/test/lazy_tests.py | import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))
from stringlike.lazy import LazyString, CachedLazyString
from unittest import main, TestCase
class TestLazyString(TestCase):
def test_equality(self):
self.assertEqual(LazyString(lambda: 'abc'), ... | mit | Python | |
458d2e55de4db6c9f72758b745245301ebd02f48 | Add solution 100 | byung-u/ProjectEuler | 100_to_199/euler_100.py | 100_to_199/euler_100.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Problem 100
If a box contains twenty-one coloured discs, composed of fifteen blue discs and six red discs, and two discs were taken at random, it can be seen that the probability of taking two blue discs, P(BB) = (15/21)ร(14/20) = 1/2.
The next such arrangement, for w... | mit | Python | |
c421024bfd1660685bb6ec6cb84a0369244627c5 | add celery module | theirc/ServiceInfo,theirc/ServiceInfo-ircdeploy,theirc/ServiceInfo,theirc/ServiceInfo,theirc/ServiceInfo | service_mapper/celery.py | service_mapper/celery.py | from __future__ import absolute_import
import os
from celery import Celery
from django.conf import settings
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'service_mapper.settings')
app = Celery('service_mapper')
# Using a string here means the w... | bsd-3-clause | Python | |
2eb05eb7d42f1b14191cccba2563c2105fabaed1 | Add processing module | petebachant/waveFlapper-OpenFOAM,petebachant/waveFlapper-OpenFOAM,petebachant/waveFlapper-OpenFOAM | processing.py | processing.py | #!/usr/bin/env python
"""
Processing routines for the waveFlapper case.
"""
import foampy
import numpy as np
import matplotlib.pyplot as plt
width_2d = 0.1
width_3d = 3.66
def plot_force():
"""Plots the streamwise force on the paddle over time."""
def plot_moment():
data = foampy.load_forces_moments()
... | cc0-1.0 | Python | |
df0e285b6f8465eb273af50c242299c5601fa09f | Add a new example | channelcat/sanic,yunstanford/sanic,channelcat/sanic,ashleysommer/sanic,channelcat/sanic,yunstanford/sanic,Tim-Erwin/sanic,channelcat/sanic,yunstanford/sanic,lixxu/sanic,Tim-Erwin/sanic,ai0/sanic,jrocketfingers/sanic,lixxu/sanic,r0fls/sanic,jrocketfingers/sanic,ai0/sanic,ashleysommer/sanic,yunstanford/sanic,lixxu/sanic,... | examples/sanic_aiomysql_with_global_pool.py | examples/sanic_aiomysql_with_global_pool.py | # encoding: utf-8
"""
You need the aiomysql
"""
import asyncio
import os
import aiomysql
import uvloop
from sanic import Sanic
from sanic.response import json
database_name = os.environ['DATABASE_NAME']
database_host = os.environ['DATABASE_HOST']
database_user = os.environ['DATABASE_USER']
database_password = os.envi... | mit | Python | |
e7b6aef4db85c777463d2335107145b60b678ae2 | Create a new tour example | seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase | examples/tour_examples/maps_introjs_tour.py | examples/tour_examples/maps_introjs_tour.py | from seleniumbase import BaseCase
class MyTourClass(BaseCase):
def test_google_maps_tour(self):
self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
self.wait_for_element("#searchboxinput")
self.wait_for_element("#minimap")
self.wait_for_element("#zoom")
s... | mit | Python | |
8ddc9333513a2e900ff61b6d2904db3e58635bb9 | add initial self_publish version | NoRedInk/elm-ops-tooling,NoRedInk/elm-ops-tooling | elm_self_publish.py | elm_self_publish.py | #! /usr/bin/env python
from __future__ import print_function
import sys
import json
import shutil
import argparse
def copy_package(location, destination):
shutil.copytree(location, destination)
def package_name(url):
""" get the package name from a github url """
project = url.split('/')[-1].split('.')[... | bsd-3-clause | Python | |
a004611ceb3402c95675a749eb9a3db764c97e51 | Move cython_build_ext command to utils.distutils and put it to setup.cfg | edgedb/edgedb,edgedb/edgedb,edgedb/edgedb | edgedb/lang/common/distutils.py | edgedb/lang/common/distutils.py | ##
# Copyright (c) 2014 Sprymix Inc.
# All rights reserved.
#
# See LICENSE for details.
##
from distutils.command import build_ext as _build_ext
class cython_build_ext(_build_ext.build_ext):
def __init__(self, *args, **kwargs):
self._ctor_args = args
self._ctor_kwargs = kwargs
self._cyt... | apache-2.0 | Python | |
bc235b15bbeacf7fee7e1d23a5d94b6271e33e41 | Add initial code | adamjforster/rpsls | rpsls.py | rpsls.py | #!/usr/bin/python
from collections import OrderedDict
from random import choice, seed
from sys import exit
WEAPONS = OrderedDict([
('rock', 1),
('paper', 2),
('scissors', 3),
('lizard', 5),
('spock', 4)
])
EXPLANATIONS = {
'lizardlizard': 'Lizard equals lizard',
'lizardpaper': 'Lizard e... | bsd-3-clause | Python | |
43c74dc2dbe82a30f7a9b6c0403db39eb159fc96 | add control panel test for fetch | andela-sjames/paystack-python | paystackapi/tests/test_cpanel.py | paystackapi/tests/test_cpanel.py | import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.cpanel import ControlPanel
class TestPage(BaseTestCase):
@httpretty.activate
def test_fetch_payment_session_timeout(self):
"""Method defined to test fetch payment session timeout."""
httpretty.registe... | mit | Python | |
233db6d2decad39c98bf5cbe8b974f93308bea16 | Create re.py | GuardianRG/Learn,GuardianRG/Learn,XlogicX/Learn,XlogicX/Learn,XlogicX/Learn,GuardianRG/Learn,GuardianRG/Learn,GuardianRG/Learn,XlogicX/Learn,GuardianRG/Learn,XlogicX/Learn,XlogicX/Learn,GuardianRG/Learn,XlogicX/Learn | python2.7/re.py | python2.7/re.py | #/usr/bin/python
import re
#Shows how to test if a string matches a regular expression (yes/no) and uses more than one modifier
expression = re.compile(r"^\w+.+string", re.I | re.S) #compile the expression
if expression.match("A Simple String To Test"): #See if a string matches it
print "Matched"
else:
print "Did N... | mit | Python | |
d93916b1927f0ae099cee3cf93619d3113db147b | Add small example of basic anomaly detection w/peewee. | coleifer/peewee,coleifer/peewee,coleifer/peewee | examples/anomaly_detection.py | examples/anomaly_detection.py | import math
from peewee import *
db = SqliteDatabase(':memory:')
class Reg(Model):
key = TextField()
value = IntegerField()
class Meta:
database = db
db.create_tables([Reg])
# Create a user-defined aggregate function suitable for computing the standard
# deviation of a series.
@db.aggregate('... | mit | Python | |
12b334983be4caf0ba97534b52f928180e31e564 | add quick script to release lock | texastribune/salesforce-stripe,MinnPost/salesforce-stripe,texastribune/salesforce-stripe,texastribune/salesforce-stripe,MinnPost/salesforce-stripe,MinnPost/salesforce-stripe | release-lock.py | release-lock.py | from batch import Lock
lock = Lock(key="charge-cards-lock")
lock.release()
| mit | Python | |
687a186bd29eb1bef7a134fa5499c9b4c56abaa6 | Create setup.py | sontung/pick_a_number | setup.py | setup.py | from distutils.core import setup
import py2exe, os, pygame
origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
if os.path.basename(pathname).lower() in ["sdl_ttf.dll"]:
return 0
return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL
pygamedir = os.path.split(py... | mit | Python | |
8dfdcfa0f1d13e810a6e56e0a031f15dbaba3656 | Use environment metadata for conditional dependencies | skirsdeda/djangocms-blog,kriwil/djangocms-blog,jedie/djangocms-blog,ImaginaryLandscape/djangocms-blog,skirsdeda/djangocms-blog,motleytech/djangocms-blog,sephii/djangocms-blog,mistalaba/djangocms-blog,nephila/djangocms-blog,vnavascues/djangocms-blog,britny/djangocms-blog,britny/djangocms-blog,skirsdeda/djangocms-blog,Dj... | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import djangocms_blog
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
version = djangocms_blog.__version__
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
print("You pro... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import djangocms_blog
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
version = djangocms_blog.__version__
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
print("You pro... | bsd-3-clause | Python |
2e57e929db19ebd864680d4616eb1bba595f1e57 | Create setup.py | LawtonSoft/Fram3w0rk-Python | setup.py | setup.py | from distutils.core import setup
setup(
name = 'fram3w0rk-python',
packages = ['fram3w0rk-python'],
version = '0.5',
description = '"Class" effort to unify functions across 30 languages.',
author = 'Jonathan Lawton',
author_email = 'jlawton@lawtonsoft.com',
url = 'https://github.com/LawtonSoft/Fram3w0rk-P... | mit | Python | |
b0184d74d0f186662df8596f511f95e1130bcf20 | Add libffi package | BreakawayConsulting/xyz | rules/libffi.py | rules/libffi.py | import xyz
import os
import shutil
class Libffi(xyz.BuildProtocol):
pkg_name = 'libffi'
def configure(self, builder, config):
builder.host_lib_configure(config=config)
rules = Libffi()
| mit | Python | |
e846a9c77f98e61287a37953fdbee570208dd2d5 | add setup.py for python packaging | astromme/pinyinflix | setup.py | setup.py | """A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.absp... | apache-2.0 | Python | |
b1d08df29b02c107bbb2f2edc9add0c6f486c530 | Add app | JokerQyou/bot | app.py | app.py | # coding: utf-8
import json
import flask
from flask import request
import telegram
__name__ = u'eth0_bot'
__author__ = u'Joker_Qyou'
__config__ = u'config.json'
app = flask.Flask(__name__)
app.debug = False
with open(__config__, 'r') as cfr:
config = json.loads(cfr.read())
bot = telegram.Bot(token=token_info)
... | bsd-2-clause | Python | |
69f787a69e400b69fa4aef2e49f6f03781304dae | Update setup.py. | LogicalKnight/python-astm,123412345/python-astm,andrexmd/python-astm,MarcosHaenisch/python-astm,Alwnikrotikz/python-astm,tinoshot/python-astm,asingla87/python-astm,kxepal/python-astm,kxepal/python-astm,pombreda/python-astm,tectronics/python-astm,Iskander1b/python-astm,eddiep1101/python-astm,briankip/python-astm,mhaulo/... | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
from astm.version import __version__
try:
from setuptools import setup, find_... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
from astm.version import __version__
try:
from setuptools import setup, find_... | bsd-3-clause | Python |
19b6d71e17f616bed3566d5615b5938bbfe3a497 | Add setup.py | HTTP-APIs/hydrus,xadahiya/hydrus | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name='hydrus',
version='0.0.1',
description='A space-based application for W3C HYDRA Draft',
author='W3C HYDRA development group',
author_email='public-hydra@w3.org',
url='https://github.com/HTTP-APIs/hydrus',
packages=['... | mit | Python | |
e2ae0798424d4aa0577e22d563646856866fbd1f | add setup.py file for pypi | byteweaver/django-versioncheck | setup.py | setup.py | import os
from setuptools import setup, find_packages
import versioncheck
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='django-versioncheck',
version=versioncheck.__version__,
description='A small django app which tries to be annoying if your django... | bsd-3-clause | Python | |
d43bcc978b1d79a20820ab1df73bd69d5d3c100d | Add setup.py | JPO1/BigQuery-Python,hagino3000/BigQuery-Python,tylertreat/BigQuery-Python,fusioneng/BigQuery-Python,blarghmatey/BigQuery-Python | setup.py | setup.py | from setuptools import find_packages
from setuptools import setup
VERSION = '0.0.1'
setup_args = dict(
name='BigQuery-Python',
description='Simple Python client for interacting with Google BigQuery.',
url='https://github.com/tylertreat/BigQuery-Python',
version=VERSION,
license='Apache',
packa... | apache-2.0 | Python | |
840e178a85da246d8357481a8e6ea5a8d87deef7 | Create setup.py | JoeVirtual/KonFoo | setup.py | setup.py | """
KonF'00'
~~~~~~~~
KonFoo is a Python Package for creating byte stream mappers in a declarative
way with as little code as necessary to help fighting the confusion with the
foo of the all too well-known memory dumps or binary data.
Setup
-----
.. code:: bash
$ pip install KonFoo
Links
-----
* `website <http:... | bsd-3-clause | Python | |
10ccc510deab5c97ce8a6c5ee57232c5e399986e | Add decision tree classifier attempt. | andretadeu/jhu-immuno,andretadeu/jhu-immuno | decision_tree.py | decision_tree.py | import pandas as pd
from sklearn import tree
# X = [[0, 1], [1, 1]]
# Y = [0, 1]
#clf = tree.DecisionTreeClassifier()
#clf = clf.fit(X, Y)
data = pd.read_excel('/home/andre/sandbox/jhu-immuno/journal.pcbi.1003266.s001-2.XLS')
resp_cols = [ 'MHC' ]
data['y'] = data.Immunogenicity.map({'non-immunogenic': 0, 'immunoge... | mit | Python | |
efe596e3f935fe31af5bcbd8ef1afbb6750be123 | add a setup.py | jalanb/kd,jalanb/kd | setup.py | setup.py | """Set up the kd project"""
from setuptools import setup
import kd
setup(
name='kd',
version=kd.__version__,
url='https://github.com/jalanb/kd',
license='MIT License',
author='J Alan Brogan',
author_email='kd@al-got-rhythm.net',
description='kd is a smarter cd',
platforms='any',
... | mit | Python | |
9220523e6bcac6b80410a099b2f2fd30d7cbb7d3 | Add first draft of setup.py | weinshec/pyAPT | setup.py | setup.py | from setuptools import setup
setup(
name = 'pyAPT',
version = '0.1.0',
author = 'Christoph Weinsheimer',
author_email = 'christoph.weinsheimer@desy.de',
packages = ['pyAPT'],
scripts = [],
description = 'Controller module for Thorlabs... | mit | Python | |
49a7fdc78cd71b75b1fbcc0023e428479ce38f41 | Implement a cryptographic hash function | ElliotPenson/cryptography | sha_1.py | sha_1.py | #!/usr/local/bin/python
"""
sha_1.py
@author Elliot and Erica
"""
from cryptography_utilities import (wrap_bits_left, decimal_to_binary,
binary_to_decimal, pad_plaintext, block_split, bitwise_and,
bitwise_or, bitwise_xor, bitwise_not, hex_to_binary)
BLOCKSIZE = 512
SUB_BLOCKSIZE = 32
SHA_1_INTERVALS = 80
... | mit | Python | |
d923548321961bad8dcbe15a31ceaeda79aae934 | Create xr.py | memfiz/telnet | xr.py | xr.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
'''Element Manager xr class'''
__author__ = "Arnis Civciss (arnis.civciss@lattelecom.lv)"
__copyright__ = "Copyright (c) 2012 Arnis Civciss"
#__version__ = "$Revision: 0.1 $"
#__date__ = "$Date: 2012/01/08 $"
#__license__ = ""
import re
from lib.telnet import Telnet
clas... | bsd-2-clause | Python | |
31d018181c5183acadbe309a250aed17cbae5a28 | Create Add_Binary.py | UmassJin/Leetcode | Array/Add_Binary.py | Array/Add_Binary.py | Given two binary strings, return their sum (also a binary string).
For example,
a = "11"
b = "1"
Return "100".
class Solution:
# @param a, a string
# @param b, a string
# @return a string
def addBinary(self, a, b):
A = len(a)
B = len(b)
i = 1
result = []
carry =... | mit | Python | |
12192eca146dc1974417bd4fd2cf3722e0049910 | add arduino example | sourceperl/pyRRD_Redis,sourceperl/pyRRD_Redis,sourceperl/pyRRD_Redis | example/ard2rrd.py | example/ard2rrd.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Arduino UNO A0 value to RRD db
# - read an integer from a serial port and store it on RRD redis database
import serial
from pyRRD_Redis import RRD_redis, StepAddFunc
# some const
TAG_NAME = 'arduino_a0'
# init serial port and RRD db
ser = serial.Serial(port='/dev/tt... | mit | Python | |
013ee19808dc86d29cb3aa86b38dc35fe98a5580 | add to and remove from /etc/hosts some agent node info so condor can recognise its workers | ema/conpaas,ema/conpaas,ema/conpaas,ema/conpaas,ema/conpaas | conpaas-services/src/conpaas/services/htcondor/manager/node_info.py | conpaas-services/src/conpaas/services/htcondor/manager/node_info.py | """
Copyright (c) 2010-2013, Contrail consortium.
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 conditions
... | bsd-3-clause | Python | |
2f47284b44ceef3c12990a4f9621062040fe6fcb | Add day 4 solution | jesserobertson/advent | day4.py | day4.py | #!/usr/bin/env python
from hashlib import md5
tests = ['abcdef', 'pqrstuv']
string = 'iwrupvqb'
for idx in range(10000000):
hash = md5((string + str(idx)).encode('ascii'))
if hash.hexdigest().startswith('000000'):
print(idx)
break
| mit | Python | |
e5008fdf481a80db3b5583d35e6fd369a28cd7ce | drop session_details for sessions | opencivicdata/pupa,datamade/pupa,opencivicdata/pupa,rshorey/pupa,influence-usa/pupa,datamade/pupa,mileswwatkins/pupa,mileswwatkins/pupa,rshorey/pupa,influence-usa/pupa | example/__init__.py | example/__init__.py | from pupa.scrape import Jurisdiction
from .people import PersonScraper
class Example(Jurisdiction):
jurisdiction_id = 'ocd-jurisdiction/country:us/state:ex/place:example'
name = 'Example Legislature'
url = 'http://example.com'
provides = ['people']
parties = [
{'name': 'Independent' },
... | from pupa.scrape import Jurisdiction
from .people import PersonScraper
class Example(Jurisdiction):
jurisdiction_id = 'ocd-jurisdiction/country:us/state:ex/place:example'
name = 'Example Legislature'
url = 'http://example.com'
provides = ['people']
parties = [
{'name': 'Independent' },
... | bsd-3-clause | Python |
863fbee6edc89b68412831677391bc51e41a1e03 | add combine program | wclark3/machine-learning,wclark3/machine-learning,wclark3/machine-learning | final-project/code/combine.py | final-project/code/combine.py | #!/usr/bin/env python
import argparse
import os
import re
import time
import pandas as pd
import numpy as np
COORD_COLUMNS = [
"left_eye_center_x", "left_eye_center_y",
"right_eye_center_x", "right_eye_center_y",
"left_eye_inner_corner_x", "left_eye_inner_corner_y",
"left_ey... | mit | Python | |
04bc7c9bfe017f981a73a55b51587343725a2159 | edit 2 | ArtezGDA/text-IO,ArtezGDA/text-IO,ArtezGDA/text-IO,ArtezGDA/text-IO,ArtezGDA/text-IO | Floris/dexter.py | Floris/dexter.py | serie = {
'seasons': [
{
'name': 'S01',
'year': 2006,
'director': "James Manos Jr.",
'episodes': [
{'name': 's01e01', 'title': "Pilot"},
{'name': 's01e01', 'title': "Crocodile"},
{'name': 's01e01', 'title': "Popping Cherry"},
{'name': 's01e01', 'title': "Let's give the boy a hand"}
]... | mit | Python | |
cd9c9080a00cc7e05b5ae4574dd39ddfc86fef3b | Create enc.py | flipmarley/encrypt-and-wrap | enc.py | enc.py | #!/usr/bin/python
"""
Generate encrypted messages wrapped in a self-decrypting python script
usage: python enc.py password > out.py
where password is the encryption password and out.py is the message/script file
to decrypt use: python out.py password
this will print the message to stdout.
"""
import sys, random
def e... | mit | Python | |
8adfedd0c30fab796fccac6ec58c09e644a91b2f | Add script to shuffle paired fastq sequences. | roryk/junkdrawer,roryk/junkdrawer | shuffle_fastq.py | shuffle_fastq.py | # shuffles the sequences in a fastq file
import os
import random
from Bio import SeqIO
import fileinput
from argparse import ArgumentParser
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument("--fq1", required="True")
parser.add_argument("--fq2", required="True")
args = parser.pars... | mit | Python | |
f9e11b0e9eb5a69adaa2021499acf329023aca09 | Add Python bindings | pcercuei/libini,pcercuei/libini | ini.py | ini.py | from ctypes import POINTER, Structure, cdll, c_char_p, c_int, c_uint, byref
from sys import argv
def _checkOpen(result, func, arguments):
if result:
return result
else:
raise IOError("Failed to open INI file: '%s'" % arguments[0])
def _checkRead(result, func, arguments):
if result == -1:
raise SyntaxError("E... | lgpl-2.1 | Python | |
b7f9e5555481ba4e34bcc12beecf540d3204a15f | Fix pep8 issue | dbravender/raven-python,jmp0xf/raven-python,dirtycoder/opbeat_python,Photonomie/raven-python,daikeren/opbeat_python,dirtycoder/opbeat_python,recht/raven-python,nikolas/raven-python,ewdurbin/raven-python,ronaldevers/raven-python,tarkatronic/opbeat_python,patrys/opbeat_python,arthurlogilab/raven-python,lopter/raven-pytho... | raven/contrib/celery/__init__.py | raven/contrib/celery/__init__.py | """
raven.contrib.celery
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
try:
from celery.task import task
except ImportError:
from celery.decorators import task
from celery.signals import task_failure
from ra... | """
raven.contrib.celery
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
try:
from celery.task import task
except ImportError:
from celery.decorators import task
from celery.signals import task_failure
from ra... | bsd-3-clause | Python |
dba14e6dfbaacf79d88f1be0b831488f45fc1bfc | Create coroutine.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | gateway/src/test/coroutine.py | gateway/src/test/coroutine.py | #!/usr/bin/python3.5
import asyncio
import time
now = lambda: time.time()
async def func(x):
print('Waiting for %d s' % x)
await asyncio.sleep(x)
return 'Done after {}s'.format(x)
start = now()
coro1 = func(1)
coro2 = func(2)
coro3 = func(4)
tasks = [
asyncio.ensure_future(coro1),
asyncio.ensure... | mit | Python | |
b9d47f54b76345f0c8f7d486282fc416ba540aee | Add specs for ArgumentParser | codeclimate/python-test-reporter,codeclimate/python-test-reporter | tests/test_argument_parser.py | tests/test_argument_parser.py | import pytest
from codeclimate_test_reporter.components.argument_parser import ArgumentParser
def test_parse_args_default():
parsed_args = ArgumentParser().parse_args([])
assert(parsed_args.file == "./.coverage")
assert(parsed_args.token is None)
assert(parsed_args.stdout is False)
assert(parsed... | mit | Python | |
614579c38bea10798d285ec2608650d36369020a | add test demonstrating duplicate stream handling | malwarefrank/dnfile | tests/test_invalid_streams.py | tests/test_invalid_streams.py | import fixtures
import dnfile
def test_duplicate_stream():
path = fixtures.DATA / "invalid-streams" / "duplicate-stream.exe"
dn = dnfile.dnPE(path)
assert "#US" in dn.net.metadata.streams
assert dn.net.user_strings.get_us(1).value == "BBBBBBBB" | mit | Python | |
ffb5caf83055e734baf711366b6779ecb24a013c | Add script to generate other adobe themes | Geequlim/godot-themes | addons/adobe/clone.py | addons/adobe/clone.py | #!/usr/bin/env python
from PIL import Image, ImageEnhance
import PIL.ImageOps
import fnmatch
import shutil
import os
def globPath(path, pattern):
result = []
for root, subdirs, files in os.walk(path):
for filename in files:
if fnmatch.fnmatch(filename, pattern):
result.appen... | mit | Python | |
c5ecaef62d788b69446181c6ba495cb273bf98ef | Add rolling mean scatter plot example | altair-viz/altair,jakevdp/altair | altair/examples/scatter_with_rolling_mean.py | altair/examples/scatter_with_rolling_mean.py | """
Scatter Plot with Rolling Mean
------------------------------
A scatter plot with a rolling mean overlay. In this example a 30 day window
is used to calculate the mean of the maximum temperature around each date.
"""
# category: scatter plots
import altair as alt
from vega_datasets import data
source = data.seatt... | bsd-3-clause | Python | |
5ec793ffb8c260a02ab7da655b5f56ff3c3f5da7 | add find_anagrams.py | gsathya/dsalgo,gsathya/dsalgo | algo/find_anagrams.py | algo/find_anagrams.py | words = "oolf folo oolf lfoo fool oofl fool loof oofl folo abr bra bar rab rba abr arb bar abr abr"
words = [word.strip() for word in words.split(" ")]
anagrams = {}
for word in words:
sorted_word = ''.join(sorted(word))
anagrams[sorted_word] = anagrams.get(sorted_word, []) + [word]
print anagrams
| mit | Python | |
f830c778fd06e1548da0b87aafa778834005c64e | Add fls simprocedures | iamahuman/angr,chubbymaggie/angr,axt/angr,schieb/angr,axt/angr,schieb/angr,f-prettyland/angr,angr/angr,iamahuman/angr,tyb0807/angr,iamahuman/angr,tyb0807/angr,chubbymaggie/angr,angr/angr,f-prettyland/angr,axt/angr,chubbymaggie/angr,f-prettyland/angr,schieb/angr,tyb0807/angr,angr/angr | angr/procedures/win32/fiber_local_storage.py | angr/procedures/win32/fiber_local_storage.py | import angr
KEY = 'win32_fls'
def mutate_dict(state):
d = dict(state.globals.get(KEY, {}))
state.globals[KEY] = d
return d
def has_index(state, idx):
if KEY not in state.globals:
return False
return idx in state.globals[KEY]
class FlsAlloc(angr.SimProcedure):
def run(self, callback):... | bsd-2-clause | Python | |
1bda23c9e6fee7815617a8ad7f64c80a32e223c5 | Add script for jira story point report. | YzPaul3/h2o-3,mrgloom/h2o-3,PawarPawan/h2o-v3,h2oai/h2o-dev,h2oai/h2o-3,spennihana/h2o-3,michalkurka/h2o-3,tarasane/h2o-3,madmax983/h2o-3,spennihana/h2o-3,pchmieli/h2o-3,PawarPawan/h2o-v3,spennihana/h2o-3,junwucs/h2o-3,mathemage/h2o-3,printedheart/h2o-3,brightchen/h2o-3,tarasane/h2o-3,junwucs/h2o-3,junwucs/h2o-3,mathem... | scripts/jira.py | scripts/jira.py | #!/usr/bin/python
import sys
import os
import requests
import urllib
g_user = None
g_pass = None
g_sprint = None
def usage():
print("")
print("usage: " + g_script_name + " --user username --pass password --sprint sprintname")
print("")
sys.exit(1)
def unknown_arg(s):
print("")
print("ERR... | apache-2.0 | Python | |
a24095964e32da33ea946b3c28bdc829a505585d | Add lidar example | trikset/trik-models,trikset/trik-models,trikset/trik-models,trikset/trik-models | lidar.py | lidar.py | """ Copyright 2021 CyberTech Labs Ltd.
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... | apache-2.0 | Python | |
ccf1fb5d5ef1e2b12bc49afd260b1d2d0a166a43 | Prepare v2.20.7.dev | ianstalk/Flexget,JorisDeRieck/Flexget,ianstalk/Flexget,crawln45/Flexget,Danfocus/Flexget,Flexget/Flexget,tobinjt/Flexget,gazpachoking/Flexget,ianstalk/Flexget,crawln45/Flexget,crawln45/Flexget,tobinjt/Flexget,JorisDeRieck/Flexget,Danfocus/Flexget,tobinjt/Flexget,JorisDeRieck/Flexget,Flexget/Flexget,Flexget/Flexget,Danf... | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | mit | Python |
950e6b975323293ed8b73a5ffe8448072e0dac27 | Fix downloader | mojoBrendan/fmt,wangshijin/cppformat,alabuzhev/fmt,cppformat/cppformat,seungrye/cppformat,wangshijin/cppformat,blaquee/cppformat,wangshijin/cppformat,dean0x7d/cppformat,lightslife/cppformat,nelson4722/cppformat,seungrye/cppformat,seungrye/cppformat,lightslife/cppformat,dean0x7d/cppformat,lightslife/cppformat,nelson4722... | support/download.py | support/download.py | # A file downloader.
import contextlib, os, tempfile, timer, urllib2, urlparse
class Downloader:
def __init__(self, dir=None):
self.dir = dir
# Downloads a file and removes it when exiting a block.
# Usage:
# d = Downloader()
# with d.download(url) as f:
# use_file(f)
def download(self, url, c... | # A file downloader.
import contextlib, os, tempfile, timer, urllib2, urlparse
class Downloader:
def __init__(self, dir=None):
self.dir = dir
# Downloads a file and removes it when exiting a block.
# Usage:
# d = Downloader()
# with d.download(url) as f:
# use_file(f)
def download(self, url, c... | bsd-2-clause | Python |
7c84bfb5a37705cc824489b0c1c5aba415ccff6b | Split out of SWDCommon.py | kcuzner/PySWD,pfalcon/PySWD,heartscrytech/PySWD,heartscrytech/PySWD,pfalcon/PySWD,kcuzner/PySWD,pfalcon/PySWD | DebugPort.py | DebugPort.py | class DebugPort:
ID_CODES = (
0x1BA01477, # EFM32
0x2BA01477, # STM32
0x0BB11477, # NUC1xx
)
def __init__ (self, swd):
self.swd = swd
# read the IDCODE
# Hugo: according to ARM DDI 0316D we should have 0x2B.. not 0x1B.., but
# 0x1B.. is what upstr... | bsd-3-clause | Python | |
570aaad3da93f9252efb787a58bbe5151eff93d4 | Create run_ToolKit.py | Pharaoh00/Pharaoh-Toolkit | 0.0.5/run_ToolKit.py | 0.0.5/run_ToolKit.py | # run_ToolKit.py
from modulos import main
if __name__ == "__main__":
main.main()
| mit | Python | |
857ccf7f6cfed4e8663d635c119f8683c9ee09e0 | Add random choice plugin (with_random_choice) | thaim/ansible,thaim/ansible | lib/ansible/runner/lookup_plugins/random_choice.py | lib/ansible/runner/lookup_plugins/random_choice.py | # (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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 lat... | mit | Python | |
b3f91806b525ddef50d541f937bed539f9bae20a | Use cache backend for sessions in deployed settings. | Kniyl/mezzanine,webounty/mezzanine,spookylukey/mezzanine,theclanks/mezzanine,batpad/mezzanine,sjdines/mezzanine,dovydas/mezzanine,readevalprint/mezzanine,eino-makitalo/mezzanine,industrydive/mezzanine,joshcartme/mezzanine,Cajoline/mezzanine,frankier/mezzanine,PegasusWang/mezzanine,biomassives/mezzanine,Skytorn86/mezzan... | mezzanine/project_template/deploy/live_settings.py | mezzanine/project_template/deploy/live_settings.py |
DATABASES = {
"default": {
# Ends with "postgresql_psycopg2", "mysql", "sqlite3" or "oracle".
"ENGINE": "django.db.backends.postgresql_psycopg2",
# DB name or path to database file if using sqlite3.
"NAME": "%(proj_name)s",
# Not used with sqlite3.
"USER": "%(proj_na... |
DATABASES = {
"default": {
# Ends with "postgresql_psycopg2", "mysql", "sqlite3" or "oracle".
"ENGINE": "django.db.backends.postgresql_psycopg2",
# DB name or path to database file if using sqlite3.
"NAME": "%(proj_name)s",
# Not used with sqlite3.
"USER": "%(proj_na... | bsd-2-clause | Python |
62545500553443863d61d9e5ecc80307c745a227 | Add migration to remove non-{entity,classifier} dimensions from the database, and to recompute cubes if necessary | CivicVision/datahub,openspending/spendb,johnjohndoe/spendb,USStateDept/FPA_Core,spendb/spendb,johnjohndoe/spendb,openspending/spendb,nathanhilbert/FPA_Core,pudo/spendb,openspending/spendb,nathanhilbert/FPA_Core,spendb/spendb,CivicVision/datahub,pudo/spendb,USStateDept/FPA_Core,pudo/spendb,nathanhilbert/FPA_Core,USState... | migrate/20110917T143029-remove-value-dimensions.py | migrate/20110917T143029-remove-value-dimensions.py | import logging
from openspending.lib import cubes
from openspending import migration, model, mongo
log = logging.getLogger(__name__)
def up():
group_args = ({'dataset':1}, {}, {'num': 0},
'function (x, acc) { acc.num += 1 }')
before = mongo.db.dimension.group(*group_args)
dims = model.... | agpl-3.0 | Python | |
87cbdd44ee17ecc5951b6f062a160c9fad465053 | add BaiduMap | PKU-Dragon-Team/Datalab-Utilities | BaiduMap/__init__.py | BaiduMap/__init__.py | import png, numpy
import matplotlib.pyplot as plt
import json, urllib.request, collections.abc, os, sys
from urllib.parse import quote_plus
from collections import OrderedDict
AK = None
SERVER_URL = None
__location__ = os.path.join(os.getcwd(), os.path.dirname(os.path.realpath(__file__)))
with open(os.path.join(__l... | mit | Python | |
c599b5d470cf80b964af1b261a11540516e120df | Add Dehnen smoothing as a wrapper | jobovy/galpy,jobovy/galpy,jobovy/galpy,jobovy/galpy | galpy/potential_src/DehnenSmoothWrapperPotential.py | galpy/potential_src/DehnenSmoothWrapperPotential.py | ###############################################################################
# DehnenSmoothWrapperPotential.py: Wrapper to smoothly grow a potential
###############################################################################
from galpy.potential_src.WrapperPotential import SimpleWrapperPotential
class DehnenSm... | bsd-3-clause | Python | |
ddc61e8158fb1dfb33b30a19f7e9cd3be8eaf3a2 | add app.py | xianjunzhengbackup/Cloud-Native-Python,xianjunzhengbackup/Cloud-Native-Python,xianjunzhengbackup/Cloud-Native-Python | app.py | app.py | from flask import Flask
app = Flask(__name__)
if __name__ == "__main__":
app.run(host='0.0.0.0', port=5000, debug=True)
| mit | Python | |
cab4b903b986a7f8bfe4955bf80190bb7f33b012 | Create bot.py | tenkisi/markovtweet | bot.py | bot.py | # -*- coding: utf-8 -*-
import twitter_key
import tweepy
import markovtweet
def auth():
auth = tweepy.OAuthHandler(twitter_key.CONSUMER_KEY, twitter_key.CONSUMER_SECRET)
auth.set_access_token(twitter_key.ACCESS_TOKEN, twitter_key.ACCESS_SECRET)
return tweepy.API(auth)
if __name__ == "__main__":
api = ... | mit | Python | |
f1b11d2b111ef0b70f0babe6e025056ff1a68acc | Create InMoov.LeapMotionHandTracking.py | MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab | home/Alessandruino/InMoov.LeapMotionHandTracking.py | home/Alessandruino/InMoov.LeapMotionHandTracking.py | i01 = Runtime.createAndStart("i01","InMoov")
#Set here the port of your InMoov Left Hand Arduino , in this case COM5
leftHand = i01.startLeftHand("COM5")
#==============================
#Set the min/max values for fingers
i01.leftHand.thumb.setMinMax( 0, 61)
i01.leftHand.index.map(0 , 89)
i01.leftHand.majeure.map(0 ... | apache-2.0 | Python | |
ddf940dc932c04ebd287085ec7d035a93ac5598f | add findmyiphone flask api | pirate/nicksweeting.com,pirate/nicksweeting.com | ios.py | ios.py | from pyicloud import PyiCloudService
from flask import Flask, jsonify, request, abort
api = PyiCloudService('nikisweeting@gmail.com')
app = Flask(__name__)
@app.route('/devices', methods=['GET'])
def device_list():
devices = []
for id, device in api.devices.items():
location_info = device.location(... | mit | Python | |
81791b79fca6b23436518cf94b79175bd6ec06e7 | Create lcd.py | ric96/joypi3 | lcd.py | lcd.py | #!/usr/bin/python
#--------------------------------------
# ___ ___ _ ____
# / _ \/ _ \(_) __/__ __ __
# / , _/ ___/ /\ \/ _ \/ // /
# /_/|_/_/ /_/___/ .__/\_, /
# /_/ /___/
#
# lcd_i2c.py
# LCD test script using I2C backpack.
# Supports 16x2 and 20x4 screens.
#
# Author : Matt Hawkins
# D... | mit | Python | |
bb7bb2e12d3ccbb55f0b0e6db5d0cb79c3ea8079 | Add missing migration for profile items. | knowmetools/km-api,knowmetools/km-api,knowmetools/km-api,knowmetools/km-api | km_api/know_me/migrations/0013_remove_profileitem_media_resource.py | km_api/know_me/migrations/0013_remove_profileitem_media_resource.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-01 14:16
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('know_me', '0012_emergencyitem'),
]
operations = [
migrations.RemoveField(
... | apache-2.0 | Python | |
a0b9d1977b2aa2366a334231b4dd5dbe047d7122 | Add testcase for Category.can_create_events | indico/indico,OmeGak/indico,OmeGak/indico,mvidalgarcia/indico,ThiefMaster/indico,indico/indico,ThiefMaster/indico,pferreir/indico,mvidalgarcia/indico,indico/indico,mic4ael/indico,pferreir/indico,DirkHoffmann/indico,DirkHoffmann/indico,pferreir/indico,ThiefMaster/indico,indico/indico,mvidalgarcia/indico,ThiefMaster/indi... | indico/modules/categories/models/categories_test.py | indico/modules/categories/models/categories_test.py | # This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | mit | Python | |
eb54c75c0f5b7e909177777ce935358b7ac25def | Add zip and unzip to zip_file | interhui/py-sys | py_sys/file/zip_file.py | py_sys/file/zip_file.py | # coding=utf-8
import os
import zipfile
class ZipFile(object):
def __init__(self):
pass
def zip(self, dir_path, zip_file):
file_list = []
def walk_dir(sub_dir):
for root, dirs, files in os.walk(sub_dir):
for _file in files:
... | apache-2.0 | Python | |
e27b005e5dc797e2326ab175ef947021c5a85cb7 | Add ptt.py | StanleyDing/PyTT | ptt.py | ptt.py | import telnetlib
import re
RN = '\r\n'
C_L = '\x0C'
C_Z = '\x1A'
ESC = '\x1B'
class PTT():
def __init__(self):
self.ptt = telnetlib.Telnet('ptt.cc')
self.where = 'login'
def login(self, username, password, dup=False):
self.__wait_til('่จปๅ: ', encoding='big5')
self.__send(userna... | mit | Python | |
eef2dff2855ef310dbdb6b864a92306cae724ed7 | add missing the missing file exceptions.py | chenjiandongx/pyecharts,chenjiandongx/pyecharts,chenjiandongx/pyecharts | pyecharts/exceptions.py | pyecharts/exceptions.py | class NoJsExtension(Exception):
pass
| mit | Python | |
0d3255f8a69fe5192cb36ee42a731293cfd09715 | Add VmCorTaxonPhenology Class | PnEcrins/GeoNature,PnEcrins/GeoNature,PnEcrins/GeoNature,PnEcrins/GeoNature | backend/geonature/core/gn_profiles/models.py | backend/geonature/core/gn_profiles/models.py | from geonature.utils.env import DB
from utils_flask_sqla.serializers import serializable
@serializable
class VmCorTaxonPhenology(DB.Model):
__tablename__ = "vm_cor_taxon_phenology"
__table_args__ = {"schema": "gn_profiles"}
cd_ref = DB.Column(DB.Integer)
period = DB.Column(DB.Integer)
id_nomenclatu... | bsd-2-clause | Python | |
18d40200224d68b0ce93c2710516ed63566b1ad3 | Add merge migration | mattclark/osf.io,pattisdr/osf.io,adlius/osf.io,adlius/osf.io,saradbowman/osf.io,aaxelb/osf.io,caseyrollins/osf.io,HalcyonChimera/osf.io,caseyrollins/osf.io,CenterForOpenScience/osf.io,saradbowman/osf.io,brianjgeiger/osf.io,brianjgeiger/osf.io,CenterForOpenScience/osf.io,aaxelb/osf.io,brianjgeiger/osf.io,erinspace/osf.i... | osf/migrations/0127_merge_20180822_1927.py | osf/migrations/0127_merge_20180822_1927.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-08-22 19:27
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0124_merge_20180816_1229'),
('osf', '0126_update_review_group_names'),
]
op... | apache-2.0 | Python | |
a55fee4515c9e6187198a8fc27ec15e7786d5782 | Create utils.py | Jake0720/XChat-Scripts | utils.py | utils.py | #!/usr/bin/env python
'''Python script that must be kept with all of these plugins'''
def color(color, message):
'''color forground/background encoding IRC messages'''
colors = {'white': '00', 'black': '01', 'blue': '02', 'navy': '02',
'green': '03', 'red': '04', 'brown': '05', 'maroon': '0... | mit | Python | |
36e6ff93b270672e0918e5ac0d7f9698834ad6ae | add Pathfinder skeleton | nyrocron/pathdemo | game/pathfinding.py | game/pathfinding.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""pathfinding.py: """
class Pathfinder(object):
def __init__(self, size_x, size_y):
self._size_x = size_x... | mpl-2.0 | Python | |
ca956d335ad6bf6e190869d98c7abb3b554dfa3d | Create TS3IdleBot.py | rmgr/TS3IdleBot | TS3IdleBot.py | TS3IdleBot.py | import telnetlib
import time
from config import config
def getClients():
print "Getting a list of clients."
telnet.write("clientlist -times\n")
clients = telnet.read_until("msg=ok")
clients = clients.replace(" ", "\n")
clients = clients.replace("\r", "")
clients = clients.split("|")
cLen =... | mit | Python | |
ae0ebdccfffffbad259842365712bd4b6e52fc8e | add test files for HDF5 class and read_feats function | k2kobayashi/sprocket | sprocket/util/tests/test_hdf5.py | sprocket/util/tests/test_hdf5.py | from __future__ import division, print_function, absolute_import
import os
import unittest
import numpy as np
from sprocket.util.hdf5 import HDF5, read_feats
dirpath = os.path.dirname(os.path.realpath(__file__))
listf = os.path.join(dirpath, '/data/test.h5')
class hdf5FunctionsTest(unittest.TestCase):
def test... | mit | Python | |
26fcbefee171f8d56504a7eba121027f0c5be8b5 | Add migration for new overrides table | Lektorium-LLC/edx-platform,CredoReference/edx-platform,arbrandes/edx-platform,msegado/edx-platform,pabloborrego93/edx-platform,edx-solutions/edx-platform,TeachAtTUM/edx-platform,gsehub/edx-platform,TeachAtTUM/edx-platform,proversity-org/edx-platform,Lektorium-LLC/edx-platform,stvstnfrd/edx-platform,proversity-org/edx-p... | lms/djangoapps/grades/migrations/0013_persistentsubsectiongradeoverride.py | lms/djangoapps/grades/migrations/0013_persistentsubsectiongradeoverride.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('grades', '0012_computegradessetting'),
]
operations = [
migrations.CreateModel(
name='PersistentSubsectionGradeO... | agpl-3.0 | Python | |
e5d3fea99d58a1b02ebe84148d63330ea8d5c3a0 | Create WordLadder.py | jenniferwx/Programming_Practice,jenniferwx/Programming_Practice,jenniferwx/Programming_Practice | WordLadder.py | WordLadder.py | '''
Given a source word, target word and an English dictionary, transform the source word to target by
changing/adding/removing 1 character at a time, while all intermediate words being valid English words.
Return the transformation chain which has the smallest number of intermediate words.
'''
| bsd-3-clause | Python | |
4ba2f92a9712530d084823dae52f54167f2f3afb | fix test source to work with empty msgs | tj93/pymtl,cornell-brg/pymtl,Glyfina-Fernando/pymtl,tj93/pymtl,jjffryan/pymtl,cornell-brg/pymtl,12yujim/pymtl,12yujim/pymtl,cornell-brg/pymtl,tj93/pymtl,cfelton/pymtl,jck/pymtl,jjffryan/pymtl,jck/pymtl,Glyfina-Fernando/pymtl,12yujim/pymtl,jck/pymtl,cfelton/pymtl,jjffryan/pymtl,cfelton/pymtl,Glyfina-Fernando/pymtl | new_pmlib/TestSimpleSource.py | new_pmlib/TestSimpleSource.py | #=========================================================================
# TestSimpleSource
#=========================================================================
# This class will output messages on a val/rdy interface from a
# predefined list.
#
from new_pymtl import *
from ValRdyBundle import OutValRdyBund... | #=========================================================================
# TestSimpleSource
#=========================================================================
# This class will output messages on a val/rdy interface from a
# predefined list.
#
from new_pymtl import *
from ValRdyBundle import OutValRdyBund... | bsd-3-clause | Python |
75aabd425bd32a9467d7a06b250a0a5b1f5ba852 | Add more comments | CharlesJonah/bucket_list_api,CharlesJonah/bucket_list_api | application/serializer.py | application/serializer.py | '''
This module maps the data that will be used by the marshall when returning the
data to the user
'''
from flask_restful import fields
bucket_list_item_serializer = {
'item_id': fields.Integer,
'name': fields.String,
'date_created': fields.DateTime,
'date_modified': fields.DateTime,
'done': fiel... | mit | Python | |
da0f31d6ca5aa8f425c86b9c0caf965f062e1dba | test buying max clicks and gen clicks in the same test | Victory/clicker-me-bliss,Victory/clicker-me-bliss,Victory/clicker-me-bliss,Victory/clicker-me-bliss | functional-tests/suite6.py | functional-tests/suite6.py | from clickerft.cft import Cft
from time import sleep
class Suite4(Cft):
def test_buy_target_max_and_gen(self):
"""
buy clicks until we have 50 max clicks of 50
and 10 clicks/sec
"""
targetGen = 4
while int(self.clicksPerGeneration.text) < targetGen:
cl... | mit | Python | |
158f04702b6c1dcda9981d8da05fe059e84c3f90 | Add example with churches. | OnroerendErfgoed/skosprovider_getty | examples/churches.py | examples/churches.py | # -*- coding: utf-8 -*-
'''
This script demonstrates using the AATProvider to get the concept of
Churches.
'''
from skosprovider_getty.providers import AATProvider
aat = AATProvider(metadata={'id': 'AAT'})
churches = aat.get_by_id(300007466)
lang = ['en', 'nl', 'es', 'de']
print('Labels')
print('------')
for l in ... | mit | Python | |
7c82a2a8887d25ef86e5d0004cf0a0e0bc4b23ac | Create CodingContestTorontoParkingTickets2013.py | flygeneticist/misc-scripts,flygeneticist/misc-scripts,flygeneticist/misc-scripts,flygeneticist/misc-scripts | CodingContestTorontoParkingTickets2013.py | CodingContestTorontoParkingTickets2013.py | import re
from collections import defaultdict
processed_data = defaultdict(int) # dict to capture reduced dataset info, default value == 0
only_chars = re.compile('\D+').search # pre-compiled reg-exp, for fast run time, to get street name, ignoring numbers
# import raw data file with parking information
with open('Pa... | mit | Python | |
f8ee383cc3b3f1f9166627e81a64af4939e4de10 | add amqp style routing for virtual channels, allows memory backend to behave like amqp | romank0/kombu,ZoranPavlovic/kombu,tkanemoto/kombu,daevaorn/kombu,pantheon-systems/kombu,urbn/kombu,mathom/kombu,WoLpH/kombu,cce/kombu,depop/kombu,iris-edu-int/kombu,disqus/kombu,andresriancho/kombu,disqus/kombu,Elastica/kombu,alex/kombu,celery/kombu,mathom/kombu,Elastica/kombu,xujun10110/kombu,jindongh/kombu,numb3r3/ko... | example/topic.py | example/topic.py | from kombu.connection import BrokerConnection
from kombu.messaging import Exchange, Queue, Consumer, Producer
# configuration, normally in an ini file
exchange_name = "test.shane"
exchange_type = "topic"
exchange_durable = True
message_serializer = "json"
queue_name = "test.q"
# 1. setup the connection to the exchang... | bsd-3-clause | Python | |
aff827e9cc02bcee6cf8687e1dff65f39daaf6c6 | Add a failing test to the landing page to check for upcoming events. | shapiromatron/amy,pbanaszkiewicz/amy,swcarpentry/amy,vahtras/amy,pbanaszkiewicz/amy,pbanaszkiewicz/amy,wking/swc-amy,vahtras/amy,shapiromatron/amy,swcarpentry/amy,swcarpentry/amy,wking/swc-amy,wking/swc-amy,shapiromatron/amy,vahtras/amy,wking/swc-amy | workshops/test/test_landing_page.py | workshops/test/test_landing_page.py | from django.core.urlresolvers import reverse
from django.test import TestCase
from mock import patch
from datetime import date
class FakeDate(date):
"A fake replacement for date that can be mocked for testing."
pass
@classmethod
def today(cls):
return cls(2013, 12, 7)
@patch('workshops.models... | mit | Python | |
91918be596c83f468c6c940df7326896aa6082e7 | Fix stringify on multichoice forms | kb2ma/adagios,opinkerfi/adagios,zengzhaozheng/adagios,zengzhaozheng/adagios,kb2ma/adagios,kb2ma/adagios,kaji-project/adagios,kaji-project/adagios,opinkerfi/adagios,kaji-project/adagios,zengzhaozheng/adagios,kaji-project/adagios,opinkerfi/adagios,zengzhaozheng/adagios,opinkerfi/adagios,kb2ma/adagios | adagios/forms.py | adagios/forms.py | # -*- coding: utf-8 -*-
from django.utils.encoding import smart_str
from django import forms
class AdagiosForm(forms.Form):
""" Base class for all forms in this module. Forms that use pynag in any way should inherit from this one.
"""
def clean(self):
cleaned_data = {}
tmp = super(AdagiosFo... | # -*- coding: utf-8 -*-
from django.utils.encoding import smart_str
from django import forms
class AdagiosForm(forms.Form):
""" Base class for all forms in this module. Forms that use pynag in any way should inherit from this one.
"""
def clean(self):
cleaned_data = {}
tmp = super(AdagiosFo... | agpl-3.0 | Python |
cb7bb1d9f24706f3cce2e9841595ee80ce7e2c7f | Implement GetKeyboardType | angr/angr,iamahuman/angr,f-prettyland/angr,schieb/angr,iamahuman/angr,iamahuman/angr,tyb0807/angr,tyb0807/angr,f-prettyland/angr,schieb/angr,angr/angr,angr/angr,f-prettyland/angr,schieb/angr,tyb0807/angr | angr/procedures/win_user32/keyboard.py | angr/procedures/win_user32/keyboard.py | import angr
class GetKeyboardType(angr.SimProcedure):
def run(self, param):
# return the values present at time of author's testing
if self.state.solver.is_true(param == 0):
return 4
if self.state.solver.is_true(param == 1):
return 0
if self.state.solver.is_t... | bsd-2-clause | Python | |
8692557a3389403b7a3450065d99e3750d91b2ed | Create views.py | staticdev/django-pagination-bootstrap,staticdev/django-pagination-bootstrap,sheepeatingtaz/django-pagination-bootstrap,sheepeatingtaz/django-pagination-bootstrap | pagination_bootstrap/views.py | pagination_bootstrap/views.py | mit | Python | ||
060c6d2eeea2235cda955c873b50e0aa2a4accd0 | use 20 | zws0932/farmer,huoxy/farmer,zws0932/farmer | farmer/models.py | farmer/models.py | #coding=utf8
import os
import time
import json
from datetime import datetime
from commands import getstatusoutput
from django.db import models
class Job(models.Model):
# hosts, like web_servers:host1 .
inventories = models.TextField(null = False, blank = False)
# 0, do not use sudo; 1, use sudo .
s... | #coding=utf8
import os
import time
import json
from datetime import datetime
from commands import getstatusoutput
from django.db import models
class Job(models.Model):
# hosts, like web_servers:host1 .
inventories = models.TextField(null = False, blank = False)
# 0, do not use sudo; 1, use sudo .
s... | mit | Python |
799109759114d141d71bed777b9a1ac2ec26a264 | add Red object detection | maximest-pierre/opencv_example,maximest-pierre/opencv_example | python/ObjectDetection/RedExtractObject.py | python/ObjectDetection/RedExtractObject.py | import cv2
import numpy as np
video = cv2.VideoCapture(0)
while (1):
# Take each frame
_, frame = video.read()
# Convert BGR to HSV
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
# define range of blue color in HSV
lower_red = np.array([150, 50, 50])
upper_red = np.array([255, 255, 150])
... | mit | Python | |
21490bd6cd03d159a440b2c13a6b4641c789c954 | Add example | michaelhelmick/python-tumblpy | examples/example.py | examples/example.py | import sys
from tumblpy import Tumblpy
key = raw_input('App Consumer Key: ')
secret = raw_input('App Consumer Secret: ')
if not 'skip-auth' in sys.argv:
t = Tumblpy(key, secret)
callback_url = raw_input('Callback URL: ')
auth_props = t.get_authentication_tokens(callback_url=callback_url)
auth_url =... | bsd-2-clause | Python | |
ece6fb4561e338e32e8527a068cd386f00886a67 | Add example with reuters dataset. | keras-team/autokeras,keras-team/autokeras,keras-team/autokeras | examples/reuters.py | examples/reuters.py | """shell
!pip install -q -U pip
!pip install -q -U autokeras==1.0.8
!pip install -q git+https://github.com/keras-team/keras-tuner.git@1.0.2rc1
"""
"""
Search for a good model for the
[Reuters](https://keras.io/ja/datasets/#_5) dataset.
"""
import tensorflow as tf
from tf.keras.datasets import reuters
import numpy as ... | apache-2.0 | Python | |
315914bbec88e11bf5ed3bcab29218592549eccf | Create Kmeans.py | DamiPayne/Feature-Agglomeration-Clustering | Kmeans.py | Kmeans.py | import collections
from nltk import word_tokenize
from nltk.corpus import stopwords
from nltk.stem import PorterStemmer
from sklearn.cluster import KMeans
from sklearn.feature_extraction.text import TfidfVectorizer
from pprint import pprint
import csv
import pandas
def word_tokenizer(text):
#tokenizes and stems th... | mit | Python | |
b0377568c9b927db588b006b7312cbe8ed9d48b7 | Add tremelo example | martinmcbride/pysound | examples/tremelo.py | examples/tremelo.py | # Author: Martin McBride
# Created: 2016-01-08
# Copyright (C) 2016, Martin McBride
# License: MIT
# Website sympl.org/pysound
#
# Square wave example
try:
import pysound
except ImportError:
# if pysound is not installed append parent dir of __file__ to sys.path
import sys, os
sys.path.insert(0, os.p... | mit | Python | |
ea26478495d5aec6925e32c9a87245bf2e1e4bc8 | Add script demonstrating raising and catching Exceptions. | kubkon/ee106-additional-material | rps/errors.py | rps/errors.py | gestures = ["rock", "paper", "scissors"]
def verify_move(player_move):
if player_move not in gestures:
raise Exception("Wrong input!")
return player_move
# let's catch an exception
try:
player_move = verify_move(input("[rock,paper,scissors]: "))
print("The move was correct.")
except Exception:... | mit | Python | |
fb95c75b7b43bcb1fa640e4de3181fd0431c5837 | Add the unittest test_plot.py | joekasp/ionic_liquids | ionic_liquids/test/test_plot.py | ionic_liquids/test/test_plot.py | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error
FIG_SIZE = (4, 4)
def test_parity_plot():
"""
Test the parity plot
Input
-----
y_pred : predicted values from the model
y_act : 'true' (actual) values
Output
------... | mit | Python | |
ecb3bd6fd9b6496a751a2145909648ba1be8f908 | add linear interpolation tests | timothydmorton/isochrones,timothydmorton/isochrones | isochrones/tests/test_interp.py | isochrones/tests/test_interp.py | import itertools
import logging
import numpy as np
import pandas as pd
from scipy.interpolate import RegularGridInterpolator
from isochrones.interp import DFInterpolator
def test_interp():
xx, yy, zz = [np.arange(10 + np.log10(n))*n for n in [1, 10, 100]]
def func(x, y, z):
return x**2*np.cos(y/10) ... | mit | Python | |
947c9ef100686fa1ec0acaa10bc49bf6c785665b | Use unified class for json output | spookey/ffflash,spookey/ffflash | ffflash/container.py | ffflash/container.py | from os import path
from ffflash import RELEASE, log, now, timeout
from ffflash.lib.clock import epoch_repr
from ffflash.lib.data import merge_dicts
from ffflash.lib.files import read_json_file, write_json_file
class Container:
def __init__(self, spec, filename):
self._spec = spec
self._location ... | bsd-3-clause | Python | |
6c5dad5d617892a3ea5cdd20cbaef89189307195 | add simple content-based model for coldstart | Evfro/polara | polara/recommender/coldstart/models.py | polara/recommender/coldstart/models.py | import numpy as np
from polara.recommender.models import RecommenderModel
class ContentBasedColdStart(RecommenderModel):
def __init__(self, *args, **kwargs):
super(ContentBasedColdStart, self).__init__(*args, **kwargs)
self.method = 'CB'
self._key = '{}_cold'.format(self.data.fields.itemid... | mit | Python | |
2ca6b22e645cbbe63737d4ac3929cb23700a2e06 | Prepare v1.2.342.dev | tsnoam/Flexget,tsnoam/Flexget,jacobmetrick/Flexget,antivirtel/Flexget,dsemi/Flexget,LynxyssCZ/Flexget,sean797/Flexget,xfouloux/Flexget,grrr2/Flexget,poulpito/Flexget,ianstalk/Flexget,gazpachoking/Flexget,jawilson/Flexget,qvazzler/Flexget,lildadou/Flexget,Pretagonist/Flexget,malkavi/Flexget,Danfocus/Flexget,Pretagonist/... | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.