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 |
|---|---|---|---|---|---|---|---|---|
4a179825234b711a729fce5bc9ffc8de029c0999 | Test for invalid data when loading | robotframework/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,HelioGuilherme66/RIDE,caio2k/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,fingeronthebutton/RIDE,fingeronthebutton/RIDE,fingeronthebutton/RIDE,caio2k/RIDE,caio2k/RIDE | utest/controller/test_loading.py | utest/controller/test_loading.py | import unittest
from robot.utils.asserts import assert_true, assert_raises, assert_raises_with_msg
from robotide.controller import ChiefController
from robotide.namespace import Namespace
from resources import MINIMAL_SUITE_PATH, RESOURCE_PATH, FakeLoadObserver
from robot.errors import DataError
class TestDataLoadi... | import unittest
from robot.utils.asserts import assert_true, assert_raises
from robotide.application.chiefcontroller import ChiefController
from robotide.namespace import Namespace
from resources import MINIMAL_SUITE_PATH, RESOURCE_PATH
from robot.errors import DataError
class _FakeObserver(object):
def notify... | apache-2.0 | Python |
f8d49af459fb3b751f44ecf625521c62fa68df0a | Check in script to delete existing autochecked tasks | sunil07t/e-mission-server,e-mission/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,sunil07t/e-mission-server | bin/ext_service/historical/fix_autocheck_tasks.py | bin/ext_service/historical/fix_autocheck_tasks.py | import logging
import argparse
import uuid
import emission.core.wrapper.user as ecwu
import emission.core.get_database as edb
import emission.net.ext_service.habitica.proxy as proxy
def fix_autocheck_for_user(uuid):
auto_tasks = find_existing_auto_tasks(uuid)
delete_tasks(uuid, auto_tasks)
create_new_tasks... | bsd-3-clause | Python | |
89ef576ba4e707eef653c670b32fa40d862e79ec | Add package for the Python regex library (#4771) | tmerrick1/spack,krafczyk/spack,iulian787/spack,iulian787/spack,iulian787/spack,mfherbst/spack,tmerrick1/spack,tmerrick1/spack,TheTimmy/spack,TheTimmy/spack,lgarren/spack,EmreAtes/spack,LLNL/spack,EmreAtes/spack,matthiasdiener/spack,matthiasdiener/spack,krafczyk/spack,lgarren/spack,krafczyk/spack,skosukhin/spack,lgarren... | var/spack/repos/builtin/packages/py-regex/package.py | var/spack/repos/builtin/packages/py-regex/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
0e6a7a805ff08f191c88bda67992cb874f538c2f | Add migration for unitconnection section types | City-of-Helsinki/smbackend,City-of-Helsinki/smbackend | services/migrations/0097_alter_unitconnection_section_type.py | services/migrations/0097_alter_unitconnection_section_type.py | # Generated by Django 4.0.5 on 2022-06-22 05:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("services", "0096_create_syllables_fi_columns"),
]
operations = [
migrations.AlterField(
model_name="unitconnection",
... | agpl-3.0 | Python | |
9009315381edd69adac3319b973b3bcdb16f23e4 | Add missing module wirecloud.live.utils | jpajuelo/wirecloud,jpajuelo/wirecloud,jpajuelo/wirecloud,jpajuelo/wirecloud | src/wirecloud/live/utils.py | src/wirecloud/live/utils.py | # -*- coding: utf-8 -*-
# Copyright (c) 2016 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud 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 versio... | agpl-3.0 | Python | |
5e49eb4fb6bce9cdeae515590530b78e4dde89d9 | Add alternate example for `match_template`. | emmanuelle/scikits.image,warmspringwinds/scikit-image,bennlich/scikit-image,rjeli/scikit-image,ofgulban/scikit-image,GaZ3ll3/scikit-image,rjeli/scikit-image,ClinicalGraphics/scikit-image,dpshelio/scikit-image,pratapvardhan/scikit-image,michaelpacer/scikit-image,chintak/scikit-image,michaelaye/scikit-image,chintak/sciki... | doc/examples/plot_match_face_template.py | doc/examples/plot_match_face_template.py | """
=================
Template Matching
=================
In this example, we use template matching to identify the occurrence of an
image patch (in this case, a sub-image centered on the camera man's head).
Since there's only a single match, the maximum value in the `match_template`
result` corresponds to the head lo... | bsd-3-clause | Python | |
854fd7de75a14ee030b8f2e8a686dd96f40273de | Add mvn-push.py | onepf/OPF-mvn-repo,onepf/OPF-mvn-repo | mvn-push.py | mvn-push.py | #!/usr/bin/python
import os
import sys
import getopt
from os.path import realpath
from os.path import join
from os.path import basename
import subprocess
help_message = 'mvn-push.py --group package --id package --version version --file file [--javadoc file|path] [--sources file]'
mvn_repo=os.getcwd()
cleanup = ''
d... | apache-2.0 | Python | |
f284bb85a0b28142850f980a33f38a3cf25d9da8 | Solve Knowit 2017/08 | matslindh/codingchallenges,matslindh/codingchallenges | knowit2017/08.py | knowit2017/08.py | memoized = {}
def christmas_number(n):
in_sequence = {1: True}
while True:
if n > 10000000:
for k in in_sequence:
memoized[k] = False
return False
in_sequence[n] = True
if n in memoized:
return memoized[n]
n = sum([int(d)... | mit | Python | |
2dd0efce803c4dfcc4c5d61cf6fec1d5ee64e1b3 | test for btcSpecialTx.py | ethereum/btcrelay,ethereum/btcrelay,vaporry/btcrelay,ethers/btcrelay | test/test_btcSpecialTx.py | test/test_btcSpecialTx.py | from pyethereum import tester
from datetime import datetime, date
import math
import pytest
slow = pytest.mark.slow
class TestBtcSpecialTx(object):
CONTRACT = 'btcSpecialTx.py'
CONTRACT_GAS = 55000
ETHER = 10 ** 18
def setup_class(cls):
tester.gas_limit = 2 * 10**6
cls.s = tester.st... | mit | Python | |
edc5116472c49370e5bf3ff7f9f7872732b0285e | Add a solution to the phone number problem: can a phone number be represented as words in a dictionary? | aww/cs_practice | phone_numbers.py | phone_numbers.py | #!/usr/bin/env python
import unittest
words = set(["dog", "clog", "cat", "mouse", "rat", "can",
"fig", "dig", "mud", "a", "an", "duh", "sin",
"get", "shit", "done", "all", "glory", "comes",
"from", "daring", "to", "begin", ])
dialmap = {
'a':2, 'b':2, 'c':2,
'd':3, 'e':... | apache-2.0 | Python | |
904ac79bd278634c97f6f43f4d85bc0c2316117b | add configuration example | xeroc/python-graphenelib | scripts/exchange-bots/config-example.py | scripts/exchange-bots/config-example.py | from bot.strategies.maker import MakerRamp, MakerSellBuyWalls
wallet_host = "localhost"
wallet_port = 8092
wallet_user = ""
wallet_password = ""
witness_url = "ws://testnet.bitshares.eu/ws"
witness_user = ""
witness_password = ""
watch_markets = ["PE... | mit | Python | |
60efa5bbab4463714df8dd93c1c7c606bee4dbaf | add giphy plugin | TeamPeggle/ppp-helpdesk | plugins/giphy.py | plugins/giphy.py | from util import http, hook
@hook.api_key('giphy')
@hook.command('giphy', autohelp=False)
@hook.command('gif', autohelp=False)
@hook.command(autohelp=False)
def giphy(inp, api_key=None):
".giphy [term] -- gets random gif for a term"
data = http.get_json("http://api.giphy.com/v1/gifs/random", { "api_key": api_... | unlicense | Python | |
227a8e0f654c9797a7dedf863f7568d55a6c2f8e | add download sample from go-sciter port | pravic/pysciter | examples/download.py | examples/download.py | """Go sciter example port."""
import sciter
class MyEventHandler(sciter.EventHandler):
def document_complete(self):
print("content loaded.")
pass
def on_data_arrived(self, nm):
print("data arrived, uri:", nm.uri, nm.dataSize)
pass
class Frame(sciter.Window):
de... | mit | Python | |
dff9d7a05e2a522b3dbbd7ea18866c5ba1fc0476 | add a !stock plugin for stock images | michaelMinar/limbo,wmv/slackbot-python,uilab-github/slask,NUKnightLab/slask,palachu/sdbot,serverdensity/sdbot,mmisiewicz/slask,Marclass/limbo,UnILabKAIST/slask,TetraEtc/limbo,dorian1453/limbo,sentinelleader/limbo,TetraEtc/limbo,cmyr/debt-bot,shawnsi/limbo,llimllib/limbo,llimllib/limbo,signalnine/alanabot,kesre/slask,ky... | plugins/stock.py | plugins/stock.py | """!stock <search term> return a stock photo for <search term>"""
from random import shuffle
import re
import requests
from bs4 import BeautifulSoup
def stock(searchterm):
url = "http://www.shutterstock.com/cat.mhtml?searchterm={}&search_group=&lang=en&language=en&search_source=search_form&version=llv1".format(s... | mit | Python | |
d26a78d3e0695e0bf492910c530beb54b30cdbbc | bump version number for development | pombredanne/stdeb,astraw/stdeb,pombredanne/stdeb,sathieu/stdeb,astraw/stdeb,sathieu/stdeb,benthomasson/stdeb,LeMeteore/stdeb,pombredanne/stdeb,benthomasson/stdeb,astraw/stdeb,LeMeteore/stdeb,benthomasson/stdeb,sathieu/stdeb,LeMeteore/stdeb | stdeb/__init__.py | stdeb/__init__.py | # setuptools is required for distutils.commands plugin we use
import logging
import setuptools
__version__ = '0.4.2.git'
log = logging.getLogger('stdeb')
log.setLevel(logging.INFO)
handler = logging.StreamHandler()
handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(message)s')
handler.setFormatter(formatt... | # setuptools is required for distutils.commands plugin we use
import logging
import setuptools
__version__ = '0.4.2'
log = logging.getLogger('stdeb')
log.setLevel(logging.INFO)
handler = logging.StreamHandler()
handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(message)s')
handler.setFormatter(formatter)
... | mit | Python |
1cab72ac3c5f3cea8326ebc97ccae1a8068eb839 | Add http responses collection module. | kaleidos/django-superview,kaleidos/django-superview | superview/http.py | superview/http.py | # -*- coding: utf-8 -*-
"""
The various HTTP responses for use in returning proper HTTP codes.
"""
from django.http import HttpResponse, StreamingHttpResponse
class HttpCreated(HttpResponse):
status_code = 201
def __init__(self, *args, **kwargs):
location = kwargs.pop('location', '')
super(... | bsd-3-clause | Python | |
86baa4f437cf3892c15a56e8331c19b6d2e63b1d | Add a script for generating unicode name table | GNOME/gnome-characters,GNOME/gnome-characters,GNOME/gnome-characters,GNOME/gnome-characters,GNOME/gnome-characters | lib/gen-names.py | lib/gen-names.py | #!/usr/bin/python3
# Input: https://www.unicode.org/Public/UNIDATA/UnicodeData.txt
import io
import re
class Builder(object):
def __init__(self):
pass
def read(self, infile):
names = []
for line in infile:
if line.startswith('#'):
continue
line... | bsd-3-clause | Python | |
a50190fe04e434ce70f6b02027e281a896dbb81b | Create Python password hasher | drussell393/Linux-Password-Hash | passwordhash.py | passwordhash.py | #!/usr/bin/env python
# Password Hashing Module for Linux
# Author: Dave Russell Jr (drussell393)
from getpass import getpass
import crypt
# If you like Python 2, please to be importing.
import os
import binascii
password = getpass('Enter your desired password, Harry: ')
passwordConfirm = getpass('Confirm your passw... | mit | Python | |
961e9b031b94a0533c53c29787660ab954b6db37 | Add patch-weight.py, patch weight into phrase segs. | SnakeHunt2012/word2vec,SnakeHunt2012/word2vec,SnakeHunt2012/word2vec,SnakeHunt2012/word2vec,SnakeHunt2012/word2vec | patch-weight.py | patch-weight.py | #!/usr/bin/env python
# -*- coding: utf-8
from codecs import open
from argparse import ArgumentParser
DEBUG_FLAG = False
def load_weight_dict(weight_file):
weight_dict = {}
with open(weight_file, 'r') as fd:
for line in fd:
splited_line = line.strip().split()
if len(splited_l... | apache-2.0 | Python | |
9e51fc305f21a4031b6ec94ccfa39ef1e611da9e | add script to compare DFAs. | sbc100/native_client,sbc100/native_client,sbc100/native_client,nacl-webkit/native_client,nacl-webkit/native_client,sbc100/native_client,sbc100/native_client,nacl-webkit/native_client,sbc100/native_client,nacl-webkit/native_client,nacl-webkit/native_client | src/trusted/validator_ragel/unreviewed/compare_dfa.py | src/trusted/validator_ragel/unreviewed/compare_dfa.py | #!/usr/bin/python
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import dfa_parser
visited_pairs = set()
de... | bsd-3-clause | Python | |
3cdee1d40d3370686c9bff435a4575e985c121e9 | Create __init__.py | odb9402/OPPA,odb9402/OPPA,odb9402/OPPA,odb9402/OPPA | pfc/__init__.py | pfc/__init__.py | """pfc"""
| mit | Python | |
438471a4a3b41637c5c1eb3c2e07d9d8ca81ee09 | Add a stats ./manage.py command | UrLab/DocHub,UrLab/beta402,UrLab/beta402,UrLab/DocHub,UrLab/DocHub,UrLab/DocHub,UrLab/beta402 | www/management/commands/stats.py | www/management/commands/stats.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Copyright 2014, Cercle Informatique ASBL. All rights reserved.
#
# 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 ... | agpl-3.0 | Python | |
633e540a1718a5cc515725b13d3f1740bb950bb6 | Use GitHub URL for ImageMagick | lgarren/spack,matthiasdiener/spack,lgarren/spack,LLNL/spack,EmreAtes/spack,lgarren/spack,iulian787/spack,iulian787/spack,skosukhin/spack,EmreAtes/spack,LLNL/spack,matthiasdiener/spack,krafczyk/spack,tmerrick1/spack,skosukhin/spack,EmreAtes/spack,krafczyk/spack,skosukhin/spack,krafczyk/spack,tmerrick1/spack,mfherbst/spa... | var/spack/repos/builtin/packages/ImageMagick/package.py | var/spack/repos/builtin/packages/ImageMagick/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
3ba109622c24bd52f32e605c523249e1c26b0207 | Add regression test with non ' ' space character as token | banglakit/spaCy,banglakit/spaCy,explosion/spaCy,Gregory-Howard/spaCy,Gregory-Howard/spaCy,raphael0202/spaCy,banglakit/spaCy,banglakit/spaCy,oroszgy/spaCy.hu,explosion/spaCy,recognai/spaCy,explosion/spaCy,oroszgy/spaCy.hu,explosion/spaCy,Gregory-Howard/spaCy,oroszgy/spaCy.hu,explosion/spaCy,banglakit/spaCy,recognai/spaC... | spacy/tests/regression/test_issue834.py | spacy/tests/regression/test_issue834.py | # coding: utf-8
from io import StringIO
word2vec_str = """, -0.046107 -0.035951 -0.560418
de -0.648927 -0.400976 -0.527124
. 0.113685 0.439990 -0.634510
-1.499184 -0.184280 -0.598371"""
def test_issue834(en_vocab):
f = StringIO(word2vec_str)
vector_length = en_vocab.load_vectors(f)
assert vector_lengt... | mit | Python | |
d11707e651d4b44ef706f62677ba6a617102f239 | Add test-code | kiyomaro927/bicamon,kiyomaro927/bicamon,kiyomaro927/bicamon | test/post_test.py | test/post_test.py | import json
import urllib2
data = {
"cells":["ECT","VISC", "AAA"]
}
req = urllib2.Request('http://localhost:5000/api')
req.add_header('Content-Type', 'application/json')
response = urllib2.urlopen(req, json.dumps(data))
| bsd-3-clause | Python | |
480852bb1dd6796b7fb12e40edc924b9a4dbee60 | Add tests to cover no framework, no problem | undertherain/benchmarker,undertherain/benchmarker,undertherain/benchmarker,undertherain/benchmarker | test/test_misc.py | test/test_misc.py | import unittest
from .helpers import run_module
class MiscTests(unittest.TestCase):
def setUp(self):
self.name = "benchmarker"
def test_no_framework(self):
with self.assertRaises(Exception):
run_module(self.name)
def test_no_problem(self):
with self.assertRaises(Exce... | mpl-2.0 | Python | |
ae372375a7160978eb56ef9b710027887a844d6f | add tests, now i am cool. | nickweinberg/werewolf-slackbot | test_app_input.py | test_app_input.py | """
Test sending data to process_message.
"""
import pytest
from plugins.werewolf import app
from plugins.werewolf.user_map import get_user_map, set_user_map, reset_user_map
def get_empty_game_state():
# hi there
# make mock game state.
# we'll have several fixtures
# and a basic one we can set up in... | mit | Python | |
431760d7a840543901fc1ebc0069ecd384302101 | Add tests/conftest.py for py.test | klothe/pymssql,ramiro/pymssql,klothe/pymssql,zerolugithub/pymssql,JimDennis/pymssql,klothe/pymssql,pymssql/pymssql,bladams/pymssql,ramiro/pymssql,bladams/pymssql,bladams/pymssql,ramiro/pymssql,Aloomaio/pymssql,zerolugithub/pymssql,zerolugithub/pymssql,JimDennis/pymssql,Aloomaio/pymssql,pymssql/pymssql,JimDennis/pymssql... | tests/conftest.py | tests/conftest.py | import decimal
import os
try:
# Python 2
from ConfigParser import ConfigParser
except ImportError:
# Python 3
from configparser import ConfigParser
import tests.helpers as th
from .helpers import cfgpath, clear_db, get_app_lock, release_app_lock
_parser = ConfigParser({
'server': 'localhost',
... | lgpl-2.1 | Python | |
bceee12d94924931ff73b45d2ed3de8b3d71522c | Add case fixture to top-level conftest.py in tests | amolenaar/gaphor,amolenaar/gaphor | tests/conftest.py | tests/conftest.py | import pytest
from gaphor.conftest import Case
@pytest.fixture
def case():
case = Case()
yield case
case.shutdown()
| lgpl-2.1 | Python | |
0146058fe8a5c91ce33102bb55f5f087428a03a3 | Add tests for get_keeper_token | lsst-sqre/ltd-mason,lsst-sqre/ltd-mason | tests/test_cli.py | tests/test_cli.py | """Test the ltd-mason CLI features."""
from base64 import b64encode
import responses
import pytest
from ltdmason.cli import get_keeper_token
@responses.activate
def test_get_keeper_token():
"""Test getting a token from LTD Keeper."""
expected_json = {'token': 'shake-it-off-shake-it-off'}
responses.add(... | mit | Python | |
e1e8bef8c2c916505e9bdc0ea37c81a7626db6af | Add int tests | nkantar/Parsenvy | tests/test_int.py | tests/test_int.py | import pytest
import parsenvy
def test_int_positive(monkeypatch):
"""'13'"""
monkeypatch.setenv("foo", "13")
assert parsenvy.int("foo") == 13
def test_int_negative(monkeypatch):
"""'-42'"""
monkeypatch.setenv("foo", "-42")
assert parsenvy.int("foo") == -42
def test_int_zero(monkeypatch)... | bsd-3-clause | Python | |
3b66fbc844b023003420db7a9986811110f55489 | Add tests for the run() function | Pythonity/icon-font-to-png | tests/test_run.py | tests/test_run.py | import sys
import tempfile
import unittest
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import icon_font_to_png
class TestRun(unittest.TestCase):
def create_css_file(self, contents):
css_file = tempfile.NamedTemporaryFile()
css_file.write(contents.encode(... | mit | Python | |
578de6c57f9698c7e273af06d1e815f71269bb18 | Add a sample python file interesting to debug | audaxis/ikpdb,audaxis/ikpdb | tests/to_debug.py | tests/to_debug.py | import sys
import os
import time
import threading
import ikpdb
TEST_MULTI_THREADING = False
TEST_EXCEPTION_PROPAGATION = False
TEST_POSTMORTEM = True
TEST_SYS_EXIT = 0
TEST_STEPPING = False
# Note that ikpdb.set_trace() will reset/mess breakpoints set using GUI
TEST_SET_TRACE = False
TCB = TEST_CONDITIONAL_BREAKPO... | mit | Python | |
329270ddef5f4da4528750ebc463ffc910325ec8 | add migration | pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro | temba/channels/migrations/0066_auto_20170306_1713.py | temba/channels/migrations/0066_auto_20170306_1713.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-06 17:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('channels', '0065_auto_20170228_0837'),
]
operations = [
migrations.AlterFie... | agpl-3.0 | Python | |
a8caef202ba0fd6909359241ff385eca762aca1f | Add echo effect | martinmcbride/pysound | quack/effects.py | quack/effects.py | # Author: Martin McBride
# Created: 2018-09-25
# Copyright (C) 2018, Martin McBride
# License: MIT
import math
import numpy as np
from quack.buffer import create_buffer
def echo(params, source, delay, strength):
'''
Create an echo
:param params:
:param source:
:param delay:
:param strength:
... | mit | Python | |
bdd7016fe8f41abdc8562d114efc41622916a675 | Create startBackEnd.py | fabiomssilva/AWSControl,fabiomssilva/AWSControl | startBackEnd.py | startBackEnd.py | #!/usr/bin/python
import boto.ec2
conn = boto.ec2.connect_to_region("eu-central-1", aws_access_key_id='AKIAI111111111111111', aws_secret_access_key='keyyyyy')
instance = conn.get_all_instances(instance_ids=['i-40eb8111'])
print instance[0].instances[0].start()
| mit | Python | |
f6f2c6fc2a51bb3243d9b99ab1093809a2d1a5bb | Add script that tests AI players | giovannipcarvalho/dots-and-boxes | test_players.py | test_players.py | from AI import *
import random
def RandomPlayer(game):
return 0, random.choice(game.get_available_moves())
def ABPlayer(game):
return alpha_beta_search(game, 8, -np.inf, np.inf, True, evaluate_base)
def ABChainPlayer1(game):
return alpha_beta_search(game, 7, -np.inf, np.inf, True, evaluate_chain_len)
de... | mit | Python | |
0cf85c1ab68ddc50787e6a09f3604320d18118b4 | Add UniqueForFieldsMixin | ashleywaite/django-more | django_more/mixins.py | django_more/mixins.py | from django.db.models.options import normalize_together
from django.utils.functional import cached_property
# Used by OrderByField to allow for unique_together constraints to be field declared
class UniqueForFieldsMixin:
""" Mixin first to a Field to add a unique_for_fields field option """
unique_for_fields ... | bsd-3-clause | Python | |
419f86f5c50f812f19dd731e9c33f66e57f51a48 | Test matrix - work in progress | pycurl/pycurl,pycurl/pycurl,pycurl/pycurl | tests/matrix.py | tests/matrix.py | import os.path, urllib, subprocess, shutil
python_versions = ['2.4.6', '2.5.6', '2.6.8', '2.7.5']
libcurl_versions = ['7.19.0', '7.32.0']
class in_dir:
def __init__(self, dir):
self.dir = dir
def __enter__(self):
self.oldwd = os.getcwd()
os.chdir(self.dir)
def __exit__(se... | lgpl-2.1 | Python | |
c24647a921c64cfc8a1385f7e735622514e199c3 | make it clear that we don't depend on gabble version for the test | Ziemin/telepathy-gabble,mlundblad/telepathy-gabble,mlundblad/telepathy-gabble,community-ssu/telepathy-gabble,community-ssu/telepathy-gabble,jku/telepathy-gabble,community-ssu/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,jku/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,community-s... | tests/test-caps-update.py | tests/test-caps-update.py | """
Test that CapabilitiesChanged signal is emitted only once after
all the caps in the presence have been analyzed.
"""
import dbus
from twisted.words.xish import domish
from servicetest import match, unwrap, lazy
from gabbletest import go, make_result_iq
def make_presence(from_jid, type, status):
presence = d... |
"""
Test that CapabilitiesChanged signal is emitted only once after
all the caps in the presence have been analyzed.
"""
import dbus
from twisted.words.xish import domish
from servicetest import match, unwrap, lazy
from gabbletest import go, make_result_iq
def make_presence(from_jid, type, status):
presence = ... | lgpl-2.1 | Python |
1ef3c14af249f211df4cdad89cdd49d7f2845eb1 | Add share count using Flask. | comicpanda/share-count-server,comicpanda/share-count-server | flask_share_count.py | flask_share_count.py | from flask import Flask, jsonify, request
import grequests, re, json
app = Flask(__name__)
FACEBOOK = 'https://api.facebook.com/method/links.getStats?urls=%s&format=json'
TWITTER = 'http://urls.api.twitter.com/1/urls/count.json?url=%s&callback=count'
REDDIT = 'http://buttons.reddit.com/button_info.json?url=%s'
STUMBL... | apache-2.0 | Python | |
7311f8f2a8a7ab285669dc02d26d7e2248583ff5 | Add tests for 'rle_compress' | ziotom78/polycomp | test_rle.py | test_rle.py | import pypolycomp
import numpy as np
def test_compression():
for cur_type in (np.int8, np.int16, np.int32, np.int64,
np.uint8, np.uint16, np.uint32, np.uint64):
compressed = pypolycomp.rle_compress(np.array([1, 1, 1, 2, 3], dtype=cur_type))
assert np.all(compressed == np.array(... | bsd-3-clause | Python | |
da2b773bf6e669b3ec50bbd6af73e1d80bb0b5a5 | Add tsstats/event.py for easy event-initialization | Thor77/TeamspeakStats,Thor77/TeamspeakStats | tsstats/events.py | tsstats/events.py | from collections import namedtuple
Event = namedtuple(
'Event', ['timestamp', 'identifier', 'action', 'arg', 'arg_is_client']
)
def nick(timestamp, identifier, nick):
return Event(timestamp, identifier, 'set_nick', nick, arg_is_client=False)
def connect(timestamp, identifier):
return Event(
tim... | mit | Python | |
99f5c2a9cd44ac8ed301a781460816e8f0dffdb8 | add killall.py example script | hybridlogic/psutil,hybridlogic/psutil,hybridlogic/psutil | examples/killall.py | examples/killall.py | #!/usr/bin/env python
"""
Kill a process by name.
"""
import os
import sys
import psutil
def main():
if len(sys.argv) != 2:
sys.exit('usage: %s name' % __file__)
else:
NAME = sys.argv[1]
killed = []
for proc in psutil.process_iter():
if proc.name == NAME and proc.pid != os.ge... | bsd-3-clause | Python | |
20c08b96ce7a5377576e45953266c51079b5bdeb | Create testfile.py | tesssny/firstrepository | testfile.py | testfile.py | print("Tess is cool")
| mit | Python | |
d75eebbcb6b1922d37a97550bc4cbead6e50cfdb | add localdb.py | muchu1983/bennu,muchu1983/bennu,muchu1983/united | united/localdb.py | united/localdb.py | # -*- coding: utf-8 -*-
"""
Copyright (C) 2015, MuChu Hsu
Contributed by Muchu Hsu (muchu1983@gmail.com)
This file is part of BSD license
<https://opensource.org/licenses/BSD-3-Clause>
"""
import sqlite3
import os
import logging
from pkg_resources import resource_filename
"""
資料庫存取 類別
"""
class SQLite3Db:
#建構子
... | bsd-3-clause | Python | |
b6d1b9365c356a14f0f9ef478247d498845a2b2c | add script to process normal vectors | bast/flanders,bast/flanders | coastline/data/vectors.py | coastline/data/vectors.py | import matplotlib.pyplot as plt
import glob
import math
def extract_data(file_name):
points = []
with open(file_name, 'r') as f:
for i, line in enumerate(f):
if i > 2:
s = line.split()
point = (float(s[0]), float(s[1]))
points.append(point)
... | mpl-2.0 | Python | |
1ac09013e8cf89e83418de0be9d83b87a0a20634 | Create mp3_exploit.py | funkandwagnalls/pythonpentest,funkandwagnalls/pythonpentest,funkandwagnalls/pythonpentest,liorvh/pythonpentest,liorvh/pythonpentest,liorvh/pythonpentest | mp3_exploit.py | mp3_exploit.py | #!/usr/bin/env python
'''
Author: Chris Duffy
Date: May 2015
Purpose: To provide a means to demonstrate a simple file upload proof of concept related to
exploiting Free MP3 CD Ripper.
'''
import struct
filename="exploit.wav"
fill ="A"*4112
#eip = struct.pack('<I',0x42424242) # EIP overwrite verfication
eip = s... | bsd-3-clause | Python | |
68ea60fd87e3e0240f82a42f0f6b4dcd65732f97 | Add MQTT server example | fabaff/mqtt-panel,fabaff/mqtt-panel,fabaff/mqtt-panel | mqtt-server.py | mqtt-server.py | #!/usr/bin/python3
#
# Copyright (c) 2015-2016, Fabian Affolter <fabian@affolter-engineering.ch>
# Released under the MIT license. See LICENSE file for details.
#
# Source: https://github.com/beerfactory/hbmqtt/blob/develop/samples/broker_start.py
#
import logging
import asyncio
import os
from hbmqtt.broker import Bro... | mit | Python | |
c0b05a43e10693f8aab87a7f86726d512b7494fc | Add tenant exporter for accounting | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/clients/management/commands/export_tenants.py | bluebottle/clients/management/commands/export_tenants.py | import json
from rest_framework.authtoken.models import Token
from django.contrib.contenttypes.models import ContentType
from django.core.management.base import BaseCommand
from bluebottle.clients import properties
from bluebottle.clients.models import Client
from bluebottle.clients.utils import LocalTenant
class C... | bsd-3-clause | Python | |
dfbf888ca0b56448a4f211900b16e3c85648b241 | Add migration for changing docstring of Note.is_private to unicode | editorsnotes/editorsnotes,editorsnotes/editorsnotes | editorsnotes/main/migrations/0025_auto_20160628_0913.py | editorsnotes/main/migrations/0025_auto_20160628_0913.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-06-28 09:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0024_topic_ld'),
]
operations = [
migrations.AlterField(
... | agpl-3.0 | Python | |
a45a0bb366ae28d38d543ce71f32f625e9b80042 | add tools module | multidis/bitQuant,rosspalmer/bitQuant | modules/tools.py | modules/tools.py | from pandas import DataFrame
from pandas.tseries.tools import to_datetime
#|Create time series from trade history DataFrame
def time_series(df, period):
ts = DataFrame(columns=('timestamp', 'price', 'high',
'low', 'open', 'amount'))
tmin = int(df['timestamp'].min())
tmax = int(df['timestamp'].max())
for tsmp ... | mit | Python | |
2f4d413e14011847138d6afd27a210fc58823c8a | add certificate and key migrations | deis/workflow,deis/workflow,deis/workflow | rootfs/api/migrations/0004_auto_20160124_2134.py | rootfs/api/migrations/0004_auto_20160124_2134.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-24 21:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0003_auto_20160114_0310'),
]
operations = [
migrations.AlterField(
... | mit | Python | |
d1aa553f739e91cd470eea23042b6c8bcebe9b6f | add mocked integrationtest for the deprecationwarning of makeitem | RonnyPfannschmidt/pytest,The-Compiler/pytest,hackebrot/pytest,Akasurde/pytest,txomon/pytest,rmfitzpatrick/pytest,davidszotten/pytest,alfredodeza/pytest,nicoddemus/pytest,pfctdayelise/pytest,markshao/pytest,tomviner/pytest,ddboline/pytest,The-Compiler/pytest,nicoddemus/pytest,tareqalayan/pytest,tomviner/pytest,pytest-de... | testing/python/test_deprecations.py | testing/python/test_deprecations.py | import pytest
from _pytest.python import PyCollector
class PyCollectorMock(PyCollector):
"""evil hack"""
def __init__(self):
self.called = False
def _makeitem(self, *k):
"""hack to disable the actual behaviour"""
self.called = True
def test_pycollector_makeitem_is_deprecated()... | mit | Python | |
e348ec573a4882258466cdc2ab73da8b4dbbe256 | Create pillu.py | jasuka/pyBot,jasuka/pyBot | modules/pillu.py | modules/pillu.py | #test
| mit | Python | |
1eb2e1390d41c65943e777a66918df87b4ee8799 | Add constructive_hierarchy | louisswarren/hieretikz | constructive_hierarchy.py | constructive_hierarchy.py | '''Reason about a directed graph in which the (non-)existance of some edges
must be inferred by the disconnectedness of certain vertices. Collect (truthy)
evidence for boolean function return values.'''
def transitive_closure_set(vertices, edges):
'''Find the transitive closure of a set of vertices.'''
neighbo... | mit | Python | |
25ff8c6f8bc9d70886d004f8b64f08facb8c12cf | Create Find the Celebrity sol for Leetcode | Chasego/cod,cc13ny/algo,cc13ny/Allin,Chasego/cod,cc13ny/Allin,cc13ny/algo,Chasego/codirit,Chasego/codirit,cc13ny/algo,cc13ny/Allin,cc13ny/algo,Chasego/codirit,cc13ny/algo,Chasego/codi,Chasego/codi,Chasego/codi,cc13ny/Allin,Chasego/codirit,Chasego/codi,Chasego/cod,Chasego/codi,Chasego/codirit,Chasego/cod,cc13ny/Allin,Ch... | leetcode/277-Find-the-Celebrity/FindtheCelebrity_sol.py | leetcode/277-Find-the-Celebrity/FindtheCelebrity_sol.py | # The knows API is already defined for you.
# @param a, person a
# @param b, person b
# @return a boolean, whether a knows b
# def knows(a, b):
class Solution(object):
def findCelebrity(self, n):
"""
:type n: int
:rtype: int
"""
if n < 2:
return -1
candi... | mit | Python | |
3eeaa890f0a7afcf7a6f470055c5bc0fda20ae5c | create moistureCaptor.py | TyBeeProject/TyBeeHive | captors-enabled/moistureCaptor.py | captors-enabled/moistureCaptor.py |
class Captor():
id = 5
def Captor():
self.id = 5
def callback(self):
moisture = 0
#start communication with server
return moisture
def getiId(self):
return self.id
| mit | Python | |
25aa486fcba631a251db4f0366d4d4f713a86f37 | Add missing migration file | sigmapi-gammaiota/sigmapi-web,sigmapi-gammaiota/sigmapi-web,sigmapi-gammaiota/sigmapi-web,sigmapi-gammaiota/sigmapi-web | SigmaPi/UserInfo/migrations/0003_auto_20170204_1342.py | SigmaPi/UserInfo/migrations/0003_auto_20170204_1342.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('UserInfo', '0002_auto_20161208_1712'),
]
operations = [
migrations.AlterModelOptions(
name='pledgeclass',
... | mit | Python | |
5e51cda3a7441f6e31477988b1288d1497fe23d9 | Add arguments snippet | ScriptRock/content,ScriptRock/content,ScriptRock/content,ScriptRock/content,ScriptRock/content,ScriptRock/content | code/python/snippets/arguments.py | code/python/snippets/arguments.py | """
Add command line arguments to your script.
This snippet adds the default command line arguments required for any interaction with the UpGuard API.
To Use:
1. Copy snippet to the top of your script
2. Populate description (this is shown when running `--help`)
3. Access arguments with `args` object, for example: `... | mit | Python | |
8bdc9c0685500b822787779b5ebffa46b00d8138 | Add script | Antidisestablishmentarianism/lightshow | lightshow.py | lightshow.py | #!/usr/bin/sudo / usr/bin/python
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
leds = {'floor':[], 'top-left':[]}
def setupled(name, pins):
for i in range(0, 3):
GPIO.setup(pins[i], GPIO.OUT)
leds[name].append(GPIO.PWM(pins[i], 100))
setupled('floor', [11, 13,... | mit | Python | |
1a4052deb8e0ab2deb7038220ae23d7bb9311ce9 | Add initial version of the script | agarstang/vmware-ofv-to-facter | ovf_to_facter.py | ovf_to_facter.py | #!/usr/bin/python
#stdlib
import json
import os
import subprocess
from xml.dom.minidom import parseString
def which(cmd):
"""Python implementation of `which` command."""
for path in os.environ["PATH"].split(os.pathsep):
file = os.path.join(path, cmd)
if os.path.exists(file) and os.access(file,... | mit | Python | |
2f0ba9368bc44cffce1dcf2ec483aabf04c2e127 | add python #5 | ryanbmilbourne/euler,ryanbmilbourne/euler | python/5.py | python/5.py | #!/usr/bin/env python
'''
Problem
=======
2520 is the smallest number that can be divided by each of the numbers from 1 to 10
without any remainder. What is the smallest positive number that is evenly divisible
by all of the numbers from 1 to 20?
Latest Run Stats
====== === =====
'''
from math import ceil
from m... | mit | Python | |
fdf8cb1f0420eef27592d32f2e10066482304314 | Add region protection tests for system readers | openstack/keystone,openstack/keystone,mahak/keystone,mahak/keystone,openstack/keystone,mahak/keystone | keystone/tests/unit/protection/v3/test_regions.py | keystone/tests/unit/protection/v3/test_regions.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | apache-2.0 | Python | |
459f87be465e0f5554c708fe60679494d152c8fd | Create permissions.py | dfurtado/generator-djangospa,dfurtado/generator-djangospa,dfurtado/generator-djangospa | templates/root/main/permissions.py | templates/root/main/permissions.py | from rest_framework import permissions
class IsOwnerOrReadOnly(permissions.BasePermission):
"""
Custom permission to only allow owners of an object to edit it.
"""
def has_object_permissions(self, request, view, obj):
# Read permissions are allowed to any request,
# so we'll always allow GET, HEAD, or OPTIONS... | mit | Python | |
4a98686b63563b209456a8933ef34477adcdae43 | extend Phabricator class and do nothing | TidalLabs/py-phabricate | phabricate/phab.py | phabricate/phab.py | from phabricator import Phabricator as _Phabricator
class Phabricator(_Phabricator):
pass
| bsd-3-clause | Python | |
cca6b0c28747a3b0307fccd33dee60fcb42d910d | Test Fix. | leoc/home-assistant,JshWright/home-assistant,fbradyirl/home-assistant,kennedyshead/home-assistant,emilhetty/home-assistant,aequitas/home-assistant,happyleavesaoc/home-assistant,jabesq/home-assistant,keerts/home-assistant,Cinntax/home-assistant,deisi/home-assistant,kyvinh/home-assistant,devdelay/home-assistant,jamespcol... | tests/components/garage_door/test_demo.py | tests/components/garage_door/test_demo.py | """
tests.components.garage_door.test_demo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests demo garage door component.
"""
import unittest
import homeassistant.core as ha
import homeassistant.components.garage_door as gd
LEFT = 'garage_door.left_garage_door'
RIGHT = 'garage_door.right_garage_door'
class TestGarageDoorDemo(... | """
tests.components.garage_door.test_demo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests demo garage door component.
"""
import unittest
import homeassistant.core as ha
import homeassistant.components.garage_door as gd
LEFT = 'garage_door.left_garage_door'
RIGHT = 'garage_door.right_garage_door'
class TestGarageDoorDemo(... | mit | Python |
67d0d381003dc02d5e1eae9d0c8591daee4b93b3 | Migrate SnafuComics to single-class module. | webcomics/dosage,blade2005/dosage,peterjanes/dosage,peterjanes/dosage,webcomics/dosage,blade2005/dosage | dosagelib/plugins/snafu.py | dosagelib/plugins/snafu.py | # -*- coding: utf-8 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2016 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
from ..scraper import _ParserScraper
from ..helpers import indirectStarter... | # -*- coding: utf-8 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2016 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
from ..scraper import _ParserScraper
from ..helpers import indirectStarter... | mit | Python |
43cf23e793794fd45322471a52c83785070ac243 | add simple_graph | ndraper2/data-structures,SakiFu/data-structures | simple_graph.py | simple_graph.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
class Graph(object):
def __init__(self):
self.gdict = {}
def nodes(self):
return self.gdict.keys()
def edges(self):
self.edges = []
for node in self.gdict:
for end in self.gdict[node]:
... | mit | Python | |
7d9b004b3fb33ed9f16ca657ddb6ee3ddf452802 | add dump2pe (t2_08 sample) | LRGH/elfesteem,LRGH/elfesteem | elfesteem/t2_08_dump2pe.py | elfesteem/t2_08_dump2pe.py | #! /usr/bin/env python
import pe
from pe_init import PE
import rlcompleter,readline,pdb, sys
from pprint import pprint as pp
readline.parse_and_bind("tab: complete")
import shlex
f = open('my_dump.txt', 'r')
for i in xrange(27):
f.readline()
state = 0
funcs = []
dll = ""
#parse imprec output
new_dll = []
while... | lgpl-2.1 | Python | |
0881e326a604977bcaf385db152a96826db52b74 | Add class for publishing a service on avahi | wizbit-archive/wizbit,wizbit-archive/wizbit | wizd/publish.py | wizd/publish.py | import dbus
import gobject
import avahi
import threading
import sys
from dbus.mainloop.glib import DBusGMainLoop
"""
Class for publishing a service on DNS-SD using Avahi.
Creates a thread to handle requests
"""
class ServicePublisher (threading.Thread):
def __init__(self, name, type, port, txt = "", domain = "", h... | lgpl-2.1 | Python | |
062b4d045580adaebf30376cae1b88387dc7f3bb | add test_db | xu6148152/WebApp-Python,xu6148152/WebApp-Python,xu6148152/WebApp-Python | www/test_deb.py | www/test_deb.py | # coding=utf-8
from www.models import User
from www.transwarp import db
__author__ = 'xubinggui'
db.create_engine(user='www-data', password='www-data', database='awesome')
u = User(name='Test', email='test@example.com', password='1234567890', image='about:blank')
u.insert()
print 'new user id:', u.id
u1 = User.fi... | mit | Python | |
64c24ee2813e5d85866d14cfdee8258b91c09df6 | add debug topology file | bolshoibooze/hone,bolshoibooze/hone,pupeng/hone,bolshoibooze/hone,bolshoibooze/hone,pupeng/hone,pupeng/hone,pupeng/hone | evaluation/topo-fattree.py | evaluation/topo-fattree.py | """Custom topology example
Two directly connected switches plus a host for each switch:
host --- switch --- switch --- host
Adding the 'topos' dict with a key/value pair to generate our newly defined
topology enables one to pass in '--topo=mytopo' from the command line.
"""
from mininet.topo import Topo
class M... | bsd-3-clause | Python | |
b3a16addda494428a69b80fe7d32b07520e1d292 | Create wikinews-updater.py | SiarheiGribov/pyBot,SiarheiGribov/pyBot | wikinews-updater.py | wikinews-updater.py | #!/usr/bin/env python
# -- coding: utf-8 --
import time
import requests
import login
wn_API = "https://ru.wikinews.org/w/api.php"
wp_API = "https://ru.wikipedia.org/w/api.php"
ua = {"User-agent": "pyBot/latestnews (toolforge/iluvatarbot; iluvatar@tools.wmflabs.org) requests (python3)"}
token, cookies = login.login(se... | mit | Python | |
d0474ea69c9bcc5b07829603778e0277d1fd733a | fix moved Glottolog identifier of nepa1252 | clld/glottolog3,clld/glottolog3 | migrations/versions/1715ee79365_fix_missing_nepa1252_identifier.py | migrations/versions/1715ee79365_fix_missing_nepa1252_identifier.py | # coding=utf-8
"""fix missing nepa1252 identifier
Revision ID: 1715ee79365
Revises: 506dcac7d75
Create Date: 2015-04-15 19:34:27.655000
"""
# revision identifiers, used by Alembic.
revision = '1715ee79365'
down_revision = '506dcac7d75'
import datetime
from alembic import op
import sqlalchemy as sa
def upgrade():... | mit | Python | |
2749b4b754562c45a54b3df108c5c40c8d548038 | Create __init__.py | anvanza/invenavi,anvanza/invenavi,anvanza/invenavi | web/__init__.py | web/__init__.py | mit | Python | ||
1396ff4ab4e6664c265f97958951815a525f7823 | Remove confusing navigation tabs from header. | reddit/reddit-plugin-donate,madbook/reddit-plugin-donate,reddit/reddit-plugin-donate,madbook/reddit-plugin-donate,madbook/reddit-plugin-donate,reddit/reddit-plugin-donate | reddit_donate/pages.py | reddit_donate/pages.py | from r2.lib.pages import Reddit
from r2.lib.wrapped import Templated
class DonatePage(Reddit):
extra_stylesheets = Reddit.extra_stylesheets + ["donate.less"]
def __init__(self, title, content, **kwargs):
Reddit.__init__(
self,
title=title,
content=content,
... | from r2.lib.pages import Reddit
from r2.lib.wrapped import Templated
class DonatePage(Reddit):
extra_stylesheets = Reddit.extra_stylesheets + ["donate.less"]
def __init__(self, title, content, **kwargs):
Reddit.__init__(
self,
title=title,
content=content,
... | bsd-3-clause | Python |
307feb3f32fa31faa5754616a1e78c9ad03b0483 | test to demonstrate bug 538 | infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore,infowantstobeseen/pyglet-darwincore | tests/text/ELEMENT_CHANGE_STYLE.py | tests/text/ELEMENT_CHANGE_STYLE.py | #!/usr/bin/env python
'''Test that inline elements can have their style changed, even after text
has been deleted before them. [This triggers bug 538 if it has not yet been fixed.]
To run the test, delete the first line, one character at a time,
verifying that the element remains visible and no tracebacks are
printed... | bsd-3-clause | Python | |
3df697b29931025a9c6f3f809eda2260d4211305 | Add LayerNorm class | spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc | thinc/neural/_classes/layernorm.py | thinc/neural/_classes/layernorm.py | from ... import describe
from .model import Model
def _init_to_one(W, ops):
W.fill(1.)
def _run_child_hooks(model, X, y=None):
for hook in model.child.on_data_hooks:
hook(model.child, X, y)
model.nO = model.child.nO
@describe.on_data(_run_child_hooks)
@describe.attributes(
G=describe.Weight... | mit | Python | |
eefa1f039d935a7242bb14bdb6f672db1ff24302 | Create omega-virus.py | DrQuixote/omega_virus-python | omega-virus.py | omega-virus.py | #!/usr/bin/python
#
# Insert docopt user help menu here?
#
#
# End docopt
#
def sectors()
# Blue
# Green
# Red
# Yellow
def roomList()
# List of rooms
# Green (open rooms)
# Blue (requires blue key)
# Red (requires red key)
# Yellow (requires yellow key)
def roomContents()
# Each room can have one of:
... | cc0-1.0 | Python | |
04f937a24279699164278d47fc5d0790a9062132 | add gunicorn.py | DoubleHYH/my_Blog,DoubleHYH/my_Blog,DoubleHYH/my_Blog | wsgi_gunicorn.py | wsgi_gunicorn.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from werkzeug.contrib.fixers import ProxyFix
from app import create_app
app = create_app()
app.wsgi_app = ProxyFix(app.wsgi_app)
if __name__ == '__main__':
app.run(host='0.0.0.0')
| mit | Python | |
6036f03328d4908b268fa1256b552d588dbcbfc8 | Add pytest unit test for Scenario Loop model. Refs #142 | radish-bdd/radish,radish-bdd/radish | tests/unit/test_scenarioloop.py | tests/unit/test_scenarioloop.py | # -*- coding: utf-8 -*-
"""
radish
~~~~~~
Behavior Driven Development tool for Python - the root from red to green
Copyright: MIT, Timo Furrer <tuxtimo@gmail.com>
"""
from radish.scenarioloop import ScenarioLoop
from radish.iterationscenario import IterationScenario
from radish.background import Bac... | mit | Python | |
a81f39089b4c60e2cb05ea892afacbcbea6f1c5d | add tests for oxml_parser | scanny/python-pptx,kevingu1003/python-pptx,hoopes/python-pptx,AlexMooney/python-pptx,cchanrhiza/python-pptx,biggihs/python-pptx | tests/oxml/test___init__.py | tests/oxml/test___init__.py | # encoding: utf-8
"""
Test suite for pptx.oxml.__init__.py module, primarily XML parser-related.
"""
from __future__ import print_function, unicode_literals
import pytest
from lxml import etree, objectify
from pptx.oxml import oxml_parser
class DescribeOxmlParser(object):
def it_enables_objectified_xml_pars... | mit | Python | |
f8c3feaf3f400cbcf3e04d9705f0cb36d083c6d7 | Include migratio for ProductPlan. | mblayman/lcp,mblayman/lcp,mblayman/lcp | conductor/accounts/migrations/0012_productplan.py | conductor/accounts/migrations/0012_productplan.py | # Generated by Django 2.0.9 on 2018-11-08 02:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("accounts", "0011_auto_20180831_0320")]
operations = [
migrations.CreateModel(
name="ProductPlan",
fields=[
(
... | bsd-2-clause | Python | |
4db13bdab18934bebcfe5b102044f936e0eab892 | Add a place to put random stuff and a list of components as a python module. | vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium | etc/component_list.py | etc/component_list.py | COMPONENTS = [
"AdaBoost",
"AutoInvert",
"AutoMlpClassifier",
"BiggestCcExtractor",
"BinarizeByHT",
"BinarizeByOtsu",
"BinarizeByRange",
"BinarizeBySauvola",
"BitDataset",
"BitNN",
"BookStore",
"CascadedMLP",
"CenterFeatureMap",
"ConnectedComponentSegmenter",
"CurvedCutSegmenter",
"CurvedCutWithCcSe... | apache-2.0 | Python | |
f7aeb7a708ef2e40546d27d480073fdc113d639e | Add check_babel_syntax ; see note below | orezpraw/unnaturalcode,orezpraw/unnaturalcode,orezpraw/unnaturalcode,orezpraw/unnaturalcode,naturalness/unnaturalcode,naturalness/unnaturalcode,naturalness/unnaturalcode,naturalness/unnaturalcode,orezpraw/unnaturalcode,naturalness/unnaturalcode,orezpraw/unnaturalcode,orezpraw/unnaturalcode,naturalness/unnaturalcode,nat... | unnaturalcode/check_babel_syntax.py | unnaturalcode/check_babel_syntax.py | #!/usr/bin/python
# Copyright 2017 Dhvani Patel
#
# This file is part of UnnaturalCode.
#
# UnnaturalCode 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 Licen... | agpl-3.0 | Python | |
3196eeb928c5715ba20d21d0d16a3087938bf6c9 | Add tools/compute_bottleneck.py. | openimages/dataset,openimages/dataset,openimages/dataset | tools/compute_bottleneck.py | tools/compute_bottleneck.py | #!/usr/bin/env python
#
# Copyright 2016 The Open Images 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
#
# U... | apache-2.0 | Python | |
d7568806a81c52f268673422dbbe60117f4b490c | Add plugins test cases | menecio/django-api-bouncer | tests/test_plugin.py | tests/test_plugin.py | from rest_framework import status
from rest_framework.test import APITestCase
from django.contrib.auth import get_user_model
from api_bouncer.models import Api
User = get_user_model()
class ConsumerKeyTests(APITestCase):
def setUp(self):
self.superuser = User.objects.create_superuser(
'john'... | apache-2.0 | Python | |
b29fe95eb2cb86a7ae9170fbf8ceb2533bc84578 | Add the photo.index module (with minimal functionality so far). | RKrahl/photo-tools | photo/index.py | photo/index.py | """Provide the class Index which represents an index of photos.
"""
import os
import os.path
import fnmatch
from collections import MutableSequence
import yaml
class Index(MutableSequence):
defIdxFilename = ".index.yaml"
def __init__(self, idxfile=None, imgdir=None):
super(Index, self).__init__()
... | apache-2.0 | Python | |
eff993eac0924299cd273d0c582e24c57f2c4a84 | Add 263-ugly-number.py | mvj3/leetcode | 263-ugly-number.py | 263-ugly-number.py | """
Question:
Ugly Number
Write a program to check whether a given number is an ugly number.
Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7.
Note that 1 is typically treated as an ugl... | mit | Python | |
063096a5b52945666ec2d61bfe5201ad53461614 | Create rhn-channel-add-scl.py | vladionescu/RHN-Scripts | rhn-channel-add-scl.py | rhn-channel-add-scl.py | #!/usr/bin/python
import xmlrpclib
import sys, array
"""RHN Satellite API setup"""
SATELLITE_URL = "https://rhn.domain.tld/rpc/api"
SATELLITE_LOGIN = "username"
SATELLITE_PASSWORD = "password"
"""If the user didn't specify any hosts, show usage."""
if len(sys.argv) < 2:
sys.exit("Usage:\n\t"+sys.argv[0]+" <hostna... | mit | Python | |
cd44e4a62e8c8f8ddba0634ccc0bb157f7745726 | add 129 | EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,zeyuanxy/project-euler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler | vol3/129.py | vol3/129.py | def A(n):
if n % 5 == 0:
return 1
x = 1
ret = 1
while x != 0:
x = (x * 10 + 1) % n
ret += 1
return ret
if __name__ == "__main__":
LIMIT = 10 ** 6
i = LIMIT + 1
while A(i) <= LIMIT:
i += 2
print i
| mit | Python | |
0ede4e22370a3f8217fee8ff995a9c7057d8b00b | Add test for redis test helper | praekelt/vumi-http-retry-api,praekelt/vumi-http-retry-api | vumi_http_retry/tests/test_redis.py | vumi_http_retry/tests/test_redis.py | import json
from twisted.trial.unittest import TestCase
from twisted.internet.defer import inlineCallbacks
from vumi_http_retry.tests.redis import create_client, zitems
class TestRedis(TestCase):
@inlineCallbacks
def setUp(self):
self.redis = yield create_client()
@inlineCallbacks
def tearD... | bsd-3-clause | Python | |
d0237f2b77a49933a4b22b43f967e414be196ff4 | Add sysmod module to replace old introspection modules | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/sysmod.py | salt/modules/sysmod.py | '''
The sys module provides information about the available functions on the
minion.
'''
def __virtual__():
'''
Return as sys
'''
return 'sys'
def doc(module=''):
'''
Return the docstrings for all modules, these strings are aggregated into
a single document on the master for easy reading.... | apache-2.0 | Python | |
fa55ceb71ff254f8ed3413a35acfe20da7c03a91 | Create BT Comm wrapper class | javatechs/RxCmd,javatechs/RxCmd,javatechs/RxCmd | rxbtcomm.py | rxbtcomm.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2016 F Dou<programmingrobotsstudygroup@gmail.com>
# See LICENSE for details.
import bluetooth
import logging
class RxBtComm(object):
"""BT communication wrapper:
Attributes:
addy: A string representing the device address.
name: A stri... | apache-2.0 | Python | |
4053aa99100e2fdc1a342a472492f53138a66d6b | Add internal utils module | lisongmin/pies,AbsoluteMSTR/pies,AbsoluteMSTR/pies,timothycrosley/pies,timothycrosley/pies,lisongmin/pies | pies/_utils.py | pies/_utils.py | """
pies/_utils.py
Utils internal to the pies library and not meant for direct external usage.
Copyright (C) 2013 Timothy Edmund Crosley
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 t... | mit | Python | |
dda01f555231b93b91b71a528c210dd722e370d2 | Add flat type driver unittests | gkotton/vmware-nsx,gkotton/vmware-nsx | neutron/tests/unit/ml2/test_type_flat.py | neutron/tests/unit/ml2/test_type_flat.py | # Copyright (c) 2014 Thales Services SAS
# 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 r... | apache-2.0 | Python | |
b52b4cb39029d55a06e15b527cb4789e2988093d | Add word2vec example | bcanvural/thesis,bcanvural/thesis | word2vec.py | word2vec.py | from pyspark.sql import SparkSession
from pyspark.ml.feature import Word2Vec
def main():
spark = SparkSession.builder \
.appName("Spark CV-job ad matching") \
.config("spark.some.config.option", "some-value") \
.master("local[*]") \
.getOrCreate()
# Input data: Each row is a b... | mit | Python | |
9607c55eacfd58704a4e83a2476471aa2da6124c | add package py-doxypypy (#3284) | krafczyk/spack,mfherbst/spack,krafczyk/spack,tmerrick1/spack,EmreAtes/spack,iulian787/spack,LLNL/spack,EmreAtes/spack,matthiasdiener/spack,LLNL/spack,tmerrick1/spack,EmreAtes/spack,matthiasdiener/spack,EmreAtes/spack,skosukhin/spack,iulian787/spack,lgarren/spack,iulian787/spack,iulian787/spack,mfherbst/spack,tmerrick1/... | var/spack/repos/builtin/packages/py-doxypypy/package.py | var/spack/repos/builtin/packages/py-doxypypy/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
83fa6b23563903192376a3419b460b9b06479248 | Add procstat.py | gyulkkajo/linux-util | src/procstat.py | src/procstat.py | import os.path
import argparse
import logging
logging.basicConfig(level=logging.DEBUG)
class Procstat():
PROCSTATPATH = '/proc/%d/stat'
STATLIST = (
'pid',
'comm',
'state',
'ppid',
'pgrp',
'session',
'tty_nr',
'tpgid',
'flags',
'minflt',
'cminflt',
'mjflt',
'cmajflt',
'utime',
'stime'... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.