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 |
|---|---|---|---|---|---|---|---|---|
15d0effad882e52cb70870fc63bc1e5c9ad2de47 | Add missing WSGI wrapper | hep-gc/cloud-monitoring,hep-gc/cloud-monitoring,hep-gc/cloud-monitoring | cloud_monitor.wsgi | cloud_monitor.wsgi | from cloud_monitor import app as application
| mit | Python | |
8ea86ae68c35faf8712428dab7c64d60281ec131 | add utils.py which contains convenient methods | taspinar/sidl | utils.py | utils.py | import numpy as np
import pickle
import json
import os
#from collections import defaultdict
#from scipy import ndimage
def flatten_tf_array(array):
shape = array.get_shape().as_list()
return tf.reshape(array, [shape[0], shape[1] * shape[2] * shape[3]])
def accuracy(predictions, labels):
return (100.0 * n... | mit | Python | |
4f5b495a0051b39e1e6fdd54f13bad0bd2b1bd29 | Test getting the logs (broken) | uwescience/myria-python,uwescience/myria-python | myria/test/test_logs.py | myria/test/test_logs.py | from httmock import urlmatch, HTTMock
import unittest
from myria import MyriaConnection
@urlmatch(netloc=r'localhost:8753')
def local_mock(url, request):
print url
if url.path == '/logs/sent':
body = 'foo,bar\nbaz,ban'
return {'status_code': 200, 'content': body}
return None
class TestQ... | bsd-3-clause | Python | |
0ed425d70fc07284deb5c5d019bbb3aef65fb43b | Add adt_run.py file to project as entrance file | mizhon/tools | autodbperftool/adt_run.py | autodbperftool/adt_run.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
'''
Created on 2015-07-02
@author: mizhon
'''
import sys
from ADT.adt import main
sys.exit(main()) | apache-2.0 | Python | |
673b321c6caa30827d53669eec4f3ca475fd9a2c | develop spec_validator tools. | ashleygould/aws-orgs | awsorgs/spec_validator.py | awsorgs/spec_validator.py | #!/usr/bin/python
import yaml
import re
delegation_format = """
delegation:
RoleName:
atype: str
required: True
Ensure:
atype: str
required: False
values:
- present
- absent
Description:
atype: str
required: False
#TrustingAccount:
# - atype: str
# required: Fal... | mit | Python | |
111b296112cf3b21f9abc1da37b047c1d0bc0ab8 | Add test for about view | pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine | tests/scoring_engine/web/test_about.py | tests/scoring_engine/web/test_about.py | from tests.scoring_engine.web.web_test import WebTest
from scoring_engine.version import version
from scoring_engine.engine.config import config
class TestAbout(WebTest):
# def setup(self):
# super(TestWelcome, self).setup()
# self.expected_sponsorship_images = OrderedDict()
# self.expec... | mit | Python | |
3a6bb4b7c282ee6c3ede1f3b662a70c9dc3ca638 | Add a Numba n-body benchmark | numba/numba-benchmark,gmarkall/numba-benchmark | benchmarks/bench_nbody.py | benchmarks/bench_nbody.py | """
Benchmark an implementation of the N-body simulation.
As in the CUDA version, we only compute accelerations and don't care to
update speeds and positions.
"""
from __future__ import division
import math
import sys
import numpy as np
from numba import jit, float32, float64
eps_2 = np.float32(1e-6)
zero = np.f... | bsd-2-clause | Python | |
8b53ded646b732044255af15c97bf5ab81a1540b | Split DB commands to xcdbm.py | jsxc/xmpp-cloud-auth,jsxc/xmpp-cloud-auth,jsxc/xmpp-cloud-auth,jsxc/xmpp-cloud-auth | xcdbm.py | xcdbm.py | #!/usr/bin/env python
import configargparse
import sys
import anydbm
VERSION = '0.2.2+'
def get_args():
# build command line argument parser
desc = '''XMPP server authentication against JSXC>=3.2.0 on Nextcloud: Database manipulation.
See https://jsxc.org or https://github.com/jsxc/xmpp-cloud-auth.''... | mit | Python | |
35d1c1187af29ab178b41937fd3ccc5314b237d8 | add simple test | hideaki-t/sqlite-fts-python | src/tests/test_base.py | src/tests/test_base.py | # coding: utf-8
from __future__ import print_function, unicode_literals
import sys
import os
import sqlite3
import ctypes
import struct
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import sqlitefts.sqlite_tokenizer as fts
class SimpleTokenizer(fts.Tokenizer):
def tokenize(self, text):
... | mit | Python | |
c75fec9298be07a9162db3b9218013661af7c5b5 | Add test that SendRefundTransfer contains a balance proof | hackaugusto/raiden,hackaugusto/raiden | raiden/tests/unit/transfer/mediated_transfer/test_events.py | raiden/tests/unit/transfer/mediated_transfer/test_events.py | from raiden.tests.utils.factories import make_address, make_channel_identifier, make_transfer
from raiden.transfer.mediated_transfer.events import SendRefundTransfer
def test_send_refund_transfer_contains_balance_proof():
recipient = make_address()
transfer = make_transfer()
message_identifier = 1
cha... | mit | Python | |
76ecc27faf52859a49c80a7a7d2b65bce6016ec2 | Create process_availability.py | site24x7/plugins,site24x7/plugins,site24x7/plugins | process_availability/process_availability.py | process_availability/process_availability.py | #!/usr/bin/python
import json
import subprocess
def get_process_details(process_name):
process_cmd = "ps -eo ruser,pid,args | grep -wiE '"+process_name+"' | grep -v grep"
p = subprocess.Popen(process_cmd, stdout=subprocess.PIPE, shell=True)
(output, err) = p.communicate()
p_status = p.wait()
ou... | bsd-2-clause | Python | |
97c3c0f9c7f76207251068b7ea50848ff1c976fd | Create ll1_recursive_descent.py. Does not yet handle nested expressions. | py-in-the-sky/challenges,py-in-the-sky/challenges,py-in-the-sky/challenges | arithmetic_eval/ll1_recursive_descent.py | arithmetic_eval/ll1_recursive_descent.py | # from __future__ import division
import re
import operator as op
### Top-level
def evaluate_arithmetic(arithmetic_expression):
return evaluate(parse(rewrite(tokenize(arithmetic_expression)))[1])
### Ancillary
integer_pattern = r'-?\d+'
arithmetic_tokens = r'[()*/+-]'
token_re = re.compile(r'(^{integer_patter... | mit | Python | |
0bfeae7e0dd8a2f9cdf70c2cdd4fc7f59052b345 | Add inital asyncio inotify support | arkaitzj/python-butter | butter/asyncio/inotify.py | butter/asyncio/inotify.py | #!/usr/bih/env python
from butter.inotify import inotify_init, inotify_add_watch, inotify_rm_watch, str_to_events, IN_ALL_EVENTS
from collections import deque
from os import O_RDONLY
import asyncio
class Inotify:
def __init__(self, flags=0, *, loop=None, maxsize=0):
self._loop = loop or asyncio.get_event_... | bsd-3-clause | Python | |
2f09614193d90565ee18ddc207f9c6df1d6d699e | call up manualimport.py with a budget name and an OFX, and your transactions should be imported, trying to avoid duplicates. Might not work with an OFX from your institution | rienafairefr/pynYNAB,rienafairefr/pynYNAB,rienafairefr/nYNABapi,rienafairefr/pynYNAB,rienafairefr/pynYNAB,rienafairefr/nYNABapi,rienafairefr/nYNABapi | manualimport.py | manualimport.py | import argparse
import re
from ofxtools import OFXTree
from NYnabConnection import nYnabConnection
from budget import Transaction, Payee
from config import email, password
from nYNAB import nYnab, BudgetNotFound
parser = argparse.ArgumentParser(description='Manually import an OFX into a nYNAB budget')
parser.add_arg... | mit | Python | |
5628fc9eeb778311e34481ebd954c42fd0341d7f | add TestOdataFeed | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/api/odata/tests/test_feed.py | corehq/apps/api/odata/tests/test_feed.py | from __future__ import absolute_import
from __future__ import unicode_literals
from django.test import TestCase
from django.urls import reverse
from elasticsearch.exceptions import ConnectionError
from corehq.apps.accounting.models import (
BillingAccount,
DefaultProductPlan,
SoftwarePlanEdition,
Sub... | bsd-3-clause | Python | |
cb2b98a12faed6b40101dcb95d0279059bac4833 | Create syno_web_cmd.py | davecoutts/syno_web_cmd,davecoutts/syno_web_cmd | syno_web_cmd.py | syno_web_cmd.py | from bottle import route, run
from sh import syno_poweroff_feasible_check
@route('/')
def home():
return "syno_web_cmd is running\n\nPower off the Synology with 'wget http://SYNOLOGY_IP_ADDRESS:8080/poweroff'"
@route('/poweroff')
def _poweroff():
try:
syno_poweroff_feasible_check()
except:
... | mit | Python | |
eb943ee5b064cc024473b0c2c033f081bca21518 | Add sfp_slideshare module | smicallef/spiderfoot,smicallef/spiderfoot,smicallef/spiderfoot | modules/sfp_slideshare.py | modules/sfp_slideshare.py | #-------------------------------------------------------------------------------
# Name: sfp_slideshare
# Purpose: Query SlideShare for name and location information.
#
# Author: Brendan Coles <bcoles@gmail.com>
#
# Created: 2018-10-15
# Copyright: (c) Brendan Coles 2018
# Licence: GPL
#----... | mit | Python | |
55b2b14339e29e43c51c35138b76a8a54af2735b | add hard trig test cases | fredrik-johansson/mpmath,klkuhlm/mpmath,JensGrabner/mpmath,bjodah/mpmath,bjodah/mpmath,klkuhlm/mpmath,JensGrabner/mpmath | mpmath/tests/test_trig.py | mpmath/tests/test_trig.py | from mpmath import *
def test_trig_near_zero():
mp.dps = 15
mp.rounding = 'nearest'; assert sin(0) == 0 and cos(0) == 1
mp.rounding = 'down'; assert sin(0) == 0 and cos(0) == 1
mp.rounding = 'floor'; assert sin(0) == 0 and cos(0) == 1
mp.rounding = 'up'; assert sin(0) == 0 and co... | bsd-3-clause | Python | |
c78347f7ef5c8203b60561d0b59fe3fc45c09773 | add leetcode LRU Cache | Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code | leetcode/LRUCache/solution.py | leetcode/LRUCache/solution.py | # -*- codingLutf-8 -*-
class LRUCache:
# @param capacity, an integer
def __init__(self, capacity):
self.stack = []
self.map = {}
self.capacity = capacity
self.size = 0
# @return an integer
def get(self, key):
if key in self.map:
self.stack.remove(key... | mit | Python | |
4900a32670763b95b1ca4ed396b469cf3e3c6e05 | Create docstring for Keystore | kivy/plyer,kivy/plyer,kivy/plyer | keystore.py | keystore.py | '''
Keystore
=======
The :class:`Keystore` provides a mechanism for securing/storing cryptographic keys (such as user credentials) in a container. typically needed to support authentication APIs such as OAuth2
.. note::
Typically needed to support authentication APIs such as OAuth2
Supported Pl... | mit | Python | |
4ea2b528600247f07ecda754492b8cf3e6d1a39b | add is_private field | ambitioninc/django-restraint | restraint/migrations/0002_permset_is_private.py | restraint/migrations/0002_permset_is_private.py | # Generated by Django 3.2.12 on 2022-02-20 21:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('restraint', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='permset',
name='is_private',
... | mit | Python | |
d21004d238c106c926a67f875a523ace597442f4 | Add an enum to represent databases | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline | rnacentral_pipeline/databases/data/databases.py | rnacentral_pipeline/databases/data/databases.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2018] EMBL-European Bioinformatics Institute
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 | |
159215ca3db431e29688cd85961df5125ce3eb53 | Use the DejaVu fonts as default. | akretion/openerp-server,akretion/openerp-server,akretion/openerp-server | bin/report/render/rml2pdf/customfonts.py | bin/report/render/rml2pdf/customfonts.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 P. Christeas, Tiny SPRL (<http://tiny.be>).
# All Rights Reserved
#
# This program is free software: you can redistribute it and/or... | agpl-3.0 | Python | |
9e7108728281d1e19688d26ff1247c86f2a4e395 | Create cnc-sim.py | futoke/cnc-simulator | cnc-sim.py | cnc-sim.py | import sys
import time
import math
import threading
import pylab as plt
import numpy as np
from tkinter import *
WIDTH, HEIGHT = 800, 600
class App(object):
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.canvas = Canvas(frame, width=WIDTH, height=HEIGHT, bg="#ffffff")
self.canvas... | bsd-3-clause | Python | |
d52146b2c3b6f23ac4631073bbdd0f070fdf0f7b | Include the example script. | borg-project/utcondor,borg-project/utcondor | example.py | example.py | import condor
def f(x):
return x**2
def main():
calls = [(f, [x]) for x in range(16)]
for (call, result) in condor.do(calls, 4):
print call.args, result
if __name__ == "__main__":
main()
| mit | Python | |
fa8569950021ab627ba79f03b395650e4a3ac4a8 | ADD example file | psarka/uplift | example.py | example.py | from uplift.ensemble import RandomForestClassifier
from uplift.datasets import make_radcliffe_surry
from uplift.metrics import qini_q
X_train, y_train, group_train = make_radcliffe_surry()
X_test, y_test, group_test = make_radcliffe_surry()
rfc = RandomForestClassifier(n_estimators=50, min_samples_leaf=200, criterion... | bsd-3-clause | Python | |
a64695e0e101263a647aaf0bc61a5380487059df | set up testing and test writing and reading journal entries. | cewing/learning_journal | test_journal.py | test_journal.py | # -*- coding: utf-8 -*-
from contextlib import closing
import pytest
from journal import app
from journal import connect_db
from journal import get_database_connection
from journal import init_db
TEST_DSN = 'dbname=test_learning_journal user=cewing'
def clear_db():
with closing(connect_db()) as db:
db.... | mit | Python | |
ad815a8e3a3c25ba3683fe5dad155f2db0249c40 | Move the body-part of the script into a function main(). | naparuba/shinken,lets-software/shinken,staute/shinken_package,savoirfairelinux/shinken,ddurieux/alignak,claneys/shinken,rledisez/shinken,kaji-project/shinken,dfranco/shinken,lets-software/shinken,mohierf/shinken,titilambert/alignak,kaji-project/shinken,xorpaul/shinken,ddurieux/alignak,xorpaul/shinken,h4wkmoon/shinken,k... | libexec/check_shinken_load.py | libexec/check_shinken_load.py | #!/usr/bin/env python
# Autor: David Hannequin <david.hannequin@gmail.com>
# Date: 29 Nov 2011
#
# Script init
#
import os
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-w', '--warning', default='3,2,1')
parser.add_argument('-c', '--critical', default='4,3,2')
... | #!/usr/bin/env python
# Autor: David Hannequin <david.hannequin@gmail.com>
# Date: 29 Nov 2011
#
# Script init
#
import os
import argparse
def main(): pass
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('-w', '--warning', default='3,2,1')
parser.add_argument('-c', ... | agpl-3.0 | Python |
12dfe8d01cf9b3ab293e9283714532fd64a7f22a | add qutebrowser | icot/dotfiles,icot/dotfiles,icot/dotfiles | qutebrowser/dot-config/qutebrowser/config.py | qutebrowser/dot-config/qutebrowser/config.py | c.qt.args = ["auth-server-whitelist=*cern.ch"]
| mit | Python | |
59c20c07d01ae1ebde8a6a8bb3d6fd4652507929 | Add optional start of ongoing and with a deadline activities | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/time_based/migrations/0007_auto_20201023_1433.py | bluebottle/time_based/migrations/0007_auto_20201023_1433.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2020-10-23 12:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('time_based', '0006_auto_20201021_1315'),
]
operations = [
migrations.AddFi... | bsd-3-clause | Python | |
5b6033bc1bdfd3910a0375437e8ed4e0ee6a40ea | Add an exception for a SuspicousOperation | dstufft/storages | storages/exceptions.py | storages/exceptions.py | class SuspiciousOperation(Exception):
"""
The user did something suspicious
"""
| bsd-2-clause | Python | |
c264a4b68f743067feb58c3e44d6e5a2ea6e273f | add make_server, make_client utils | dan-blanchard/thriftpy,itnihao/thriftpy,duydb2/thriftpy,duydb2/thriftpy,adsharma/flattools,adsharma/flattools,maralla/thriftpy,halfcrazy/thriftpy,importcjj/thriftpy,mariusvniekerk/thriftpy,eleme/thriftpy,spladug/thriftpy,dan-blanchard/thriftpy,halfcrazy/thriftpy,keitheis/thriftpy,importcjj/thriftpy,OctavianLee/thriftpy... | thriftpy/rpc.py | thriftpy/rpc.py | from thriftpy.protocol import TBinaryProtocol
from thriftpy.thrift import TProcessor, TClient
from thriftpy.transport import TSocket, TBufferedTransport, TServerSocket
from thriftpy.server import TThreadedServer
def make_client(service, host, port):
transport = TBufferedTransport(TSocket(host, port))
protocol... | mit | Python | |
cd4d480d6707344eca1961a9323e526a6c37788f | Add 23 | alexprengere/euler | 023/main.py | 023/main.py | def proper_divisors(n):
for i in range(1, n):
if n % i == 0:
yield i
def is_perfect(n):
return n == sum(proper_divisors(n))
def is_deficient(n):
return n > sum(proper_divisors(n))
def is_abundant(n):
return n < sum(proper_divisors(n))
abundants = set()
for n in range(1, 28123... | apache-2.0 | Python | |
0435128cc097726bf54db2b34bdda61b546ecbe2 | Add geometric_mean.py (#4244) | TheAlgorithms/Python | maths/series/geometric_mean.py | maths/series/geometric_mean.py | """
GEOMETRIC MEAN : https://en.wikipedia.org/wiki/Geometric_mean
"""
def is_geometric_series(series: list) -> bool:
"""
checking whether the input series is geometric series or not
>>> is_geometric_series([2, 4, 8])
True
>>> is_geometric_series([3, 6, 12, 24])
True
>>> is_geometric_seri... | mit | Python | |
727143357853591862335eb9e556855e6056a6a8 | Fix uiautomator test runner after r206096 | mogoweb/chromium-crosswalk,jaruba/chromium.src,Pluto-tv/chromium-crosswalk,patrickm/chromium.src,Jonekee/chromium.src,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk,Fireblend/chromium-crosswalk,axinging/chromium-crosswalk,fujunwei/chromium-crosswalk,patrickm/chromium.src,krieger-od/nwjs_chromium.src,ondr... | build/android/pylib/uiautomator/test_runner.py | build/android/pylib/uiautomator/test_runner.py | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Class for running uiautomator tests on a single device."""
from pylib.instrumentation import test_runner as instr_test_runner
class TestRunner(inst... | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Class for running uiautomator tests on a single device."""
from pylib.instrumentation import test_runner as instr_test_runner
class TestRunner(inst... | bsd-3-clause | Python |
df75a4d88f5fa114a10e958876ffa33b289abf48 | add compare test rig | mikkeloscar/pkgbuild-introspection,falconindy/pkgbuild-introspection,nandub/pkgbuild-introspection,falconindy/pkgbuild-introspection,mikkeloscar/pkgbuild-introspection,nandub/pkgbuild-introspection | compare.py | compare.py | #!/usr/bin/env python
import string
import subprocess
import sys
import parse_aurinfo
TEST_KEYS = {
'Name': (False, 'pkgname'),
'Description': (False, 'pkgdesc'),
'URL': (False, 'url'),
'Licenses': (True, 'license'),
'Groups': (True, 'groups'),
'Provides': (True, 'provides'),
'Depends On'... | mit | Python | |
6e36075e6947ba91e905880371d27a9cda3b7871 | Add welcome cog | Thessia/Liara | cogs/pandentia/welcome.py | cogs/pandentia/welcome.py | from discord.ext import commands
from cogs.utils import checks
from cogs.utils.dataIO import dataIO
import asyncio
import discord
class Welcome:
def __init__(self, liara):
self.liara = liara
self.welcome = dataIO.load_json('pandentia.welcome')
self.disabled = False
def __unload(self):... | mit | Python | |
a718355a16c1e2439ceb8f7582cb2b900b5beef2 | Add back missing file. | ResidentMario/watsongraph,ResidentMario/watson-graph | concept.py | concept.py | # noinspection PyUnresolvedReferences
from mwviews.api import PageviewsClient
import event_insight_lib
# noinspection PyUnresolvedReferences
import networkx as nx
class Concept:
"""
The Concept class is an abstraction for IBM Watson Concept Insights API graph endpoints, plus additional
Wikipedia-derived s... | mit | Python | |
b8ea96b6a39b53f2debbd6a892af3485b8921fc8 | bump to 0.17.1 | jamesblunt/gunicorn,malept/gunicorn,gtrdotmcs/gunicorn,1stvamp/gunicorn,mvaled/gunicorn,jamesblunt/gunicorn,malept/gunicorn,ammaraskar/gunicorn,prezi/gunicorn,urbaniak/gunicorn,wong2/gunicorn,GitHublong/gunicorn,urbaniak/gunicorn,wong2/gunicorn,1stvamp/gunicorn,keakon/gunicorn,alex/gunicorn,elelianghh/gunicorn,alex/gun... | gunicorn/__init__.py | gunicorn/__init__.py | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
version_info = (0, 17, 1)
__version__ = ".".join([str(v) for v in version_info])
SERVER_SOFTWARE = "gunicorn/%s" % __version__
| # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
version_info = (0, 17, 0)
__version__ = ".".join([str(v) for v in version_info])
SERVER_SOFTWARE = "gunicorn/%s" % __version__
| mit | Python |
756547296eb85b63be7ec8cccfcd5513410935f4 | Create string_bits.py | dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey,dvt32/cpp-journey | Python/CodingBat/string_bits.py | Python/CodingBat/string_bits.py | # http://codingbat.com/prob/p113152
def string_bits(str):
result = ""
for i in range( len(str) ):
if i % 2 == 0:
result += str[i]
return result
| mit | Python | |
87e4d3bc9d3efd9f84025b25a8bd975ab73626f9 | Add a new test case, extracted from a cython paper. | serge-sans-paille/pythran,pbrunet/pythran,serge-sans-paille/pythran,pombredanne/pythran,pombredanne/pythran,artas360/pythran,artas360/pythran,pombredanne/pythran,pbrunet/pythran,hainm/pythran,pbrunet/pythran,hainm/pythran,hainm/pythran,artas360/pythran | pythran/tests/cases/calculate_u.py | pythran/tests/cases/calculate_u.py | # from the paper `using cython to speedup numerical python programs'
#pythran export timeloop(float, float, float, float, float, float list list, float list list, float list list)
#runas A=[range(2000) for i in xrange(100)] ; B=[range(2000) for i in xrange(100)] ; C=[range(2000) for i in xrange(100)] ; timeloop(1,2,.01... | bsd-3-clause | Python | |
f34be69ca4cd5e3280b55c5a7558337099d5fb2d | Add missing migration | GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin | geotrek/signage/migrations/0007_auto_20190625_1848.py | geotrek/signage/migrations/0007_auto_20190625_1848.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2019-06-25 16:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('signage', '0006_auto_20190306_1555'),
]
operations = [
migrations.AlterFie... | bsd-2-clause | Python | |
f11be1003bed2b2b6e24bebe51885488994cd1fd | Add basic display class | SageBerg/St.GeorgeGame,SageBerg/St.GeorgeGame,SageBerg/St.GeorgeGame,SageBerg/St.GeorgeGame | display.py | display.py | class Display(object):
"""
The display class is responsible for putting text on the screen. It can
also be disabled to prevent messages being displayed after an event has
occured that should not be followed by another message. The enabled
attribute is shared across all instance of the display.
"... | apache-2.0 | Python | |
5e14a02a9f670f3558a07e6c3ef592753bda3f50 | Use as main with FormatConverter; walks directory | wingsit/KF,wingsit/KF | getFile.py | getFile.py | import os.path
from FormatConverter import *
import timeSeriesFrame
extmap = {'.csv':1, '.txt':2, '.xls':3, '.sql':4}
dir = "C:\Documents and Settings\MARY\My Documents\Test\Data"
#Conversion function
def doConv(file, id):
f = FormatConverter(file) #creates a FormatConverter object for the file
#reads ... | bsd-3-clause | Python | |
2350ba706d2c73f562b5e88da976b444af6d86ad | add help shortcut for IPython | kevlar1818/dotfiles,kevlar1818/dotfiles | ipython/.ipython/profile_default/startup/20_magics.py | ipython/.ipython/profile_default/startup/20_magics.py | import re
from IPython.core.magic import register_line_magic
__OBJECT_REGEX = re.compile(r'[\w\.]+')
@register_line_magic
def h(line):
'''Line magic shortcut for viewing the documentation for an object'''
# Help harden against code injection attacks by only "eval"-ing a string
# that looks like a non-exe... | mit | Python | |
a7e4b2326a74067404339b1147c1ff40568ee4c0 | Add prefix conversions for strings (#5453) | TheAlgorithms/Python | conversions/prefix_conversions_string.py | conversions/prefix_conversions_string.py | """
* Author: Manuel Di Lullo (https://github.com/manueldilullo)
* Description: Convert a number to use the correct SI or Binary unit prefix.
Inspired by prefix_conversion.py file in this repository by lance-pyles
URL: https://en.wikipedia.org/wiki/Metric_prefix#List_of_SI_prefixes
URL: https://en.wikipedia.org/wiki/... | mit | Python | |
8fbb9e1967f0a24ea8bf4dd96d67050384f52948 | Add ds_trie.py | bowen0701/algorithms_data_structures | ds_trie.py | ds_trie.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
class Node(object):
pass
class Trie(object):
pass
def main():
pass
if __name__ == '__main__':
main()
| bsd-2-clause | Python | |
4643cd46217089b3fb6585fb73324039e5f77b8a | Create 6kyu_remember.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/6kyu/6kyu_remember.py | Solutions/6kyu/6kyu_remember.py | def remember(str_):
seen = set(); res = []
for i in str_:
if i in seen and i not in res: res.append(i)
seen.add(i)
return res
| mit | Python | |
5e947b08515abc4d9102d235802b7569d1983237 | Create equsant.py | shivaay1/Equsant-Self-Balancing-Robot-Python | equsant.py | equsant.py | '''HARIOMHARIBOLJAIMATAJIPITAJIKIJAIJAI'''
#a python script to be used with Balancing robots
# Importing all necessary librarys and classes
from mpu6050 import mpu6050
from time import sleep
import math
from pidcontroller import PIDController
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM) #Setting the Mode to use... | mit | Python | |
521926ca0e61f946e39f34b41bafca7bcde03ea4 | add check for mtime header propagation | cernbox/smashbox,cernbox/smashbox,cernbox/smashbox,cernbox/smashbox | protocol/test_protocol_upload_mtime.py | protocol/test_protocol_upload_mtime.py | from smashbox.utilities import *
from smashbox.utilities.hash_files import *
from smashbox.protocol import chunk_file_upload, file_upload, ls_prop_desktop20, ls_prop_desktop17, all_prop_android
import time
import dateutil.parser
def check_propfind_response(URL,filename,mtime,total_size):
filename = os.path.basen... | agpl-3.0 | Python | |
b27eb7b8907967216d2a7243c01386c6ab9c4759 | Create get_Anim_AllPoints.py | zeemzoet/nuke,zeemzoet/nuke | s_PointsToCornerPin/dev/get_Anim_AllPoints.py | s_PointsToCornerPin/dev/get_Anim_AllPoints.py | import nukescripts
nuke.thisNode()['code'].execute()
_input = checkInput()
if _input['cam'] and _input['geo']:
### checks how many vertices are selected
i = 0
for vertex in nukescripts.snap3d.selectedPoints():
i += 1
if i:
first = int(nuke.thisNode()['firstFrame'].getValue())
last = int(nuke.thisNode(... | apache-2.0 | Python | |
b6f7fa6eb5aca9dcc2e6acc337182df20574cc4d | add new package (#25525) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-nbmake/package.py | var/spack/repos/builtin/packages/py-nbmake/package.py | # Copyright 2013-2021 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 PyNbmake(PythonPackage):
"""Pytest plugin for testing notebooks."""
homepage = "https... | lgpl-2.1 | Python | |
bacf2d7d8c1dc8b97365ceca5b4c0a61bd55201b | add runner script | andreas-h/mss-chem | msschem/runner.py | msschem/runner.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import datetime
import os.path
import msschem_settings
# from https://stackoverflow.com/a/1160227
def touch(fname, times=None):
with open(fname, 'a'):
os.utime(fname, times)
if __name__ == '__main__':
today = datetime.date.today()
... | mit | Python | |
41668adff733903936d2ab6d11d1172a4aa8dbd2 | Remove function - not working | heneryville/furry-octo-bear | treelist2.py | treelist2.py | class treeList:
rootNode=None
def add(self, data):
if self.rootNode==None:
self.rootNode=treeListNode(data, None, None)
else:
def addHelper(data, cursor):
if data<cursor.data:
if cursor.leftChild==None:
cursor.leftChild=treeListNode(data, None, None)
else:
addHelper(data, cursor.le... | mit | Python | |
5d12703a706498f24da09c368f626a78e0269afd | Add initial version of event parser | leaffan/pynhldb | parsers/event_parser.py | parsers/event_parser.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from collections import defaultdict
logger = logging.getLogger(__name__)
class EventParser():
def __init__(self, raw_data):
self.raw_data = raw_data
self.score = defaultdict(int)
# self.score['road'] = 0
# self.score['... | mit | Python | |
878415f9235433b832f6b97be08d0b3068a930ae | Create Buka.py | SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming,SurgicalSteel/Competitive-Programming | Kattis-Solutions/Buka.py | Kattis-Solutions/Buka.py | if __name__ == '__main__':
a = int(input())
op = input()
b = int(input())
if op=="*":
print(a*b)
else:
print(a+b)
| mit | Python | |
1e59a8a708e3af610daca0b733fa620f67d48863 | Add transfer control. | andela-sjames/paystack-python | paystackapi/tcontrol.py | paystackapi/tcontrol.py | """Script used to define the paystack Transaction class."""
from paystackapi.base import PayStackBase
class TransferControl(PayStackBase):
"""docstring for Transaction."""
@classmethod
def check_balance(cls, **kwargs):
"""
Check Balance.
Args:
No argument required.
... | mit | Python | |
ee3a8f02253f1f652785c07ea0be6464ab4bcc11 | Add regression test for bug #1908075 | mahak/nova,openstack/nova,mahak/nova,mahak/nova,openstack/nova,openstack/nova | nova/tests/functional/regressions/test_bug_1908075.py | nova/tests/functional/regressions/test_bug_1908075.py | # Copyright 2020, Red Hat, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | apache-2.0 | Python | |
0641a4ae394d6a258e4df5ee5388a6be84dca204 | Add utils.py for writing scrapers in python | egonw/citeulike,egonw/citeulike,egonw/citeulike,egonw/citeulike,egonw/citeulike | plugins/python/utils.py | plugins/python/utils.py | """General utilities for writing scrapers for CiteULike in Python"""
import re
from htmlentitydefs import name2codepoint
def decode_entities(html):
html = re.sub('&#(\d+);', lambda m: unichr(int(m.group(1))), html)
html = re.sub('&(%s);' % '|'.join(name2codepoint), lambda m: name2codepoint[m.group(1)], html)
retu... | bsd-3-clause | Python | |
ea803dfa7aef22d8c981fd693d8dc3b86e80c462 | add local settings | wanghaven/readthedocs.org,wanghaven/readthedocs.org,wanghaven/readthedocs.org,wanghaven/readthedocs.org | readthedocs/settings/local_settings.py | readthedocs/settings/local_settings.py | import os
ALLOW_PRIVATE_REPOS = True
| mit | Python | |
8074f0ab835696754c3f1c5fd12789a09456d313 | Add unit test for server_groups_client | vedujoshi/tempest,xbezdick/tempest,bigswitch/tempest,Tesora/tesora-tempest,cisco-openstack/tempest,Juniper/tempest,rakeshmi/tempest,izadorozhna/tempest,LIS/lis-tempest,sebrandon1/tempest,izadorozhna/tempest,vedujoshi/tempest,xbezdick/tempest,masayukig/tempest,bigswitch/tempest,openstack/tempest,Juniper/tempest,rakeshmi... | tempest/tests/services/compute/test_server_groups_client.py | tempest/tests/services/compute/test_server_groups_client.py | # Copyright 2015 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | apache-2.0 | Python | |
8be7bffc88e0cd336554e6f1ae5f0c3b9024aacb | add simple example | xibowang/google-crawler | example.py | example.py | #!/usr/bin/env python3
import urllib.request
import urllib.parse
import zlib
import datetime
REQUEST_URL = "https://{}/{}"
BASE_URL = "www.google.co.uk"
GOOGLE_NEWS_QUERY = "search?hl=en&q={}&tbm=nws"
GOOGLE_NEWS_URL_CUSTIME_DATE_QUERY = "search?hl=en&q={}&tbm=nws&tbs=cdr:1,cd_min:{},cd_max:{}"
CHARSET = "ISO-8859-... | mit | Python | |
734ac15553f9d3574be29cbdec024252140e8a6c | Improve root user creation | morninj/django-docker,morninj/django-docker,morninj/django-docker | fabfile.py | fabfile.py | from fabric.api import *
from fabric.contrib.files import *
import os
from ConfigParser import SafeConfigParser
parser = SafeConfigParser()
parser.read(os.path.join(os.path.dirname(__file__), 'config.ini'))
import time
SECRET_KEY = parser.get('general', 'SECRET_KEY')
# Configure server admin login credentials
if pars... | mit | Python | |
b47fb38e8bd84d63398aa77d18bec75ba38036a1 | Add fabfile. | jkawamoto/docker-google-fluentd | fabfile.py | fabfile.py | from fabric.api import *
from fabric.contrib import files
env.use_ssh_config = True
PACKAGE = "google-fluentd"
@task
def deploy():
""" Upload contents. """
if not files.exists(PACKAGE):
run("mkdir " + PACKAGE)
with cd(PACKAGE):
put("Dockerfile", ".")
put("conf", ".", mirror_local_m... | mit | Python | |
fbdf53727aba94c3bdce5856d6a99b8acb7059ce | Create fabfile.py for deployment purposes. | giovannicode/giovanniblog,giovannicode/giovanniblog | fabfile.py | fabfile.py | from fabric.api import local, env, cd, run
from fabric.context_managers import lcd
env.hosts =['giovannicode.com']
env.user = "root"
def provision_server():
local("ansible-playbook -u root provisioning/production.yml")
def push_code():
local("git push production master")
def restart_gunicorn():
local("... | bsd-3-clause | Python | |
16feaf4806ceb84e74fc0c8705f5647335903773 | add test cases for AgedDict | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | test/cachetest.py | test/cachetest.py | #!/usr/bin/python2.4
#
# Copyright (c) 2005 rPath, Inc.
#
# All Rights Reserved
#
import testsuite
testsuite.setup()
import unittest
from mint.web.cache import AgedDict
class CacheTest(unittest.TestCase):
def testAgedDict(self):
ad = AgedDict()
ad['testkey'] = 'testval'
assert(ad['testk... | apache-2.0 | Python | |
00612d6e2fbde1443219c2215202615161ce0df5 | add a google calculator plugin | mmisiewicz/slask,serverdensity/sdbot,UnILabKAIST/slask,kylemsguy/limbo,michaelMinar/limbo,ruhee/limbo,signalnine/alanabot,llimllib/limbo,uilab-github/slask,Marclass/limbo,wmv/slackbot-python,NUKnightLab/slask,shawnsi/limbo,joshshadowfax/slask,sentinelleader/limbo,cmyr/debt-bot,uilab-github/slask,Whirlscape/debt-bot,lli... | plugins/calc.py | plugins/calc.py | """!calc <equation> will return the google calculator result for <equation>"""
from bs4 import BeautifulSoup
import re
from urllib import quote
import requests
def calc(eq):
query = quote(eq)
url = "https://encrypted.google.com/search?hl=en&q={}".format(query)
soup = BeautifulSoup(requests.get(url).text)
... | mit | Python | |
d4d75df2a6e4990be743da1b416a8bd63887b0bd | Add a separate test of the runtest.py --qmtest option. | timj/scons,andrewyoung1991/scons,timj/scons,andrewyoung1991/scons,timj/scons,timj/scons,andrewyoung1991/scons,andrewyoung1991/scons,timj/scons,andrewyoung1991/scons,andrewyoung1991/scons,andrewyoung1991/scons,andrewyoung1991/scons,timj/scons,timj/scons,andrewyoung1991/scons,timj/scons,timj/scons | test/runtest/qmtest.py | test/runtest/qmtest.py | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | mit | Python | |
789e1493e98ecae9df4a5ae0baf8885b77c3cc50 | use pickle protocol 2 | ramiro/scrapy,amboxer21/scrapy,arush0311/scrapy,dangra/scrapy,KublaikhanGeek/scrapy,w495/scrapy,huoxudong125/scrapy,cursesun/scrapy,z-fork/scrapy,csalazar/scrapy,ssteo/scrapy,codebhendi/scrapy,ENjOyAbLE1991/scrapy,fontenele/scrapy,wzyuliyang/scrapy,Bourneer/scrapy,zhangtao11/scrapy,agreen/scrapy,mouadino/scrapy,curita/... | scrapy/squeue.py | scrapy/squeue.py | """
Scheduler disk-based queues
"""
import marshal, cPickle as pickle
from scrapy.utils.queue import DiskQueue
class PickleDiskQueue(DiskQueue):
def push(self, obj):
s = pickle.dumps(obj, protocol=2)
super(PickleDiskQueue, self).push(s)
def pop(self):
s = super(PickleDiskQueue, sel... | """
Scheduler disk-based queues
"""
import marshal, cPickle as pickle
from scrapy.utils.queue import DiskQueue
class PickleDiskQueue(DiskQueue):
def push(self, obj):
super(PickleDiskQueue, self).push(pickle.dumps(obj))
def pop(self):
s = super(PickleDiskQueue, self).pop()
if s:
... | bsd-3-clause | Python |
fcb7d5714c60cc9bb982e4e5143da67317a9ca8c | test for incorrect-wrapping case | mammadori/pyglet,mammadori/pyglet,oktayacikalin/pyglet,theblacklion/pyglet,oktayacikalin/pyglet,theblacklion/pyglet,mammadori/pyglet,theblacklion/pyglet,mammadori/pyglet,oktayacikalin/pyglet,oktayacikalin/pyglet,theblacklion/pyglet,theblacklion/pyglet,oktayacikalin/pyglet | tests/font/NOWRAPPING.py | tests/font/NOWRAPPING.py | #!/usr/bin/env python
'''Test that text will not wrap when its width is set to its calculated
width.
You should be able to clearly see "TEST TEST" on a single line.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
import base_text
class TEST_WRAPPING(base_text.TextTestBase):
font_n... | bsd-3-clause | Python | |
996c9428ce3f56a5f3914d2b02d670c88a198230 | Test code for 'grouping' module | rzzzwilson/morse,rzzzwilson/morse | morse_trainer/test_grouping.py | morse_trainer/test_grouping.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Test code for 'grouping' widget used by Morse Trainer.
"""
import sys
from grouping import Grouping
from PyQt5.QtWidgets import (QApplication, QWidget, QHBoxLayout,
QVBoxLayout, QPushButton)
class TestGrouping(QWidget):
"""Application t... | mit | Python | |
6c5f515812c7a69788d5ce10ce0e14ae885bc662 | Test util uri_parse function | feltnerm/docfu | test/util.py | test/util.py | import unittest
from docfu import util
class UtilTest(unittest.TestCase):
def test_uri_parse(self):
u = 'feltnerm/foo'
self.assertEqual(util.uri_parse(u), 'http://github.com/%s' % u)
u = 'http://github.com/feltnerm/foo.git'
self.assertEqual(util.uri_parse(u), u)
u = '/User... | mit | Python | |
712aef300f8c95770bfea8d777b2c15650fd47fa | Add test_mmap.py script | maxmind/geoip-api-python,carlosefr/geoip-api-python,simudream/geoip-api-python,simudream/geoip-api-python,carlosefr/geoip-api-python,maxmind/geoip-api-python | test_mmap.py | test_mmap.py | #!/usr/bin/python
import GeoIP
gi = GeoIP.new(GeoIP.GEOIP_MMAP_CACHE)
print gi.country_code_by_name("yahoo.com")
print gi.last_netmask()
print gi.country_name_by_name("www.bundestag.de")
print gi.country_code_by_addr("24.24.24.24")
print gi.country_name_by_addr("24.24.24.24")
print gi.range_by_ip("68.180.206.184")
| lgpl-2.1 | Python | |
72f66b1a2992a15df8772d94244b113e7a03d5ac | Integrate pep8 code style checker with e-cidadania. | cidadania/e-cidadania,cidadania/e-cidadania | tests/pep.py | tests/pep.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2010-2012 Cidadania S. Coop. Galega
#
# This file is part of e-cidadania.
#
# e-cidadania is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | apache-2.0 | Python | |
3201c972a5ea5f44730fc8ba26b942fe3a577ec9 | Create tictactoe.py | nik-hil/scripts | tictactoe.py | tictactoe.py | '''Simple command line based tic tac toe for two human player
'''
def pprint(arr):
print ""
for r in range(row):
print arr[r]
def validateinput(arr, row,col, pin, char):
try:
pin = pin.split(",")
input = (int(pin[0]),int(pin[1]))
if input[0] <3 and input[0] > -1 and\
input[1] < 3 and input[1] > -1:
... | mit | Python | |
daeb6cbcea4d5b5e7ca24b5e5e1f5d63a64a0a3a | Add unit_circles.py. | lidalei/DataMining | unit_circles.py | unit_circles.py | import numpy as np
import matplotlib.pylab as plt
fig = plt.figure(figsize=(8, 8))
ax = fig.add_subplot(111)
M = 1000
x = np.zeros(M + 1, dtype = np.float64)
y_up = np.zeros(M + 1, dtype = np.float64)
y_down = np.zeros(M + 1, dtype = np.float64)
## l1 norm
for i in range(len(x)):
x[i] = -1 + 2.0 * i / M
y_up[... | mit | Python | |
dc943c9af81ff6098cf267c54d12eadcfb577713 | put back __init__.py inside tests | soar-telescope/goodman,soar-telescope/goodman,simontorres/goodman,simontorres/goodman,soar-telescope/goodman,simontorres/goodman | tests/__init__.py | tests/__init__.py | from __future__ import absolute_import | bsd-3-clause | Python | |
02ee1c01486e2131c2e3b944bdcc3669e0223588 | Fix error in test_handlers following merge of self-registering handlers | dongguangming/jsonpickle,dongguangming/jsonpickle,mandx/jsonpickle,mandx/jsonpickle,dongguangming/jsonpickle,mandx/jsonpickle,mandx/jsonpickle,dongguangming/jsonpickle | tests/test_handlers.py | tests/test_handlers.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Jason R. Coombs <jaraco@jaraco.com>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import unittest
import jsonpickle
class CustomObject(object):
"A class to be se... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Jason R. Coombs <jaraco@jaraco.com>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import unittest
import jsonpickle
class CustomObject(object):
"A class to be se... | bsd-3-clause | Python |
2259770eec4f4451fa8e04c5205c718773ccb5d2 | Use os.path.join for platform in tester | zhaochunqi/simiki,tankywoo/simiki,9p0le/simiki,9p0le/simiki,tankywoo/simiki,tankywoo/simiki,zhaochunqi/simiki,zhaochunqi/simiki,9p0le/simiki | tests/test_initsite.py | tests/test_initsite.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import os.path
import unittest
import shutil
from simiki.initsite import InitSite
class TestInitSite(unittest.TestCase):
def setUp(self):
BASE_DIR = os.path.join(os.path.dirname(__file__), '..')
self.config_file = os.path.join(BASE_DIR, "s... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import os.path
import unittest
import shutil
from simiki.initsite import InitSite
class TestInitSite(unittest.TestCase):
def setUp(self):
BASE_DIR = os.path.join(os.path.dirname(__file__), '..')
self.config_file = os.path.join(BASE_DIR, "s... | mit | Python |
ecce482fd99263c6b2f9aa8eddc668954ab41cc6 | Add unit tests for Strategy and Selector classes | fghaas/django-oscar-vat_moss,arbrandes/django-oscar-vat_moss,fghaas/django-oscar-vat_moss,hastexo/django-oscar-vat_moss,hastexo/django-oscar-vat_moss,arbrandes/django-oscar-vat_moss | tests/test_strategy.py | tests/test_strategy.py | import unittest
from decimal import Decimal as D
from oscar_vat_moss.partner.strategy import * # noqa
from mock import Mock
class DeferredVATSelectorTest(unittest.TestCase):
def test_selector(self):
selector = DeferredVATSelector()
strategy = selector.strategy()
self.assertEqual(strateg... | bsd-3-clause | Python | |
c749615ad6184976e2bbdf537209a446e01c7eab | Add a `C++11` rule | thinkerchan/thefuck,ostree/thefuck,MJerty/thefuck,roth1002/thefuck,subajat1/thefuck,gogobebe2/thefuck,princeofdarkness76/thefuck,PLNech/thefuck,AntonChankin/thefuck,barneyElDinosaurio/thefuck,Clpsplug/thefuck,ytjiang/thefuck,suxinde2009/thefuck,zhangzhishan/thefuck,Aeron/thefuck,beni55/thefuck,ostree/thefuck,qrqiuren/t... | thefuck/rules/c++11.py | thefuck/rules/c++11.py | def match(command, settings):
return (('g++' in command.script or 'clang++' in command.script) and
('This file requires compiler and library support for the '
'ISO C++ 2011 standard.' in command.stderr or
'-Wc++11-extensions' in command.stderr
)
)
def g... | mit | Python | |
364eed683f3ded2bdaf9304ea3a3016894987a94 | add TODO_4 - simplePlayground to Lesson 4 | bschmoker/paxmidwest,codingvirtual/fullstack-p4-conference,eldonuts/Udacity-FSND-P4-Conferences,davcs86/fullstack-nanodegree-conference-cloud-app,scottharman/Conference-Central,swesterveld/udacity-nd004-p4-conference-organization-app,kirklink/udacity-fullstack-p4,kerrmarin/fwd-conference,arizonatribe/app-engine-demo,co... | Lesson_4/Additions/TODO_4_conference.py | Lesson_4/Additions/TODO_4_conference.py | @endpoints.method(message_types.VoidMessage, ConferenceForms,
path='filterPlayground',
http_method='GET', name='filterPlayground')
def filterPlayground(self, request):
q = Conference.query()
# simple filter usage:
# q = q.filter(Conference.city == "Paris")
# advanced filter building and... | apache-2.0 | Python | |
889e6d72fed0b51fbca9ca717279ec31aa3f12b0 | Add management command to check for empty database | kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi | kpi/management/commands/is_database_empty.py | kpi/management/commands/is_database_empty.py | # coding: utf-8
from django.core.management.base import BaseCommand, CommandError
from django.db import connections
from django.db.utils import ConnectionDoesNotExist, OperationalError
class Command(BaseCommand):
help = (
'Determine if one or more databases are empty, returning a '
'tab-separated ... | agpl-3.0 | Python | |
121eefa0dd37b2dac75c56a33f1f96258b206c4c | Add stats on which fields had cubes produced or had spectra used. Tidy up console output Add zoomed in l-v plot | jd-au/magmo-HI,jd-au/magmo-HI | record_cubes.py | record_cubes.py |
from __future__ import print_function
import os
import sys
# Hack to get parent folder in path
sys.path.insert(1, os.path.join(sys.path[0], '..'))
import magmo
def main():
#for day in range(11, 30+1):
for day in range(21, 21+1):
sources = magmo.get_day_obs_data(day)
print (sources)
... | apache-2.0 | Python | |
afe5c4aa116f7bf1b9a536d03a7c9b0872e9cbc7 | Add example | ppinard/matplotlib-scalebar | doc/example3.py | doc/example3.py | import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
from matplotlib_scalebar.scalebar import ScaleBar, IMPERIAL_LENGTH
plt.figure()
image = plt.imread(cbook.get_sample_data('grace_hopper.png'))
plt.imshow(image)
scalebar = ScaleBar(0.02, 'ft', IMPERIAL_LENGTH,
fixed_value=48.0, fixed_un... | bsd-2-clause | Python | |
a8775da5f35af98e462247e0924d6b24c19be10b | Create stgallen.py | metaodi/openerz,metaodi/openerz,metaodi/openerz | csv/stgallen/stgallen.py | csv/stgallen/stgallen.py | mit | Python | ||
f5ab9c81a8b00ee1f96f85b0b22a549305cf10a2 | Add an update script | SymbiFlow/nixpkgs,NixOS/nixpkgs,SymbiFlow/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,NixOS/nixpkgs,NixOS/nixpkgs,SymbiFlow/nixpkgs,SymbiFlow/nixpkgs,NixOS/nixpkgs,SymbiFlow/nixpkgs,NixOS/nixpkgs,NixOS/nixp... | pkgs/applications/virtualization/virtualbox/update.py | pkgs/applications/virtualization/virtualbox/update.py | #!/usr/bin/env python3
import os
import re
import json
import urllib.request
from distutils.version import LooseVersion
UPSTREAM_INFO_FILE = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"upstream-info.json"
)
def fetch_latest_version():
url = "http://download.virtualbox.org/virtualbox/LATES... | mit | Python | |
7405c342522cf3686b5946fb30a59c74c410c655 | Add missing migration for tests.app.pages (fixes build) | LabD/wagtail-personalisation,LabD/wagtail-personalisation,LabD/wagtail-personalisation | tests/site/pages/migrations/0002_regularpage.py | tests/site/pages/migrations/0002_regularpage.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-02 04:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import wagtail.wagtailcore.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0033_remov... | mit | Python | |
a2fda83c011954e86ef90a9b4b7fddf9a18ce551 | add tests for job artifacts | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus | tests/zeus/web/hooks/test_job_artifacts_hook.py | tests/zeus/web/hooks/test_job_artifacts_hook.py | from io import BytesIO
from zeus import factories
from zeus.models import Artifact
def test_new_artifact(client, default_source, default_repo, default_hook, sample_xunit):
build = factories.BuildFactory(
source=default_source,
provider=default_hook.provider,
external_id='3',
)
jo... | apache-2.0 | Python | |
021de9963b66d51b81a709dda6e0f3ec40fac222 | add ReverseContourPen | googlefonts/fonttools,fonttools/fonttools | Lib/fontTools/pens/reverseContourPen.py | Lib/fontTools/pens/reverseContourPen.py | from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.misc.arrayTools import pairwise
from fontTools.pens.filterPen import ContourFilterPen
__all__ = ["reversedContour", "ReverseContourPen"]
class ReverseContourPen(ContourFilterPen):
"""Filter pen that... | mit | Python | |
254403f507ea8ae075a791f24a031eaa79fc2447 | Add a helper script, ported to Python. | jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion | tools/dev/wc-format.py | tools/dev/wc-format.py | #!/usr/bin/env python
import os
import sqlite3
import sys
# helper
def usage():
sys.stderr.write("USAGE: %s [PATH]\n" + \
"\n" + \
"Prints to stdout the format of the working copy at PATH.\n")
# parse argv
wc = (sys.argv[1:] + ['.'])[0]
# main()
entries = os.path.join(wc, '.s... | apache-2.0 | Python | |
ab5c5b5d7c214b17b48add9caeaa36a81e3886f5 | Change assertTrue(isinstance()) by optimal assert | klmitch/python-glanceclient,alexpilotti/python-glanceclient,JioCloud/python-glanceclient,mmasaki/python-glanceclient,mmasaki/python-glanceclient,openstack/python-glanceclient,JioCloud/python-glanceclient,varunarya10/python-glanceclient,varunarya10/python-glanceclient,klmitch/python-glanceclient,openstack/python-glancec... | tests/test_exc.py | tests/test_exc.py | # Copyright 2012 OpenStack Foundation
# 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 requ... | # Copyright 2012 OpenStack Foundation
# 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 requ... | apache-2.0 | Python |
e9526e8b14f4834daaa0d5cba2ebc7249ffad16b | Add render_table test | kn-bibs/pathways-analysis,sienkie/pathways-analysis,kn-bibs/pathways-analysis,sienkie/pathways-analysis | tests/test_run.py | tests/test_run.py | from patapy import render_text_table
from methods import Method, MethodResult
class MyMethod(Method):
name = 'my analysis method'
help = ''
def run(self, experiment):
pass
class MyResult(MethodResult):
columns = ['score', 'p_value']
class ResultRow:
def __init__(self, score, p_value... | mit | Python | |
576fa1969c09554d6d5b6ceaf4c9a2b33fbc2238 | Allow basic downloading of repos | abactel/git-get | git-get.py | git-get.py | #!/usr/bin/env python3
import logging
import os
import subprocess
def git(command):
"""Runs command"""
command = "git " + command
logger.debug("Running: " + command)
try:
subprocess.run(command.split(" "), stdout=subprocess.PIPE)
except Exception as error_message:
logger.error("Fa... | mit | Python | |
cfcac1d83e45dc87d032bfc08a85372d15587a25 | Fix migration scripts | OCA/reporting-engine,OCA/reporting-engine,OCA/reporting-engine,OCA/reporting-engine | base_comment_template/migrations/12.0.2.0.0/pre-migration.py | base_comment_template/migrations/12.0.2.0.0/pre-migration.py | # Copyright 2020 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(env, version):
cr = env.cr
table = 'res_partner'
old_column = 'comment_template_id'
new_column = 'property_comment_temp... | agpl-3.0 | Python | |
906a4da609ca61bb74c9db03a6ebec87247585ad | Add tests for nettokom | sputnick-dev/weboob,RouxRC/weboob,Konubinix/weboob,sputnick-dev/weboob,Konubinix/weboob,Konubinix/weboob,frankrousseau/weboob,RouxRC/weboob,frankrousseau/weboob,RouxRC/weboob,nojhan/weboob-devel,nojhan/weboob-devel,willprice/weboob,laurent-george/weboob,frankrousseau/weboob,willprice/weboob,willprice/weboob,laurent-geo... | modules/nettokom/test.py | modules/nettokom/test.py | # -*- coding: utf-8 -*-
# Copyright(C) 2013-2014 Florent Fourcot
#
# This file is part of weboob.
#
# weboob 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 License, or
# (at yo... | agpl-3.0 | Python | |
2cc44f5b97653d4b1b2070a90f079bab57116ebf | Add function to map OPF results to eDisGo network | openego/eDisGo,openego/eDisGo | edisgo/opf/results/opf_expand_network.py | edisgo/opf/results/opf_expand_network.py | import numpy as np
def expand_network(edisgo, tolerance=1e-6):
"""
Apply network expansion factors that were obtained by optimization
to eDisGo MVGrid
Parameters
----------
edisgo : :class:`~.edisgo.EDisGo`
tolerance : float
The acceptable margin with which an expansion factor can... | agpl-3.0 | Python | |
fbb42746821e38cc9bb2eb44272d836460b97ac6 | add case owner report filter | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/reports/v2/filters/case_report.py | corehq/apps/reports/v2/filters/case_report.py | from __future__ import absolute_import
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy
from corehq.apps.reports.standard.cases.utils import (
query_all_project_data,
query_deactivated_data,
get_case_owners,
)
from corehq.apps.reports.v2.endpoints.case_owner impor... | bsd-3-clause | Python | |
f85cb698aa99316560d24a12fe31de552a9f69ec | add migration to delete sofabed tables | qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/sofabed/migrations/0002_delete_sofabed_models.py | corehq/apps/sofabed/migrations/0002_delete_sofabed_models.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('sofabed', '0001_initial'),
]
operations = [
migrations.AlterUniqueTogether(
name='caseactiondata',
u... | bsd-3-clause | Python | |
689098f8029c03517e3832dd1384c7185bf56192 | Implement Binary Search | ueg1990/aids | sorting_and_searching/binary_search.py | sorting_and_searching/binary_search.py | '''
In this module, we implement binary search in Python both
recrusively and iteratively
Assumption: Array is sorted
Running Time complexity: O(log n)
'''
def binary_search_recursive(arr, left, right, value):
'''
Recursive implementation of binary search of a sorted array
Return index of the value foun... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.