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 |
|---|---|---|---|---|---|---|---|---|
ecfbaded5e03529d1b189b6b5fc8b2f8516c4b31 | Add hoster plugin for ARD mediathek | vuolter/pyload,vuolter/pyload,vuolter/pyload,pyblub/pyload,pyblub/pyload | module/plugins/hoster/ARD.py | module/plugins/hoster/ARD.py |
import subprocess
import re
import os.path
import os
from module.utils import save_join, save_path
from module.plugins.Hoster import Hoster
# Requires rtmpdump
# by Roland Beermann
class RTMP:
# TODO: Port to some RTMP-library like rtmpy or similar
# TODO?: Integrate properly into the API of pyLoad
com... | agpl-3.0 | Python | |
206ef4f7aad6c4ce51e4737a7d506a79061f1047 | Add an `import_or_skip` function to testing. | RaoUmer/distarray,enthought/distarray,enthought/distarray,RaoUmer/distarray | distarray/testing.py | distarray/testing.py | import unittest
import importlib
from functools import wraps
from distarray.error import InvalidCommSizeError
from distarray.mpiutils import MPI, create_comm_of_size
def import_or_skip(name):
"""Try importing `name`, raise SkipTest on failure.
Parameters
----------
name : str
Module name to ... | import unittest
from functools import wraps
from distarray.error import InvalidCommSizeError
from distarray.mpiutils import MPI, create_comm_of_size
def comm_null_passes(fn):
"""Decorator. If `self.comm` is COMM_NULL, pass."""
@wraps(fn)
def wrapper(self, *args, **kwargs):
if self.comm == MPI.CO... | bsd-3-clause | Python |
80c1dba49bbdaf4d0d37e8a06549774d2afd019a | Add cosmo_viewer app | gcasey/cosmotrack,gcasey/cosmotrack | pvapp/cosmo_viewer.py | pvapp/cosmo_viewer.py | ################################################################################
#
# Copyright 2013 Kitware, Inc.
#
# 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... | apache-2.0 | Python | |
8287876963af72756c3ff9102526c56f3e28a8a2 | Test for file resources | lexman/tuttle,lexman/tuttle,lexman/tuttle | tests/functional_tests/test_resources/test_file_resource.py | tests/functional_tests/test_resources/test_file_resource.py | # -*- coding: utf8 -*-
from tuttle.resources import FileResource
import tuttle.resources
from os import path
class TestHttpResource():
def test_real_resource_exists(self):
"""A real resource should exist"""
file_url = "file://{}".format(path.abspath(tuttle.resources.__file__))
res = File... | mit | Python | |
14755cda032b5cb44626b2da66d943517427f947 | test for malformed db imports | moronbros/f5go,moronbros/f5go | tests/test_core.py | tests/test_core.py | """unit tests for core.py"""
import pytest
import core
def test_malformed_linkdatabase():
# pytest.set_trace()
with pytest.raises(EOFError):
core.LinkDatabase().load(db='tests/garbage.pickle')
| mit | Python | |
3a59057f7465d9982e26b92cddafa0ea9ba48806 | Add new package: universal-ctags (#18962) | iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/universal-ctags/package.py | var/spack/repos/builtin/packages/universal-ctags/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class UniversalCtags(AutotoolsPackage):
"""Universal Ctags generates an index (or tag) file of l... | lgpl-2.1 | Python | |
f29e278a1b661224c9580d8275654a8c6fe7d3cf | add test for http.encode_request | meiraka/python-bbs2ch | tests/test_http.py | tests/test_http.py | """Test bbs2ch.http module."""
from bbs2ch import http
def test_host_path():
"""Return hostname and path from url."""
assert (u'hoge.com', '/') == http.host_path(u'http://hoge.com/')
def test_encode_request_get():
"""Return http request string."""
header = [(u'Key', u'Value'),
(u'Key2'... | bsd-3-clause | Python | |
f032556bf07b37f9544c71ecad7aed472021bc97 | Add script to update giving and teams receiving | gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com | sql/branch.py | sql/branch.py | import sys
from gratipay import wireup
db = wireup.db(wireup.env())
participants = db.all("""
SELECT p.*::participants
FROM participants p
WHERE (
SELECT error
FROM current_exchange_routes er
WHERE er.participant = p.id
AND network = 'braintree-cc'
) <> ''
""... | mit | Python | |
da66b2a2a2e2a73ffd986aea6ba5d086d43892fc | Add main smoketest | rshipp/chaser,rshipp/chaser | tests/test_main.py | tests/test_main.py | import unittest
import sys
from chaser import main
class TestMain(unittest.TestCase):
def test_smoke_main(self):
sys.argv = ["chaser"]
main()
| bsd-3-clause | Python | |
ad1d349d49072b5bda6641db4f070704fde81e5f | Add FCC. | divergentdave/inspectors-general,lukerosiak/inspectors-general | inspectors/fcc.py | inspectors/fcc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import logging
import os
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# http://transition.fcc.gov/oig/oigreportsaudit.html
# Oldest report: 1994
# options:
# standard since/year options for a year ra... | cc0-1.0 | Python | |
c510b27dea59eeae229cf30dabc39ae083f286b0 | Add better indexes | Ilhasoft/ureport,rapidpro/ureport,Ilhasoft/ureport,rapidpro/ureport,Ilhasoft/ureport,Ilhasoft/ureport,rapidpro/ureport,rapidpro/ureport | ureport/stats/migrations/0017_better_indexes.py | ureport/stats/migrations/0017_better_indexes.py | # Generated by Django 3.2.6 on 2021-09-27 17:49
from django.db import migrations
INDEX_POLLSTATS_ORG_RESULT_SQL = """
CREATE INDEX IF NOT EXISTS stats_pollstats_org_result on stats_pollstats (org_id, flow_result_id) WHERE flow_result_id IS NOT NULL;
"""
INDEX_POLLSTATS_ORG_QST_RST_CAT_SQL = """
CREATE INDEX IF NOT ... | agpl-3.0 | Python | |
b304b1087d69d4142a9df5ad2db339e5aafe3331 | Update category | munisisazade/developer_portal,munisisazade/developer_portal,munisisazade/developer_portal | news/views.py | news/views.py | from django.shortcuts import render, redirect,render_to_response
from django.template import RequestContext
from django.http import HttpResponse
from django.urls import reverse
from django.views.generic import TemplateView,DetailView
# Create your views here
from news.models import Slider,How_it_works,ArticleCategory,... | from django.shortcuts import render, redirect,render_to_response
from django.template import RequestContext
from django.http import HttpResponse
from django.urls import reverse
from django.views.generic import TemplateView,DetailView
# Create your views here
from news.models import Slider,How_it_works,ArticleCategory,... | mit | Python |
fb86dcdd6046c7d35e932396ba541671727b4d01 | rearrange imports to standards | conslo/ngSe | ngSe/utils.py | ngSe/utils.py | from functools import wraps
from time import time, sleep
from .exceptions import element_exceptions
def retry(f=None, timeout=30, interval=0.1):
"""
When working with a responsive UI, sometimes elements are not ready at the very second you request it
This wrapper will keep on retrying finding or interact... | from time import time, sleep
from functools import wraps
from .exceptions import element_exceptions
def retry(f=None, timeout=30, interval=0.1):
"""
When working with a responsive UI, sometimes elements are not ready at the very second you request it
This wrapper will keep on retrying finding or interact... | lgpl-2.1 | Python |
92aab88f88a4a9e3df82dd3f7a94b491a7cb3bd1 | add interactive script | darshanime/sandpiles | interactive.py | interactive.py | from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
pile = defaultdict(dict)
def draw_sandpile():
dim = raw_input("Enter dimensions of grid (eg, 4x4):\n")
try:
r, c = map(int, dim.strip().split('x'))
pile["r"] = r
pile["c"] = c
except Exception:
... | mit | Python | |
d648aeb90158cb104ac6548887a39dc13dfa236f | add management cmd make_emails_lowercase | qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/users/management/commands/make_emails_lowercase.py | corehq/apps/users/management/commands/make_emails_lowercase.py | from django.core.management import BaseCommand
from corehq.apps.users.models import CouchUser
class Command(BaseCommand):
help = "Makes emails into lowercase"
def handle(self, *args, **options):
for couch_user in CouchUser.all():
if couch_user.email and any(char.isupper() for char in cou... | bsd-3-clause | Python | |
9d2976200965c4ea6b324d0822f6be786a25f2ea | Add file containing filesystem utilities | jrsmith3/refmanage | refmanage/fs_utils.py | refmanage/fs_utils.py | # -*- coding: utf-8 -*-
| mit | Python | |
5a77df8ebd1fd20ac6de34fe19853adbfeea6e31 | Add arabic tests | he7d3r/revscoring,wiki-ai/revscoring | revscoring/languages/tests/test_arabic.py | revscoring/languages/tests/test_arabic.py | import pickle
from nose.tools import eq_
from .. import arabic
from ...datasources import revision
from ...dependencies import solve
from .util import compare_extraction
BAD = [
"احا",
"عاهرا",
"زندقتهما",
"حمار",
"لعن",
"يلعن",
"لعنه",
"امك",
"لعنتهما",
"فلعنهما",
"اعزبوا... | mit | Python | |
6979bbf6547d689b1980762349a0e78c9c7c026d | Create fibonacci.py | DavidMellul/Projets,DavidMellul/Projets,DavidMellul/Projets,DavidMellul/Projets,DavidMellul/Projets,DavidMellul/Projets,DavidMellul/Projets | python/fibonacci/fibonacci.py | python/fibonacci/fibonacci.py | a = 0
b = 1
c = 0
n = int(input("Nombre de termes : "))
for i in range (1, n+1):
c = a+b
b = a
a= c
print(c)
| mit | Python | |
fcf691454b8607fec9d7f5cba43579dc02c26c8b | Check coverage of pgi, vs gi | lazka/pgi,lazka/pgi | tests/pgi_covergage.py | tests/pgi_covergage.py | """
find pgi coverage of all gi.repositorys.
you need to have access to both 'gi' and 'pgi' in the current python
environment.
In a virtualenv this works:
$ pip install pgi
$ pip install vext.gi
$ python pgi_coverage.py
"""
TYPELIB_DIR="/usr/lib/girepository-1.0"
from os.path import basename
from glob import glob
... | lgpl-2.1 | Python | |
7c1cbc49e6cdc6ef514382eee9679f4e9719257b | add basic-calculator-ii | zeyuanxy/leet-code,EdisonAlgorithms/LeetCode,EdisonAlgorithms/LeetCode,EdisonAlgorithms/LeetCode,zeyuanxy/leet-code,zeyuanxy/leet-code | vol5/basic-calculator-ii/basic-calculator-ii.py | vol5/basic-calculator-ii/basic-calculator-ii.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2015-11-18 17:22:37
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2015-11-18 17:22:44
class Solution:
operators = ['+', '-', '*', '/']
def getPriority(self, operator):
return {
'+' : 1,
... | mit | Python | |
943383a60f76a13290e540ac35c1ea3a8fc21a3e | Add a utility for downsampling a pair FASTQ files. | cfe-lab/MiCall,cfe-lab/MiCall,cfe-lab/MiCall | micall/utils/sample_fastq.py | micall/utils/sample_fastq.py | #!/usr/bin/env python
import argparse
import random
def parse_args():
parser = argparse.ArgumentParser(
description="Randomly sample reads from FASTQ files for quick processing.")
parser.add_argument('fastq1',
type=argparse.FileType('rU'),
help='origina... | agpl-3.0 | Python | |
408be8a0d49b7542c74e016a572499a8c4d85351 | Add tests to verify team index and add pages render without errors | rtfoley/scorepy,rtfoley/scorepy,rtfoley/scorepy | app/teams/tests.py | app/teams/tests.py | from app.test_base import BaseTestCase
class TestTeamBehavior(BaseTestCase):
def test_index_page_200(self):
self.login()
response = self.client.get('/teams/')
self.assert200(response)
def test_add_page_200(self):
self.login()
response = self.client.get('/teams/new')
... | mit | Python | |
5ce6283cff4a3a97911a663d777869a7c7377341 | add http_codes | sassoftware/catalog-service,sassoftware/catalog-service,sassoftware/catalog-service | catalogService/http_codes.py | catalogService/http_codes.py | #
# Copyright (c) 2008 rPath, Inc.
#
HTTP_CONTINUE = 100
HTTP_SWITCHING_PROTOCOLS = 101
HTTP_PROCESSING = 102
HTTP_OK = 200
HTTP_CREATED = 201
HTTP_ACCEPTED = 202
HTTP_NON_AUTHORITATIVE = 203
HTTP_NO_CONTENT = 204
HTTP_RESET_CONTENT = 205
HTTP_PARTIAL_CONTENT = 206
HTTP_MULTI_STATUS = 207
HTTP_MULTIPLE_CHOICES = 300
H... | apache-2.0 | Python | |
5c602a98098bdedeffc2b7359a4b3d8407cb1449 | Add migration to ensure consistency on file keys. | rdhyee/osf.io,amyshi188/osf.io,sloria/osf.io,zachjanicki/osf.io,mluo613/osf.io,asanfilippo7/osf.io,brandonPurvis/osf.io,doublebits/osf.io,mfraezz/osf.io,laurenrevere/osf.io,pattisdr/osf.io,erinspace/osf.io,bdyetton/prettychart,revanthkolli/osf.io,MerlinZhang/osf.io,caseyrygt/osf.io,TomHeatwole/osf.io,cldershem/osf.io,H... | scripts/migrate_inconsistent_file_keys.py | scripts/migrate_inconsistent_file_keys.py | #!/usr/bin/env python
# encoding: utf-8
"""Find all nodes with different sets of keys for `files_current` and
`files_versions`, and ensure that all keys present in the former are also
present in the latter.
"""
from website.models import Node
from website.app import init_app
def find_file_mismatch_nodes():
"""Fi... | apache-2.0 | Python | |
e5e6506ab6b5191e309aa75e56e25253c0ba7763 | Create drivers.py | ariegg/webiopi-drivers,ariegg/webiopi-drivers | chips/memory/file/drivers.py | chips/memory/file/drivers.py | # This code has to be added to the corresponding __init__.py
DRIVERS["filememory"] = ["PICKLEFILE", "JSONFILE"]
| apache-2.0 | Python | |
386baa36355b0e9378fff59fe768d1baa7e73fec | Add Himax motion detection example. | openmv/openmv,iabdalkader/openmv,openmv/openmv,iabdalkader/openmv,iabdalkader/openmv,iabdalkader/openmv,kwagyeman/openmv,kwagyeman/openmv,kwagyeman/openmv,openmv/openmv,kwagyeman/openmv,openmv/openmv | scripts/examples/Arduino/Portenta-H7/21-Sensor-Control/himax_motion_detection.py | scripts/examples/Arduino/Portenta-H7/21-Sensor-Control/himax_motion_detection.py | # Himax motion detection example.
import sensor, image, time, pyb
from pyb import Pin, ExtInt
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA)
sensor.set_framerate(15)
sensor.ioctl(sensor.IOCTL_HIMAX_MD_THRESHOLD, 0x01)
sensor.ioctl(sensor.IOCTL_HIMAX_MD_WINDOW, (0, 0, 320, 240... | mit | Python | |
b1ab4ef6fbac0ce02d05464e03599d44721fb239 | Add an example using partial. | masasin/latexipy | examples/partial.py | examples/partial.py | #!/usr/bin/env python
from functools import partial
import matplotlib.pyplot as plt
import numpy as np
from latexipy import latexipy as lp
if __name__ == '__main__':
lp.latexify()
figure = partial(lp.figure, folder='some_images', exts=['png'])
x = np.linspace(-np.pi, np.pi)
y1 = np.sin(x)
y2 =... | mit | Python | |
e781a1e89b945dad1585f82dfdb77cbffbe8fdeb | add unit tests | olof/svtplay-dl,dalgr/svtplay-dl,iwconfig/svtplay-dl,qnorsten/svtplay-dl,olof/svtplay-dl,selepo/svtplay-dl,spaam/svtplay-dl,dalgr/svtplay-dl,spaam/svtplay-dl,qnorsten/svtplay-dl,iwconfig/svtplay-dl,selepo/svtplay-dl | lib/svtplay_dl/tests/prio_streams.py | lib/svtplay_dl/tests/prio_streams.py | #!/usr/bin/python
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil; coding: utf-8 -*-
# ex:ts=4:sw=4:sts=4:et:fenc=utf-8
from __future__ import absolute_import
import unittest
from svtplay_dl.utils import prio_streams
class Stream(object):
def __init__(self, proto, bitrate):
self.proto = proto... | mit | Python | |
4e4a8bbb459e6158a7c2d22c04849de9b4de2693 | Add directory.py to the directory package | SizzlingVortex/classyfd | classyfd/directory/directory.py | classyfd/directory/directory.py | """Contains a Directory class to represent real directories""" | mit | Python | |
0c079b7160cf635c14a016d418d2bc8d3d521f26 | add docker start tool | hxsf/OnlineJudge,Timeship/OnlineJudge-1,Timeship/OnlineJudge-1,wangmingjob/OnlineJudge,Timeship/OnlineJudge-1,hxsf/OnlineJudge,uestcxl/OnlineJudge,Timeship/OnlineJudge-QDU,uestcxl/OnlineJudge,hxsf/OnlineJudge,Timeship/OnlineJudge-QDU,Timeship/OnlineJudge-1,hxsf/OnlineJudge,wangmingjob/OnlineJudge,wangmingjob/OnlineJudg... | tools/run.py | tools/run.py | # coding=utf-8
import os
import json
os.system("docker rm -f redis")
os.system("docker rm -f mysql")
os.system("docker rm -f oj_web_server")
if os.system("docker run --name mysql -v /root/data:/var/lib/mysql -v /root/data/my.cnf:/etc/my.cnf -e MYSQL_ROOT_PASSWORD=root -d mysql/mysql-server:latest"):
print "Error... | mit | Python | |
4cf7f6c23bc9d01c6780afa4d27bf9e5e71fb72b | add hacky download | akrherz/pyWWA,akrherz/pyWWA | util/unidata_dl.py | util/unidata_dl.py | import glob
import os
import datetime
sts = datetime.datetime(2016, 11, 21, 0, 0)
ets = datetime.datetime(2016, 11, 21, 3, 0)
interval = datetime.timedelta(minutes=1)
os.chdir('data/nexrad/NIDS')
for nexrad in glob.glob('???'):
os.chdir(nexrad)
for nids in ['N0Q', 'NET', 'N0R', 'EET']:
if not os.path.... | mit | Python | |
3dbf91d4d447f6dbddece040b3a9dcbeb8ebcd22 | Add missing migrations | sakset/getyourdata,sakset/getyourdata,sakset/getyourdata,sakset/getyourdata | getyourdata/data_request/migrations/0023_auto_20160716_0946.py | getyourdata/data_request/migrations/0023_auto_20160716_0946.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-16 09:46
from __future__ import unicode_literals
from django.db import migrations, models
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('data_request', '0022_faqcontent_priority'),
]
ope... | mit | Python | |
ddb9e1c0160f40fe60330c247906b9b41f18be1b | Create hearthstone_way_to_legend.py | kawaiigamer/py_parsers | hearthstone_way_to_legend.py | hearthstone_way_to_legend.py | import random,statistics
winrate = 0.51
iterations = 100
games = [0]*iterations
passwinstreak = 5*5 # below Rank 5
for x in range(iterations):
# 1-10 11-15 => 15 rank
ladderPosition = 5*10 + 4*5
winstrek = 0
while True:
games[x] = games[x] + 1
if random.... | unlicense | Python | |
a801deeaa00e443b3c68c1fbcea1e6ff62d90082 | Add Python script to generate users | veekaybee/intro-to-sql,veekaybee/intro-to-sql,veekaybee/intro-to-sql | python/addusers.py | python/addusers.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Adds a sequential number of users into a test database
with username: newusern and password newusern
Not for production usage
"""
import MySQLdb
hostname = # FILL IN
username = # FILL IN
password = # FILL IN
# Simple routine to run a query on a database and prin... | mit | Python | |
821f1b83c441122b28ad2dc869576ca22a4ee642 | Create ngram_service.py | dragoon/kilogram,dragoon/kilogram,dragoon/kilogram | ngram_utils/ngram_service.py | ngram_utils/ngram_service.py | from thrift.transport import TSocket
from thrift.protocol import TBinaryProtocol
from thrift.transport import TTransport
from libs.hbase import Hbase
class NgramService(object):
def __init__(self, mongo_host, hbase_host):
mclient = settings.MONGO_CLIENT
unigram_db = mclient['unigrams']
bigram_db = mcl... | apache-2.0 | Python | |
897b56183c3b30a0bc4f439e20d42ce8da2b444c | add empty unit test for viewhandler module | julien6387/supervisors,julien6387/supervisors,julien6387/supvisors,julien6387/supvisors,julien6387/supvisors,julien6387/supervisors,julien6387/supvisors,julien6387/supervisors | supvisors/tests/test_viewhandler.py | supvisors/tests/test_viewhandler.py | #!/usr/bin/python
#-*- coding: utf-8 -*-
# ======================================================================
# Copyright 2016 Julien LE CLEACH
#
# 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 Lice... | apache-2.0 | Python | |
f06d8ccbd066c432a91ffc127d347277253f95c3 | Add pynbs module | fizzy81/pynbs | pynbs.py | pynbs.py |
from struct import Struct
from collections import namedtuple
__all__ = ['read', 'File', 'Header', 'Note', 'Layer', 'Instrument']
BYTE = Struct('<b')
SHORT = Struct('<h')
INT = Struct('<i')
Note = namedtuple('Note', ['tick', 'layer', 'instrument', 'key'])
Layer = namedtuple('Layer', ['id', 'name', '... | mit | Python | |
6050610a5cf34bc55a05fa3a8d8a38f6e8e743af | Add test_ko.py for "ko" locale (#9) | sdispater/pendulum,sdispater/pendulum,sdispater/pendulum | tests/localization_tests/test_ko.py | tests/localization_tests/test_ko.py | # -*- coding: utf-8 -*-
from pendulum import Pendulum
from .. import AbstractTestCase
from . import AbstractLocalizationTestCase
class KoTest(AbstractLocalizationTestCase, AbstractTestCase):
locale = 'ko'
def diff_for_humans(self):
with self.wrap_with_test_now():
d = Pendulum.now().su... | mit | Python | |
013c6c57959fd8317ba8b27a2a467a37f0a1d8be | Create __init__.py | eshiofune/shopapp,eshiofune/shopapp,eshiofune/shopapp | stock/__init__.py | stock/__init__.py | mit | Python | ||
1eb1851e4dec9c6425c3cf127e6c4ec5b0d3c987 | Add LineNumberTable tests | TkTech/Jawa,TkTech/Jawa | tests/test_line_number_attribute.py | tests/test_line_number_attribute.py | # -*- coding: utf-8 -*-
import os.path
import pytest
from jawa import ClassFile
@pytest.fixture
def cf():
sample_path = os.path.join(
os.path.dirname(__file__),
'data',
'HelloWorldDebug.class'
)
with open(sample_path, 'rb') as fin:
cf = ClassFile(fin)
yield cf
... | mit | Python | |
beb98425423e0278d9d4d5e39e6b5196146425a0 | add manual tests | antirais/estnin | manual_tests.py | manual_tests.py | import os
import sys
import copy
from estnin import estnin
from estnin import _estnin
from datetime import date
from timeit import default_timer as timer
def target(count):
# return [p for p in estnin.create(estnin.FEMALE, date(2199, 12, 1), 0)]
for _ in range(count):
#estnin(89912319991, set_checksu... | mit | Python | |
cf0021c664612082c669fc562d98759fcd7a4915 | Add setup.py | Chris-Graffagnino/slackelot | setup.py | setup.py | # 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.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
... | mit | Python | |
e785008aa948e929f7e3ecab3445c1347cb128f3 | Add setup.py file | jbittel/django-signage,jbittel/django-signage,jbittel/django-signage | setup.py | setup.py | #!/usr/bin/env python
from setuptools import find_packages
from setuptools import setup
setup(
name='django-signage',
version='0.0.1',
description='A lightweight web-based digital signage application',
license='BSD',
author='Jason Bittel',
author_email='jason.bittel@gmail.com',
url='https... | bsd-3-clause | Python | |
7a21009efda275372be7b801e07635bd2a9e47af | add setup.py | byteweaver/django-coupons,byteweaver/django-coupons | setup.py | setup.py | import os
from setuptools import setup, find_packages
import coupons
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='django-coupons',
version=coupons.__version__,
description='A reuseable Django application for coupon gereration and handling.',
lo... | bsd-3-clause | Python | |
d0430066830350b3ef1621bb7c9d7ae7ae7045f4 | Add setup.py. | gaomy3832/easypyplot,gaomy3832/easypyplot | setup.py | setup.py | """
* Copyright (c) 2016. Mingyu Gao
* All rights reserved.
*
"""
import os
import re
# To use a consistent encoding
from codecs import open
# Always prefer setuptools over distutils
import setuptools
here = os.path.abspath(os.path.dirname(__file__))
package = 'easypyplot'
version = '0.0.0'
desc = 'Python matplotl... | bsd-3-clause | Python | |
3f1b78f5156a6ee18020340290dde24d02d01105 | Add basic setup.py | chrishylen-wf/ac-flask-hipchat | setup.py | setup.py | """
Flask-AtlassianConnect
-------------
This is the description for that library
"""
from setuptools import setup
setup(
name='AC-Flask-HipChat',
version='0.1-dev',
url='https://bitbucket.org/mrdon/ac-flask-hipchat',
license='APLv2',
author='Don Brown',
author_email='mrdon@twdata.org',
d... | apache-2.0 | Python | |
ec25f1901d60814a62790cae2becfb6cac0f5e3e | add argparse dep | lavagetto/configdb,lavagetto/configdb | setup.py | setup.py | #!/usr/bin/python
from setuptools import setup, find_packages
setup(
name='configdb',
version='0.1',
description='database framework for configuration info',
author='ale',
author_email='ale@incal.net',
url='http://git.autistici.org/p/configdb',
install_requires=['argparse', 'Flask', 'formencode', 'infle... | #!/usr/bin/python
from setuptools import setup, find_packages
setup(
name='configdb',
version='0.1',
description='database framework for configuration info',
author='ale',
author_email='ale@incal.net',
url='http://git.autistici.org/p/configdb',
install_requires=['Flask', 'formencode', 'inflect', 'SQLAlc... | mit | Python |
089b020b07fda88ba4679d161badb4423a75444e | add Python setup script | ivilata/pymultihash | setup.py | setup.py | # Based on PyPA sample project's setup script.
"""Pymultihash installation script."""
import os.path
from setuptools import setup
# Load readme file into long description.
thisdir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(thisdir, 'README.rst')) as readme:
long_description = readme.read... | mit | Python | |
67b5eb144dbe14c134657ccc807343f361c5e249 | add setup.py | mydeco-dev-team/sworkflow | setup.py | setup.py | from distutils.core import setup
version = '0.1.0.dev0'
setup(name='sworkflow',
version=version,
description='Simple Workflow',
url='https://github.com/mydeco-dev-team/sworkflow',
packages=['sworkflow'],
) | bsd-2-clause | Python | |
4161de9755b531825e83f684c964441bff9ffa7d | bump version to 1.0.0 | jhamman/pynco,nco/pynco | setup.py | setup.py | """
setup.py
"""
from setuptools import setup
version = "1.0.0"
setup(
name="nco",
version=version,
author="Joe Hamman",
author_email="jhamman@ucar.edu",
license="MIT",
description="""python bindings to NCO""",
packages=["nco"],
py_modules=["nco.nco", "nco.custom"],
url="https://g... | """
setup.py
"""
from setuptools import setup
version = "0.0.4"
setup(
name="nco",
version=version,
author="Joe Hamman",
author_email="jhamman@ucar.edu",
license="MIT",
description="""python bindings to NCO""",
packages=["nco"],
py_modules=["nco.nco", "nco.custom"],
url="https://g... | mit | Python |
d0b1762a098e78ee9d012628ad96d6a18e8d2565 | Create setup.py | geekgao/adsl-proxy-server | setup.py | setup.py | from distutils.core import setup
import py2exe
setup(console=["./server.py"], data_files=[('.', ['./config.ini'])])
| mit | Python | |
7b6610e03d4485575b18881c375f83e999d20459 | Add setup.py #1 | uberVU/mongo-pool,uberVU/mongo-pool | setup.py | setup.py | from setuptools import setup
import io
import os
here = os.path.abspath(os.path.dirname(__file__))
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filename in filenames:
with io.open(filename, encoding=encoding) as f:
... | apache-2.0 | Python | |
3a6dd52e3cdfc5eca51d6dac4eb0701a1a04d550 | make version 0.3.5 | Duke-GCB/DukeDSClient,Duke-GCB/DukeDSClient | setup.py | setup.py | from setuptools import setup
setup(name='DukeDSClient',
version='0.3.5',
description='Command line tool(ddsclient) to upload/manage projects on the duke-data-service.',
url='https://github.com/Duke-GCB/DukeDSClient',
keywords='duke dds dukedataservice',
author='John Bradley',
... | from setuptools import setup
setup(name='DukeDSClient',
version='0.3.4',
description='Command line tool(ddsclient) to upload/manage projects on the duke-data-service.',
url='https://github.com/Duke-GCB/DukeDSClient',
keywords='duke dds dukedataservice',
author='John Bradley',
... | mit | Python |
b25e21745ecdc5c03b3229ba77ee51b5fdd1561d | Move scapy to scapyproto to avoid breaking import of scapy from inside of protocols | 0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,hackerberry/ooni-probe,kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,lordappsec/ooni-probe,Karthikeyan-kkk/oo... | ooni/protocols/scapyproto.py | ooni/protocols/scapyproto.py | import random
from zope.interface import implements
from twisted.python import usage
from twisted.plugin import IPlugin
from twisted.internet import protocol, defer
from ooni.plugoo.tests import ITest, OONITest
from ooni.plugoo.assets import Asset
from ooni.utils import log
from ooni.lib.txscapy import txsr, txsend
c... | bsd-2-clause | Python | |
3cab374806f9fd8a5fd90265025a4b021e0056f6 | add preliminary mergetools tests | PFCM/facebook_data_collection | test_mergetools.py | test_mergetools.py | """
Tests for the mergetools.py script.
"""
import tempfile
import random
from contextlib import contextmanager
import string
import datetime
import csv
import pandas as pd
import mergetools
from scraper import CSV_HEADERS
def random_str(length, chars=string.ascii_lowercase):
return ''.join(random.choice(chars) ... | bsd-2-clause | Python | |
992191d290df8d7764a272c3b45e2f7b937456ec | add fib | Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python | misc/py3/fib.py | misc/py3/fib.py | #!/usr/bin/env python
# Python 3: Fibonacci series up to n
def fib(n):
a, b = 0, 1
while a < n:
print(a, end=' ')
a, b = b, a + b
print()
fib(1000)
| mit | Python | |
abf7b0ffd86656f8311da7bfde65663d35ffd543 | fix for using stencilview | hansent/kivy,janssen/kivy,tony/kivy,Farkal/kivy,janssen/kivy,xiaoyanit/kivy,wangjun/kivy,youprofit/kivy,Shyam10/kivy,arcticshores/kivy,bob-the-hamster/kivy,adamkh/kivy,bob-the-hamster/kivy,jehutting/kivy,CuriousLearner/kivy,eHealthAfrica/kivy,matham/kivy,bionoid/kivy,MiyamotoAkira/kivy,wangjun/kivy,darkopevec/kivy,dark... | kivy/uix/scrollview.py | kivy/uix/scrollview.py | '''
Scroll View
===========
A ScrollView provides a scrollable/pannable viewport which is clipped to the
ScrollView's bounding box.
'''
__all__ = ('ScrollView', )
from kivy.uix.stencilview import StencilView
from kivy.uix.scatter import ScatterPlane
class ScrollView(StencilView):
'''ScrollView class. See modul... | '''
ScrollView widget
'''
__all__ = ('ScrollView', )
from kivy.uix.stencil import StencilView
from kivy.uix.scatter import ScatterPlane
class ScrollView(StencilView):
'''
ScrollView:
A ScrollView provides a scrollable/pannable viewport
which is clipped to the ScrollView's bounding box.
'... | mit | Python |
befa79ec76752f0811b49ec323813e6e1931638d | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | hackerrank/algorithms/implementation/medium/bigger_is_greater/py/solution.py | hackerrank/algorithms/implementation/medium/bigger_is_greater/py/solution.py | def solution(s):
#
# The next permutation algorithm. For more information, please look up:
# [href.] https://www.nayuki.io/page/next-lexicographical-permutation-algorithm
# [href.] https://en.wikipedia.org/wiki/Permutation#Generation_in_lexicographic_order
#
chars = list(s)
i = len(... | mit | Python | |
df8ddd56ad51f0a644696cb0ff12c2e7a17c5913 | Create lonely-pixel-i.py | jaredkoontz/leetcode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu... | Python/lonely-pixel-i.py | Python/lonely-pixel-i.py | # Time: O(m * n)
# Space: O(m + n)
class Solution(object):
def findLonelyPixel(self, picture):
"""
:type picture: List[List[str]]
:rtype: int
"""
rows, cols = [0] * len(picture), [0] * len(picture[0])
for i in xrange(len(picture)):
for j in xrange(len(p... | mit | Python | |
c1dcb46e95d5b96ecf45db2e1f466b6f99330e1c | Add VimwikiTask cache-ing | Spirotot/taskwiki,phha/taskwiki | taskwiki/cache.py | taskwiki/cache.py | import copy
import vim
class TaskCache(object):
"""
A cache that holds all the tasks in the given file and prevents
multiple redundant taskwarrior calls.
"""
def __init__(self, tw):
self.task_cache = dict()
self.vimwikitask_cache = dict()
self.tw = tw
def __getitem__(... | import copy
import vim
class TaskCache(object):
"""
A cache that holds all the tasks in the given file and prevents
multiple redundant taskwarrior calls.
"""
def __init__(self, tw):
self.cache = dict()
self.tw = tw
def __getitem__(self, key):
task = self.cache.get(key... | mit | Python |
67c3c0e3c165dc73f548cff57d6cb390614d5aad | Bring back old watcher module | igboyes/virtool,igboyes/virtool,virtool/virtool,virtool/virtool | virtool/watcher.py | virtool/watcher.py | import os
import time
import logging
from virtool.utils import file_stats
from setproctitle import setproctitle
from multiprocessing import Process
from inotify.adapters import Inotify
logger = logging.getLogger(__name__)
TYPE_NAME_DICT = {
"IN_CREATE": "create",
"IN_MODIFY": "modify",
"IN_DELETE": "dele... | mit | Python | |
4d08ff430eba96ebef3f0824fe83f5bc2a236675 | add share_mem | Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python | multiprocessing/share_mem.py | multiprocessing/share_mem.py | #!/usr/bin/env python
from multiprocessing import Process, Value, Array
def f(n, a):
n.value = 3.1415927
for i in range(len(a)):
a[i] = -a[i]
if __name__ == '__main__':
num = Value('d', 0.0)
arr = Array('i', range(10))
p = Process(target=f, args=(num, arr))
p.start()
p.join()
... | mit | Python | |
119aabe89912c324d1588601c9cbc4b4a48e16ae | Add restarting_flup.py | SimonSapin/snippets,SimonSapin/snippets | restarting_flup.py | restarting_flup.py | #!/usr/bin/env python
"""
This is the same as the usual .fcgi file[1] for using FastCGI with flup,
except that this one terminates itself when the .fcgi file’s modification
date changes. Assuming you have something[2] that restarts FastCGI processes
as needed (which you should anyway), this effectively allows you to r... | bsd-3-clause | Python | |
7496159322a173bb6265aed2dac4e50ad64de858 | Add base fullfill service | Ellyuca/BlockChainAnalysis | service.py | service.py | from flask import Flask
from flask import jsonify
from flask import request
app = Flask(__name__)
@app.route("/chainBot", methods=['POST'])
def chainBot():
print(request.data)
return jsonify({
"speech": "My Test Speech",
"displayText": "My Test Text",
"data": {},
"contextOut": ... | mit | Python | |
5b01f26d92a32964bcc97cbf9429177bce7c89be | add tests for progress indicator | amirkdv/biseqt,amirkdv/biseqt,amirkdv/biseqt | tests/test_util.py | tests/test_util.py | # -*- coding: utf-8 -*-
from StringIO import StringIO
from biseqt.util import ProgressIndicator
def test_progress_indicator():
logs = StringIO()
ProgressIndicator.write = lambda self, message: logs.write(message)
indic = ProgressIndicator(num_total=1)
indic.start()
indic.progress()
assert log... | bsd-3-clause | Python | |
de7aee058348c00d2cdf244df102010b422e941b | Add a place holder for the PSNR metric | qobilidop/srcnn,qobilidop/srcnn | toolbox/metrics.py | toolbox/metrics.py | def psnr(y_true, y_pred):
raise NotImplementedError
| mit | Python | |
0da51215709f338e77acfa6e7933595d0c1df95d | Create SIP OPTIONS sender/receiver. | delimitry/networks | networks/sip.py | networks/sip.py | # -*- coding: utf-8 -*-
import argparse
import socket
CRLF = '\r\n'
def send_sip_options(server_host, server_port, client_host, client_port, verbose=True):
"""Sends SIP OPTIONS.
:param str server_host: SIP server host (IP address).
:param int server_port: SIP server port.
:param str client_host: Lo... | mit | Python | |
3b9a0c0b83dda484586ea9c19091b7da1cae55d1 | prepare a test file for python | larroy/riak_python3,larroy/riak_python3,larroy/riak_python3 | test_riak3k.py | test_riak3k.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import nose
from nose.tools import *
import riak3k
| apache-2.0 | Python | |
17c9e1a16c5c16c1b49836cc376ddd6408b73de0 | make the dispatcher a global variable and the deprecation warning more developer friendly | ismaelgaudioso/Coherence,sreichholf/python-coherence,unintended/Cohen,ismaelgaudioso/Coherence,unintended/Cohen,sreichholf/python-coherence,coherence-project/Coherence,furbrain/Coherence,coherence-project/Coherence,opendreambox/python-coherence,furbrain/Coherence,opendreambox/python-coherence | coherence/extern/louie.py | coherence/extern/louie.py | """
Wrapper module for the louie implementation
"""
import warnings
from coherence.dispatcher import Dispatcher
class Any(object): pass
class All(object): pass
class Anonymous(object): pass
# fake the API
class Dummy(object): pass
signal = Dummy()
sender = Dummy()
#senders
sender.Anonymous = Anonymous
sender.A... | """
Wrapper module for the louie implementation
"""
import warnings
from coherence.dispatcher import Dispatcher
class Any(object): pass
class All(object): pass
class Anonymous(object): pass
# fake the API
class Dummy(object): pass
signal = Dummy()
sender = Dummy()
#senders
sender.Anonymous = Anonymous
sender.A... | mit | Python |
0475e35bb6e0bab1d61c038ddd902e32478211d7 | Create whois.py | wannaphongcom/code-python3-blog | whois.py | whois.py | # อ่านบทความได้ที่ https://python3.wannaphong.com/2016/12/ดึงข้อมูล-whois-โดเมนด้วย-python.html
# เขียนโดย วรรณพงษ์ ภัททิยไพบูลย์
import whois
w = whois.whois('abc.xyz') # กรอกโดเมนที่ต้องการข้อมูล Whois
print(w.expiration_date) # วั้นหมดอายุ
print(w.text) # รายละเอียดโดเมน
| mit | Python | |
416872a1e7191f62dd2353f3e221a9e9c93c161f | Add tests for utils. | Axelrod-Python/tournament | test_utils.py | test_utils.py | """
Tests for the utils.py file
"""
import axelrod as axl
import unittest
import utils
import tempfile
import csv
class TestUtils(unittest.TestCase):
"""
Simple tests for the utils
"""
axl.seed(0)
players = [s() for s in axl.demo_strategies]
tournament = axl.Tournament(players)
results = t... | mit | Python | |
b28ace414c7087936ec14665026b78413b1f3791 | Create __init__.py | ruansteve/neutron-dynamic-routing | neutron_dynamic_routing/neutron/cmd/eventlet/agents/__init__.py | neutron_dynamic_routing/neutron/cmd/eventlet/agents/__init__.py | apache-2.0 | Python | ||
bf7ad11cc32af83aab6496ac7d7b911bea3d7876 | Use new API. | abstract-open-solutions/l10n-italy,linkitspa/l10n-italy,alessandrocamilli/l10n-italy,yvaucher/l10n-italy,andrea4ever/l10n-italy,ApuliaSoftware/l10n-italy,OpenCode/l10n-italy,maxhome1/l10n-italy,hurrinico/l10n-italy,linkitspa/l10n-italy,odoo-isa/l10n-italy,scigghia/l10n-italy,linkitspa/l10n-italy,luca-vercelli/l10n-ital... | l10n_it_pec/model/partner.py | l10n_it_pec/model/partner.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Associazione Odoo Italia
# (<http://www.openerp-italia.org>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General ... | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Associazione Odoo Italia
# (<http://www.openerp-italia.org>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General ... | agpl-3.0 | Python |
2c590b82b716ecfca9b683afa1181a8368b6cb41 | Add some helper methods to deal with sqlite migrations | stackforge/gertty,aspiers/gertty,openstack/gertty | gertty/dbsupport.py | gertty/dbsupport.py | # Copyright 2014 Mirantis Inc.
# Copyright 2014 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | apache-2.0 | Python | |
489d883af246e7de727ea14e01ae4a0cd17f88eb | fix emoji on python3.4 | TetraEtc/limbo,TetraEtc/limbo,serverdensity/sdbot,llimllib/limbo,palachu/sdbot,llimllib/limbo | limbo/plugins/emoji.py | limbo/plugins/emoji.py | """!emoji <n> will return n random emoji"""
import re
import random
from emojicodedict import emojiCodeDict
def randomelt(dic):
keys = list(dic.keys())
i = random.randint(0, len(keys) - 1)
return dic[keys[i]]
def emoji(n=1):
emoji = []
for i in range(n):
emoji.append(randomelt(emojiCodeDic... | """!emoji <n> will return n random emoji"""
import re
import random
from emojicodedict import emojiCodeDict
def randomelt(dic):
keys = dic.keys()
i = random.randint(0, len(keys) - 1)
return dic[keys[i]]
def emoji(n=1):
emoji = []
for i in range(n):
emoji.append(randomelt(emojiCodeDict))
... | mit | Python |
b35908d8ed8257bfde75953c360112f87c0eccd3 | add api/urls.py | danirus/django-comments-xtd,danirus/django-comments-xtd,danirus/django-comments-xtd,danirus/django-comments-xtd | django_comments_xtd/api/urls.py | django_comments_xtd/api/urls.py | from django.urls import path, re_path
from .views import (
CommentCount, CommentCreate, CommentList,
CreateReportFlag, ToggleFeedbackFlag,
preview_user_avatar,
)
urlpatterns = [
path('comment/', CommentCreate.as_view(),
name='comments-xtd-api-create'),
path('preview/', preview_user_avatar... | bsd-2-clause | Python | |
8e422c867f25424fbc2d95e4a11cb76ea4de66ac | Create land.py | apottr/wopr | objects/land.py | objects/land.py | {"rows":[
{"C": [
{"tile_start": "6C","tile_end": "21C", "side": NULL},
{"tile_start": "26C","tile_end": "57C", "side": NULL},
]},
{"D": [
{"tile_start": "20D","tile_end": "20D", "side": "USA"},
{"tile_start": "38D","tile_end": "42D", "side": "USA"},
{"tile_start": "44D","tile_end": "56D", "side": "USA"}
... | mit | Python | |
4a9a844353a565a596148e31c17dad6b57cda081 | Add text encoding functionality. | tilusnet/thqpylib | txtencoding.py | txtencoding.py | #!/usr/bin/env python3
from chardet.universaldetector import UniversalDetector
class TxtEncoding:
def __init__(self):
# inspired by https://chardet.readthedocs.org/en/latest/usage.html#example-detecting-encodings-of-multiple-files
self.detector = UniversalDetector()
def detectEncoding(self, ... | mit | Python | |
ff7d96204d528e65faec8312e98fd727bd163d08 | Save and load files. | arkharin/OpenCool | scr/model/model.py | scr/model/model.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/.
"""
Model implementation
"""
import json
from pathlib import Path
_EXTENSION = '.json'
def save(data, file_name, fol... | mpl-2.0 | Python | |
24210f31a5b54adf1b3b038fdad73b679656217c | fix mr_unit.py so that it records test failures properly | mathemage/h2o-3,jangorecki/h2o-3,h2oai/h2o-dev,jangorecki/h2o-3,h2oai/h2o-3,michalkurka/h2o-3,jangorecki/h2o-3,h2oai/h2o-3,YzPaul3/h2o-3,YzPaul3/h2o-3,jangorecki/h2o-3,spennihana/h2o-3,mathemage/h2o-3,h2oai/h2o-dev,spennihana/h2o-3,YzPaul3/h2o-3,mathemage/h2o-3,h2oai/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,h2oai/h2o-... | scripts/mr_unit.py | scripts/mr_unit.py | import sys, os
import csv
import MySQLdb
import traceback
def add_perf_results_to_mr_unit(args):
mr_unit = MySQLdb.connect(host='mr-0x8', user='root', passwd=args[1], db='mr_unit')
mr_unit.autocommit(False)
cursor = mr_unit.cursor()
try:
for row in csv.reader(file(os.path.join(args[2], "perf.cs... | import sys, os
import csv
import MySQLdb
import traceback
def add_perf_results_to_mr_unit(args):
mr_unit = MySQLdb.connect(host='mr-0x8', user='root', passwd=args[1], db='mr_unit')
mr_unit.autocommit(False)
cursor = mr_unit.cursor()
try:
for row in csv.reader(file(os.path.join(args[2], "perf.cs... | apache-2.0 | Python |
f424001f409fd35b0e62be9a82d62b21b438e082 | Add missing comma | ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,fajran/django-loginurl,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,vanschelven/cmsplugin-journal,uploadcare/django-loginurl,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-web... | onetime/urls.py | onetime/urls.py | from django.conf.urls.defaults import *
from django.views.generic.simple import redirect_to
from onetime.views import cleanup, login
urlpatterns = patterns('',
(r'^cleanup/$', cleanup),
(r'^(?P<key>[a-z0-9+])$', login),
(r'^$', redirect_to, {'url': None}),
)
| from django.conf.urls.defaults import *
from django.views.generic.simple import redirect_to
from onetime.views import cleanup, login
urlpatterns = patterns(''
(r'^cleanup/$', cleanup),
(r'^(?P<key>[a-z0-9+])$', login),
(r'^$', redirect_to, {'url': None}),
)
| agpl-3.0 | Python |
6d9bf98b5c077421b2cdaca7ae9adf39f4ed475c | Add a migration to rename "type" field to "status" | zellyn/django-kanboard,zellyn/django-kanboard | src/kanboard/migrations/0002_type_to_status.py | src/kanboard/migrations/0002_type_to_status.py | from south.db import db
from django.db import models
from kanboard.models import *
class Migration:
def forwards(self, orm):
db.rename_column('kanboard_phase', 'type', 'status')
def backwards(self, orm):
db.rename_column('kanboard_phase', 'status', 'type')
models = {
'kan... | bsd-3-clause | Python | |
8d88bf0808c5249d2c1feace5b8a1db1679e44b6 | Create tests_unit.py | mattjhayes/nmeta2 | tests_unit.py | tests_unit.py | """
Nmeta2 Unit Tests
Uses pytest, install with:
sudo apt-get install python-pytest
To run test, type in:
py.test tests_unit.py
"""
#*** Testing imports:
import mock
import unittest
#*** Ryu imports:
from ryu.base import app_manager # To suppress cyclic import
from ryu.controller import controller
from ry... | apache-2.0 | Python | |
cba429780061bcdafde6f2bc799e74106e2cc336 | Create textevolve.py | nsaquib/slc-mathcsworkshop | textevolve.py | textevolve.py | '''
Evolve a piece of text with a simple evolutionary algorithm
Author: Saquib
7/27/13
'''
import random
def fitness(source, target):
fitval = 0
for i in range(0, len(source)):
fitval += (ord(target[i]) - ord(source[i])) ** 2
return(fitval)
def mutate(source):
charpos = random.randint(0, len(source)... | mit | Python | |
ff98bdf9ce263648de784183ad5984864f9d387a | Add ref create api test | virtool/virtool,igboyes/virtool,virtool/virtool,igboyes/virtool | tests/api/test_refs.py | tests/api/test_refs.py | async def test_create(spawn_client, test_random_alphanumeric, static_time):
client = await spawn_client(authorize=True, permissions=["create_ref"])
data = {
"name": "Test Viruses",
"description": "A bunch of viruses used for testing",
"data_type": "genome",
"organism": "virus",
... | mit | Python | |
7d21b55f2de7cd2c34cd3cd985824178d382398d | add 'stages' code | olebole/astrometry.net,olebole/astrometry.net,olebole/astrometry.net,olebole/astrometry.net,olebole/astrometry.net,olebole/astrometry.net,olebole/astrometry.net,olebole/astrometry.net | util/stages.py | util/stages.py | from astrometry.util.file import *
class CallGlobal(object):
def __init__(self, pattern, *args, **kwargs):
self.pat = pattern
self.args = args
self.kwargs = kwargs
def __call__(self, stage, kwargs):
func = self.pat % stage
kwa = self.kwargs.copy()
kwa.update(kwargs)
return func(*self.args, **kwa)
def ... | bsd-3-clause | Python | |
6a9447b6fb92369496178b1a379c724dfa9eb7aa | add management command to bootstrap Twilio gateway fees for incoming messages | puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq | corehq/apps/smsbillables/management/commands/bootstrap_twilio_gateway_incoming.py | corehq/apps/smsbillables/management/commands/bootstrap_twilio_gateway_incoming.py | import logging
from django.core.management.base import LabelCommand
from corehq.apps.accounting.models import Currency
from corehq.apps.twilio.models import TwilioBackend
from corehq.apps.sms.models import INCOMING
from corehq.apps.smsbillables.models import SmsGatewayFee, SmsGatewayFeeCriteria
logger = logging.getL... | bsd-3-clause | Python | |
adee3f0763a1119cfac212ce0eca88a08f7c65fa | Create masterStock.py | supthunder/premeStock | masterStock.py | masterStock.py | import requests
from bs4 import BeautifulSoup
import json
def loadMasterStock():
url = "http://www.supremenewyork.com/mobile_stock.json"
user = {"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_2_1 like Mac OS X) AppleWebKit/602.4.6 (KHTML, like Gecko) Version/10.0 Mobile/14D27 Safari/602.1"}
# user = {"User-Ag... | mit | Python | |
8397cd87fc05949f2f1b8d24505ae2b817f5dda1 | Add unittest for classification_summary | okuta/chainer,jnishi/chainer,keisuke-umezawa/chainer,niboshi/chainer,okuta/chainer,wkentaro/chainer,hvy/chainer,pfnet/chainer,chainer/chainer,ktnyt/chainer,ktnyt/chainer,hvy/chainer,okuta/chainer,keisuke-umezawa/chainer,jnishi/chainer,niboshi/chainer,tkerola/chainer,wkentaro/chainer,cupy/cupy,ysekky/chainer,chainer/cha... | tests/chainer_tests/functions_tests/evaluation_tests/test_classification_summary.py | tests/chainer_tests/functions_tests/evaluation_tests/test_classification_summary.py | import unittest
import numpy
import six
import chainer
from chainer import cuda
from chainer import functions as F
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
from chainer.utils import type_check
def recall(preds, ts, dtype, l... | mit | Python | |
570fdc71697fba6180787b9309d3a2d49f512ed2 | Add queueing python script | barbarahui/harvester,mredar/harvester,barbarahui/harvester,ucldc/harvester,mredar/harvester,ucldc/harvester | scripts/queue_sync_to_solr.py | scripts/queue_sync_to_solr.py | #! /bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import logbook
from harvester.config import config as config_harvest
from redis import Redis
from rq import Queue
EMAIL_RETURN_ADDRESS = os.environ.get('EMAIL_RETURN_ADDRESS',
'example@example.com')
# csv delim email ... | bsd-3-clause | Python | |
d06b3b41f786fc7cd2c05a6215fed026eef1cb8f | Add misc plugin. | SunDwarf/curiosity | curiosity/plugins/misc.py | curiosity/plugins/misc.py | import curio
import sys
import curious
from curious.commands import command
from curious.commands.context import Context
from curious.commands.plugin import Plugin
from curious.dataclasses.embed import Embed
class Misc(Plugin):
"""
Miscellaneous commands.
"""
@command()
async def info(self, ctx: ... | mit | Python | |
3d7a1ad963a11c8fc425c7d82f5e0f8f877dc861 | Add Python benchmark | stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib | lib/node_modules/@stdlib/math/base/special/atan2/benchmark/python/benchmark.py | lib/node_modules/@stdlib/math/base/special/atan2/benchmark/python/benchmark.py | #!/usr/bin/env python
"""Benchmark atan2."""
import timeit
name = "atan2"
repeats = 3
iterations = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
* `total`: total number of test... | apache-2.0 | Python | |
14160c8ee729a094b6a980ed7c94b37d11f6dfba | Create xor_recursive.py | rdustinb/GAPy | tests/xor_recursive.py | tests/xor_recursive.py | import sys
def xor(*store):
print("---------------recursive call----------------")
print(len(store))
if(len(store) == 2):
print("lowest level")
b = store[0]
a = store[1]
print(b)
print(a)
return bool((a or b) and not(a and b))
else:
print("middle level")
b = store[0]
remaini... | mit | Python | |
d003babe55d8b7a202a50bc6eeb2e1113ef8247f | Add oeis plugin | thomasleese/smartbot-old,tomleese/smartbot,Cyanogenoid/smartbot,Muzer/smartbot | plugins/oeis.py | plugins/oeis.py | import requests
import re
class Plugin:
limit = 5
def on_command(self, bot, msg, stdin, stdout, reply):
session = smartbot.utils.web.requests_session()
url = "http://oeis.org/search"
payload = {
"fmt": "text",
"q": " ".join(msg["args"][1:]),
}
... | mit | Python | |
c122db5ceda59d786bd550f586ea87d808595ab6 | Add a script to reimport the LGA boundaries from the GADM.org data | mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola,mysociety/pombola | pombola/nigeria/management/commands/nigeria_update_lga_boundaries_from_gadm.py | pombola/nigeria/management/commands/nigeria_update_lga_boundaries_from_gadm.py | from django.contrib.gis.gdal import DataSource
from django.core.management import BaseCommand
from django.db import transaction
from mapit.management.command_utils import save_polygons, fix_invalid_geos_geometry
from mapit.models import Area, Type
class Command(BaseCommand):
help = "Update the Nigeria boundaries ... | agpl-3.0 | Python | |
8c176349d064db3dbc4db505cdc8a2d6a162dd56 | Create a consolidated broker initialization script | chambers-brian/SIG_Digital-Strategy_SI_ODP_Backend,chambers-brian/SIG_Digital-Strategy_SI_ODP_Backend,fedspendingtransparency/data-act-broker-backend,fedspendingtransparency/data-act-broker-backend | dataactcore/scripts/initialize.py | dataactcore/scripts/initialize.py | import argparse
import logging
import os
from flask_bcrypt import Bcrypt
from dataactvalidator.app import createApp
from dataactbroker.scripts.setupEmails import setupEmails
from dataactcore.models.userModel import User
from dataactcore.interfaces.function_bag import createUserWithPassword
from dataactcore.scripts.se... | cc0-1.0 | Python | |
e60f13ab304c04e17af91bc87edc1891948a6f7a | Add validation function for python schema events | Parsely/parsely_raw_data,Parsely/parsely_raw_data | parsely_raw_data/validate.py | parsely_raw_data/validate.py | from __future__ import print_function
import logging
import pprint
from collections import defaultdict
from six import string_types
from .schema import SCHEMA
"""
Data Pipeline validation functions
"""
SCHEMA_DICT = None
REQ_FIELDS = None
CHECKS = {'req': 'Fields "{}" are required. ({} are present)',
'si... | apache-2.0 | Python | |
271be0bf16692aae2736d40e96447262e75c4a0f | add missing web.py | Mustard-Systems-Ltd/pyzmq,dash-dash/pyzmq,swn1/pyzmq,yyt030/pyzmq,caidongyun/pyzmq,caidongyun/pyzmq,Mustard-Systems-Ltd/pyzmq,ArvinPan/pyzmq,caidongyun/pyzmq,swn1/pyzmq,ArvinPan/pyzmq,yyt030/pyzmq,yyt030/pyzmq,dash-dash/pyzmq,swn1/pyzmq,ArvinPan/pyzmq,Mustard-Systems-Ltd/pyzmq,dash-dash/pyzmq | zmq/web.py | zmq/web.py | #-----------------------------------------------------------------------------
# Copyright (C) 2013 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distributed as part of this software.
#----------... | bsd-3-clause | Python | |
0a7f1695f9155bbe10b933e47637e4df0e2e31d4 | Create HttpAndWeb.py | jimkiiru/james-kiiru-bc17-week1,jimkiiru/james-kiiru-bc17-week1 | day3/HttpAndWeb.py | day3/HttpAndWeb.py | import requests
def Get(url, PostId):
try:
isinstance(int(PostId), int)
if int(PostId) <= 100 and int(PostId) > 0:
r = requests.get(url + PostId)
return r
else:
print("Number must be between 1 and 100")
except ValueError as err:
raise(err)
return "No Results"
def Post(PostUrl,title, body, userId=... | mit | Python | |
9fa6ec498d70afdb4f28410d4ac7c29780c60861 | Add first stab at origen submodule | ergs/transmutagen,ergs/transmutagen | transmutagen/origen.py | transmutagen/origen.py | from subprocess import run
from pyne.origen22 import (nlibs, write_tape5_irradiation, write_tape4,
parse_tape9, merge_tape9, write_tape9)
from pyne.material import from_atom_frac
if __name__ == '__main__':
ORIGEN = '/home/origen22/code/o2_therm_linux.exe'
xs_TAPE9 = "/Users/aaronmeurer/Documents/origen/C... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.