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 |
|---|---|---|---|---|---|---|---|---|
b674ff31ab846bc4c11b615ad7f738ff176d5f96 | Add /team test | royragsdale/picoCTF,picoCTF/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,royragsdale/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF,picoCTF/picoCTF,picoCTF/picoCTF,royragsdale/picoCTF | picoCTF-web/tests/api/functional/v1/test_team.py | picoCTF-web/tests/api/functional/v1/test_team.py | """Tests for the /api/v1/team endpoints."""
from common import ( # noqa (fixture)
ADMIN_DEMOGRAPHICS,
clear_db,
client,
decode_response,
get_csrf_token,
register_test_accounts,
TEACHER_DEMOGRAPHICS,
USER_DEMOGRAPHICS,
get_conn
)
def test_get_my_team(client):
"""Tests the /team endpoint."""
... | mit | Python | |
d8c8287cce7ddc48f4ea271a54bd6efa8dcabe66 | Create OutputNeuronGroup_multiple_outputs_1.py | ricardodeazambuja/BrianConnectUDP | examples/OutputNeuronGroup_multiple_outputs_1.py | examples/OutputNeuronGroup_multiple_outputs_1.py | '''
Example of a spike receptor (only receives spikes)
In this example spikes are received and processed creating a raster plot at the end of the simulation.
'''
from brian import *
import numpy
from brian_multiprocess_udp import BrianConnectUDP
# The main function with the NeuronGroup(s) and Synapse(s) must be na... | cc0-1.0 | Python | |
c70a127e17286f18e8d2d46bdc2e5ec6b0c55d0d | Add script to output statistics on body part emotion pairs | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | generate_body_part_emotion_pairs.py | generate_body_part_emotion_pairs.py | """Find known body parts in sentences with predicted label 'Lichaamsdeel'.
Extended body parts are saved to new text files.
Usage: python classify_body_parts.py <json file with body part mapping> <dir
with input texts> <dir for output texts>
"""
import os
import codecs
import argparse
import json
import copy
from col... | apache-2.0 | Python | |
e94dcbe781666ba8f083efab3dd63818d805c6d8 | Add flac2mp3 script. | JosefR/audio-cd-tools | flac2mp3.py | flac2mp3.py | #!/usr/bin/env python
import argparse
import subprocess
import os
import glob
def gettag(tag, filename):
proc = subprocess.Popen(["metaflac", "--no-utf8-convert",
"--show-tag=" + tag, filename], stdout=subprocess.PIPE)
out = proc.communicate()[0].rstrip()
remove = len(out.split("=")[0]) + 1
re... | mit | Python | |
19ee2fbee238e94b7944154d692a9e488ee19a79 | Add basic opps database configuration | jeanmask/opps,jeanmask/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,opps/opps,williamroot/opps,opps/opps,opps/opps,opps/opps,YACOWS/opps,YACOWS/opps,williamroot/opps,williamroot/opps,jeanmask/opps,YACOWS/opps | opps/db/conf.py | opps/db/conf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf import settings
from appconf import AppConf
class OppsDataBaseConf(AppConf):
HOST = getattr(settings, 'OPPS_DB_HOSR', None)
USER = getattr(settings, 'OPPS_DB_USER', None)
PASSWORD = getattr(settings, 'OPPS_DB_PASSWORD', None)
PORT = geta... | mit | Python | |
d1c791ccf5b2873bbc248c9b079a5b68159ffb50 | Add ECM Keys script | smartchicago/chicago-early-learning,smartchicago/chicago-early-learning,smartchicago/chicago-early-learning,smartchicago/chicago-early-learning | python/ecep/portal/management/commands/update_ecm.py | python/ecep/portal/management/commands/update_ecm.py | import csv
import os
import re
from django.core.management.base import NoArgsCommand
from django.conf import settings
from portal.models import Location
class Command(NoArgsCommand):
"""
Import Cleaned Site Name, Address, and ECM Keys
"""
def handle(self, *args, **options):
with open('mast... | mit | Python | |
8ed1fccb2a1d72815bde93b19d45069e59db0900 | add force404 sample | thinkAmi-sandbox/Bottle-sample,thinkAmi-sandbox/Bottle-sample | force404.py | force404.py | # -*- coding:utf-8 -*-
from bottle import route, run, abort, error
@route("/")
def top():
abort(404, "go to 404")
return "Hello world!"
@error(404)
def error404(error):
return "Not Found!"
run(host="0.0.0.0", port=8080, debug=True, reloader=True) | unlicense | Python | |
5d58200622e05728acce8ffba1ddf7e5063f556c | Create formatIO.py | fpg2012/tuneTurner | formatIO.py | formatIO.py |
# 将输入输出格式化例如:(xxxx) -> (x)(x)(x)(x), ([x]) -> x, [xxxx] ->[x][x][x][x]
def formatting(old_tune):
'''
格式化
'''
new_tune = ''
sharped = False
low = high = 0
for i in old_tune:
if i == '(':
low = low + 1
elif i == '[':
high = high + 1
elif i == '... | apache-2.0 | Python | |
aff6ff82ec4fc0076f8356d782a2a103510ebbfd | use Queue for product and custom problem | MailG/code_py,MailG/code_py,MailG/code_py | product_custom/use_queue.py | product_custom/use_queue.py |
# http://blog.jobbole.com/52412/
from threading import Thread
import time
import random
from Queue import Queue
queue = Queue(10)
class ProducerThread(Thread):
def run(self):
nums = range(5)
while True:
num = random.choice(nums)
queue.put(num)
print "Produc... | mit | Python | |
b75a0293f214de4196d9df50ef5906885c2810fc | Create empClass.py | imughal/EmployeeScript | empClass.py | empClass.py | from rgfunc import *
class Employee(object):
year = 0
month = 0
day = 0
city = ""
country = ""
lastname = ""
def __init__(self,name):
self.name = name
def dateofbirth(self):
return str(self.day)+"/"+str(self.month)+"/"+str(self.year)
#fullname = name," ",lastname
def fullname(self):
return st... | mit | Python | |
d9be3f189fc34117bdec6e0c7856f7a7dc5f902a | Add tool for generating the JSONP required by the documentation versions. | chtyim/cdap,mpouttuclarke/cdap,anthcp/cdap,chtyim/cdap,hsaputra/cdap,chtyim/cdap,hsaputra/cdap,caskdata/cdap,chtyim/cdap,caskdata/cdap,mpouttuclarke/cdap,mpouttuclarke/cdap,hsaputra/cdap,caskdata/cdap,hsaputra/cdap,mpouttuclarke/cdap,caskdata/cdap,anthcp/cdap,anthcp/cdap,chtyim/cdap,caskdata/cdap,anthcp/cdap,caskdata/c... | cdap-docs/tools/versionscallback-gen.py | cdap-docs/tools/versionscallback-gen.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2014 Cask Data, Inc.
#
# Used to generate JSONP from a CDAP documentation directory on a webserver.
#
# sudo echo "versionscallback({\"development\": \"2.6.0-SNAPSHOT\", \"current\": \"2.5.2\", \"versions\": [\"2.5.1\", \"2.5.0\"]});" > json-versions.js; l... | apache-2.0 | Python | |
fe1d75065f7371502cf81ea57e2a1019c2db093c | add config.py | devjoe/gae-dev-helper | custom_config.py | custom_config.py | # ===== GAE dev_appserver.py settings =====
# [Required]
gae_sdk_path = ""
project_path = ""
# [Optional]
datastore_path = ""
port = ""
admin_port = ""
# ===== GAE Helper settings =====
# [Log]
log_path = ""
append_date_to_log = False
# [Request Filter]
file_type_filter = []
custom_regex_filter = []
use_time_delim... | mit | Python | |
90c36d54f8822ef28bef98be4ba735d15b405648 | add get_dump.py utility | contactless/mqtt-tools,contactless/mqtt-tools | get_dump.py | get_dump.py | #!/usr/bin/python
import argparse
import mosquitto
import time, random
import sys
def on_mqtt_message(arg0, arg1, arg2=None):
#
#~ print "on_mqtt_message", arg0, arg1, arg2
if arg2 is None:
mosq, obj, msg = None, arg0, arg1
else:
mosq, obj, msg = arg0, arg1, arg2
if msg.topic !... | mit | Python | |
e04d3bfd20879d0e8e404a3fff4ab37b914cd303 | Add ContactForm | Kromey/akwriters,Kromey/fbxnano,Kromey/fbxnano,Kromey/akwriters,Kromey/akwriters,Kromey/fbxnano,Kromey/fbxnano,Kromey/akwriters | contact/forms.py | contact/forms.py | from django import forms
from django.core.exceptions import ValidationError
from prosodyauth.forms import PlaceholderForm
from simplecaptcha import captcha
contact_reasons = (
('question', 'Question'),
('problem', 'Problem'),
('suggestion', 'Suggestion'),
('other', 'Other'),
... | mit | Python | |
0aed5df2f7c08cdb365b098a93800b0269c0c6b4 | Create class Dataset | gammapy/gamma-cat | gammacat/dataset.py | gammacat/dataset.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import logging
from .utils import load_yaml, write_yaml
from gammapy.catalog.gammacat import GammaCatResource
__all__ = [
'DataSet',
]
log = logging.getLogger(__name__)
class DataSet:
"""Process a dataset file."""
resource_type = 'ds'
d... | bsd-3-clause | Python | |
828b065e857b5f148a0d20b06fd9d45824a1befc | add manager.py flask api for genmodel | empirical-org/WikipediaSentences,empirical-org/WikipediaSentences | genmodel/manager.py | genmodel/manager.py | from flask import Flask, request, render_template, jsonify
import psycopg2
import os
# Connect to Database
try:
DB_NAME=os.environ['DB_NAME']
DB_USER=os.environ['DB_USER']
DB_PASS=os.environ['DB_PASS']
except KeyError as e:
raise Exception('environment variables for database connection must be set')
c... | agpl-3.0 | Python | |
7e28a3fe54c24a38a90bf0e7cf2f634ca78ee2ed | Add script used to generate a Cantor set | ExcaliburZero/cantor-set | cantorset.py | cantorset.py | ### BEGIN LICENSE
# The MIT License (MIT)
#
# Copyright (C) 2015 Christopher Wells <cwellsny@nycap.rr.com>
#
# 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 wit... | mit | Python | |
282383ab66f85ff6eb58b98c34558c02c9cf44eb | add a tool to list recipes used by builders (and ones not on recipes) | eunchong/build,eunchong/build,eunchong/build,eunchong/build | scripts/tools/builder_recipes.py | scripts/tools/builder_recipes.py | #!/usr/bin/env python
# Copyright 2015 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.
import argparse
import json
import operator
import os
import subprocess
import sys
import tempfile
BASE_DIR = os.path.dirname(os.path... | bsd-3-clause | Python | |
bf3f14692b6e2a348f5a0171ad57e494801ed4f4 | Add python script to write lib svm expected data format from my collected data | Wayne82/libsvm-practice,Wayne82/libsvm-practice,Wayne82/libsvm-practice | scripts/writelibsvmdataformat.py | scripts/writelibsvmdataformat.py | """
A script to write out lib svm expected data format from my collecting data
"""
import os
import sys
import csv
import getopt
cmd_usage = """
usage: writelibsvmdataformat.py --inputs="/inputs/csv_files" --output="/output/lib_svm_data"
"""
feature_space = 10
def write_libsvm_data(input_files, output_file):
... | bsd-3-clause | Python | |
900c93e6917ef92da02cca6865284e0004b01695 | add file | Fahreeve/aiovk,Fahreeve/aiovk,Fahreeve/aiovk | aiovk/mixins.py | aiovk/mixins.py | class LimitRateDriverMixin(object):
requests_per_second = 3
| mit | Python | |
a30277835e65195fc68e6708fe5da394bc43e08c | Test Projection | Contraz/demosys-py | tests/test_projection.py | tests/test_projection.py | from demosys.test import DemosysTestCase
from demosys.opengl import Projection
class ProjectionTest(DemosysTestCase):
def test_create(self):
proj = Projection(fov=60, near=0.1, far=10)
proj.update(fov=75, near=1, far=100)
proj.tobytes()
proj.projection_constants
| isc | Python | |
1c2c7d5134780e58bd69f24ee06050b2f405d946 | Add unit test for run_nohw | Igalia/snabb,eugeneia/snabbswitch,eugeneia/snabbswitch,eugeneia/snabbswitch,alexandergall/snabbswitch,Igalia/snabb,alexandergall/snabbswitch,snabbco/snabb,dpino/snabb,eugeneia/snabb,heryii/snabb,alexandergall/snabbswitch,snabbco/snabb,snabbco/snabb,alexandergall/snabbswitch,Igalia/snabbswitch,Igalia/snabb,snabbco/snabb... | src/program/lwaftr/tests/subcommands/run_nohw_test.py | src/program/lwaftr/tests/subcommands/run_nohw_test.py | """
Test the "snabb lwaftr run_nohw" subcommand.
"""
import unittest
from random import randint
from subprocess import call, check_call
from test_env import DATA_DIR, SNABB_CMD, BaseTestCase
class TestRun(BaseTestCase):
program = [
str(SNABB_CMD), 'lwaftr', 'run_nohw',
]
cmd_args = {
'--... | apache-2.0 | Python | |
d36ce70863653238d88e8ec23416ec894d6140eb | Create _geoserver_publish_layergroup.py | state-hiu/cybergis-scripts,state-hiu/cybergis-scripts | lib/cybergis/gs/_geoserver_publish_layergroup.py | lib/cybergis/gs/_geoserver_publish_layergroup.py | from base64 import b64encode
from optparse import make_option
import json
import urllib
import urllib2
import argparse
import time
import os
import subprocess
def make_request(url, params, auth=None, data=None, contentType=None):
"""
Prepares a request from a url, params, and optionally authentication.
"""... | mit | Python | |
ff3e3e6be3a5a46db73a772f99071e83b9026d98 | add wikipedia plugin | Rouji/Yui,Rj48/ircbot | plugins/wiki.py | plugins/wiki.py | import wikipedia
MAX_LEN = 350
@yui.command('wiki', 'wk', 'w')
def wiki(argv):
"""wiki [-lang] <article>"""
lang = 'en'
if len(argv) < 2:
return
# check if a language is given
argv = argv[1:]
if len(argv) > 1 and argv[0].startswith('-'):
lang = argv[0][1:]
argv = argv[... | mit | Python | |
8fc91c780cf7f0b43deac69b0e60f2b9472af172 | Add script to automatically setup ln -s for the utilities I use | LonamiWebs/Py-Utils | set-links.py | set-links.py | """
Helper script to set up ln -s <desired utilities> on a given bin/ PATH.
"""
import os
utilities = (
'mineutils/mc',
'misc/gitmail',
'misc/pipu',
'misc/reclick',
)
def run(program, *args):
"""Spawns a the given program as a subprocess and waits for its exit"""
# I for Invariant argument c... | mit | Python | |
7556fd9f55fe84a82a4843fb0ba43e7ad144e874 | Update tendrl_definitions.py | Tendrl/node_agent,r0h4n/node-agent,Tendrl/node-agent,Tendrl/node-agent,Tendrl/node_agent,Tendrl/node-agent,r0h4n/node-agent,r0h4n/node-agent | tendrl/node_agent/persistence/tendrl_definitions.py | tendrl/node_agent/persistence/tendrl_definitions.py | from tendrl.bridge_common.etcdobj.etcdobj import EtcdObj
from tendrl.bridge_common.etcdobj import fields
class TendrlDefinitions(EtcdObj):
"""A table of the Os, lazily updated
"""
__name__ = '/tendrl_definitions_node_agent'
data = fields.StrField("data")
| from tendrl.bridge_common.etcdobj.etcdobj import EtcdObj
from tendrl.bridge_common.etcdobj import fields
class TendrlDefinitions(EtcdObj):
"""A table of the Os, lazily updated
"""
__name__ = '/tendrl_definitions_node_agent'
data = fields.StrField("data")
def render(self):
self.__name__ ... | lgpl-2.1 | Python |
907fa0a42dd90ca67d86e61ce7984d5764455fb9 | add missing __init__.py | freevo/kaa-base,freevo/kaa-base | src/distribution/__init__.py | src/distribution/__init__.py | # -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------------
# core.py - distutils functions for kaa packages
# -----------------------------------------------------------------------------
# $Id: distribution.py 2110 2006-11-29 00:41:31Z tack $
#
# ----------------------... | lgpl-2.1 | Python | |
92f63d6ad055aa213b67ad2778187faee1fde821 | Add in printParents.py | houtianze/pyutil | printParents.py | printParents.py | from types import *
# https://stackoverflow.com/questions/2611892/get-python-class-parents
def printParents(thing, ident = 2):
'''
Print out all the parents (till the ancestors) of a given class / object.
@param indent: Print indentation
'''
typ = type(thing)
if typ is ClassType:
printClassParents(thing, 0)
... | mit | Python | |
87565c1e6032bff2cc3e20f5c4f46b7a17977f7c | Add organisation for TFL Dial a Ride | alphagov/notifications-api,alphagov/notifications-api | migrations/versions/0098_tfl_dar.py | migrations/versions/0098_tfl_dar.py | """empty message
Revision ID: 0098_tfl_dar
Revises: 0097_notnull_inbound_provider
Create Date: 2017-06-05 16:15:17.744908
"""
# revision identifiers, used by Alembic.
revision = '0098_tfl_dar'
down_revision = '0097_notnull_inbound_provider'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects imp... | mit | Python | |
22585d29220709dc3a3de16b03c626ca27c715ca | Add migration version? Not sure if this is right | brianwolfe/robotics-tutorial,brianwolfe/robotics-tutorial,brianwolfe/robotics-tutorial | migrations/versions/3025c44bdb2_.py | migrations/versions/3025c44bdb2_.py | """empty message
Revision ID: 3025c44bdb2
Revises: None
Create Date: 2014-12-16 12:13:55.759378
"""
# revision identifiers, used by Alembic.
revision = '3025c44bdb2'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
pass
def downgrade():
pass
| bsd-2-clause | Python | |
64c70f3f73d14d5bdd18cf5c4ad8b15ec745f517 | Add helpful script for ascii checking - fyi @bruskiza | praekelt/mama-ng-jsbox,praekelt/mama-ng-jsbox | config/check_ascii.py | config/check_ascii.py | import json
files = ["go-ussd_public.ibo_NG.json"]
def is_ascii(s):
return all(ord(c) < 128 for c in s)
current_message_id = 0
for file_name in files:
json_file = open(file_name, "rU").read()
json_data = json.loads(json_file)
print "Proccessing %s\n-------" % file_name
for key, value in json_dat... | bsd-3-clause | Python | |
289ce4a720c5863f6a80e1b86083fd2919b52f14 | Add file for tests of start symbol as not nonterminal | PatrikValkovic/grammpy | tests/startsymbol_tests/NotNonterminalTest.py | tests/startsymbol_tests/NotNonterminalTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 10.08.2017 23:12
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase, main
from grammpy import *
class NotNonterminalTest(TestCase):
pass
if __name__ == '__main__':
main()
| mit | Python | |
764f02e5e8c53b47cb2e28375a049accba442f0c | Create __init__.py | widoyo/simpleapp | app/__init__.py | app/__init__.py | # -*- encoding: utf-8 -*-
# app/__init__.py
| mit | Python | |
d9291843d575e587efdd7aa0c4605fee766dc232 | clean up test queries | uwescience/raco,uwescience/raco,uwescience/raco,uwescience/raco,uwescience/raco | examples/test_query.py | examples/test_query.py | from raco import RACompiler
from raco.language import CCAlgebra, MyriaAlgebra
from raco.algebra import LogicalAlgebra
import logging
logging.basicConfig(level=logging.DEBUG)
LOG = logging.getLogger(__name__)
def testEmit(query, name):
LOG.info("compiling %s", query)
# Create a compiler object
dlog = RAC... | bsd-3-clause | Python | |
3aea50fd086975cfdcc6a337b2ff5a6cace8ce95 | Create kuubio.py | botlabio/autonomio,botlabio/autonomio | kuubio.py | kuubio.py | from keras_diagram import ascii
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM
from keras.models import model_from_json
from load_data import *
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('bmh')
%matplotlib inline
import warnings
warnings.filterwar... | mit | Python | |
acfa4877ac50a3895cc9f9cb2e349f948d4b8001 | add a script to fetch official hero data from battle.net | rhots/automation | bin/get_official_heroes.py | bin/get_official_heroes.py | import sys
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
"""
The official heroes listing on battle.net is populated by a list of
Objects defined in JS (window.heroes). This script fetches the full
list and outputs a list of tuples relating official hero names to the
battle.n... | isc | Python | |
381c2537eff5003758d552281edfd885ee40ab80 | Add migrations | praekelt/sideloader,praekelt/sideloader,praekelt/sideloader,praekelt/sideloader | sideloader/migrations/0003_auto_20141203_1708.py | sideloader/migrations/0003_auto_20141203_1708.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('sideloader', '0002_auto_20141203_1611'),
]
operations = [
migrations.AlterField(
model_name='project',
... | mit | Python | |
f405829f9f4bed9c833f7e25dc97610e34b5dd71 | Add JSONField tests | renalreg/cornflake | cornflake/tests/fields/test_json_field.py | cornflake/tests/fields/test_json_field.py | import pytest
from cornflake.fields import JSONField
@pytest.mark.parametrize(('value', 'expected'), [
(True, True),
(False, False),
(123, 123),
(123.456, 123.456),
('foo', 'foo'),
(['foo', 'bar'], ['foo', 'bar']),
({'foo': 'bar'}, {'foo': 'bar'})
])
def test_to_representation(value, expe... | mit | Python | |
8df06647abc7e5125e88af68000f04ac9eca3290 | add missing file | nschloe/quadpy | quadpy/_exception.py | quadpy/_exception.py | class QuadpyError(Exception):
pass
| mit | Python | |
f641c8aa8e2eb5d98a90a10813fae6af4b136133 | Add command that reindexes all tenants in parallel | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/clients/management/commands/reindex.py | bluebottle/clients/management/commands/reindex.py | from optparse import make_option
import subprocess
from multiprocessing import Pool
from bluebottle.common.management.commands.base import Command as BaseCommand
from bluebottle.clients.models import Client
def reindex(schema_name):
print(f'reindexing tenant {schema_name}')
return (
schema_name,
... | bsd-3-clause | Python | |
1bfc53f5645d6dc7dbbdd020f23e86bebfdc2fc9 | Add quick.py (quicksort) | jailuthra/misc,jailuthra/misc,jailuthra/misc,jailuthra/misc | python/quick.py | python/quick.py | #!/usr/bin/env python3
def main():
arr = []
fname = sys.argv[1]
with open(fname, 'r') as f:
for line in f:
arr.append(int(line.rstrip('\r\n')))
quicksort(arr, start=0, end=len(arr)-1)
print('Sorted list is: ', arr)
return
def quicksort(arr, start, end):
if end - start <... | mit | Python | |
25a6ad2a6b37bac4dd553c4e534092f2261d6037 | Add response classes | rahmonov/agile-crm-python | client/responses.py | client/responses.py |
class SuccessResponse:
def __new__(cls, data=None, text=None, *args, **kwargs):
return {
'status_code': 200,
'ok': True,
'data': data,
'text': text
}
class NonSuccessResponse:
def __new__(cls, status=400, text=None, *args, **kwargs):
re... | mit | Python | |
bd4ccf9c4876b84cad23f68ea81ecadae733589a | add example for raw binary IO with header | aringh/odl,kohr-h/odl,odlgroup/odl,aringh/odl,odlgroup/odl,kohr-h/odl | examples/tomo/data/raw_binary_io_with_header.py | examples/tomo/data/raw_binary_io_with_header.py | # Copyright 2014-2016 The ODL development group
#
# This file is part of ODL.
#
# ODL is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#... | mpl-2.0 | Python | |
d89bb401926698dc829be937d8f9c1959ecfd580 | make ok,eq actual functions | fxstein/cement,akhilman/cement,datafolklabs/cement,rjdp/cement,datafolklabs/cement,fxstein/cement,rjdp/cement,akhilman/cement,akhilman/cement,rjdp/cement,datafolklabs/cement,fxstein/cement | cement/utils/test.py | cement/utils/test.py | """Cement testing utilities."""
import unittest
from ..core import backend, foundation
# shortcuts
from nose.tools import ok_ as ok
from nose.tools import eq_ as eq
from nose.tools import raises
from nose import SkipTest
class TestApp(foundation.CementApp):
"""
Basic CementApp for generic testing.
"... | """Cement testing utilities."""
import unittest
from ..core import backend, foundation
# shortcuts
from nose.tools import ok_ as ok
from nose.tools import eq_ as eq
from nose.tools import raises
from nose import SkipTest
class TestApp(foundation.CementApp):
"""
Basic CementApp for generic testing.
"... | bsd-3-clause | Python |
8e1e6585c4bfa76ebbd945d765c6a4a3dc98025d | Add new package: dnstracer (#18933) | LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/dnstracer/package.py | var/spack/repos/builtin/packages/dnstracer/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 Dnstracer(Package):
"""Dnstracer determines where a given Domain Name Server gets
its ... | lgpl-2.1 | Python | |
2f889b045c1a03b3b046127380f15909ea117265 | add new package (#25844) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-kornia/package.py | var/spack/repos/builtin/packages/py-kornia/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 PyKornia(PythonPackage):
"""Open Source Differentiable Computer Vision Library for PyTorch... | lgpl-2.1 | Python | |
e73aac38882b90e7219035800b400c2ed1e181ef | add http data wrapper that can be used to specify options for a specific request | sassoftware/robj | robj/lib/httputil.py | robj/lib/httputil.py | #
# Copyright (c) 2010 rPath, Inc.
#
# This program is distributed under the terms of the MIT License as found
# in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/licenses/mit-license.php.
#
# This program is distributed in the hope that it will be useful, b... | apache-2.0 | Python | |
bc2abe4c295a371358064952e6c3afa395a4bd13 | Rename Longest-Common-Prefix.py to LongestCommonPrefixtwo.py | chengjinlee/leetcode-solution-python,chengjinlee/leetcode | leetcode/14.-Longest-Common-Prefix/LongestCommonPrefixtwo.py | leetcode/14.-Longest-Common-Prefix/LongestCommonPrefixtwo.py | #!/usr/bin/python
#_*_ coding:utf-8 _*_
class Solution(object):
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
strNum=len(strs) #字符串的长度
if strNum == 0 or strs == None:
return ''
else:
prefix = st... | mit | Python | |
5f9c9500296627a94221ecd9614209a2c791e8b9 | remove pointless condition | QuiteQuiet/PokemonShowdownBot | plugins/messages.py | plugins/messages.py | import random
class Message:
def __init__(self, sent, msg):
self.sent = sent
self.msg = msg
def replyFormat(self):
return 'From {user}: {msg}'.format(user = self.sent, msg = self.msg)
class MessageDatabase:
def __init__(self):
self.messages = {}
def pendingMessages(self... | import random
class Message:
def __init__(self, sent, msg):
self.sent = sent
self.msg = msg
def replyFormat(self):
return 'From {user}: {msg}'.format(user = self.sent, msg = self.msg)
class MessageDatabase:
def __init__(self):
self.messages = {}
def pendingMessages(self... | mit | Python |
f0f72e5d8a64f7f49406022fd170808417220289 | Create publish.py | HuStmpHrrr/gjms | clickonce/publish.py | clickonce/publish.py | from __future__ import print_function
import subprocess
import os
import sys
import shutil
import datetime
import distutils.dir_util
if sys.version_info < (3,):
input = raw_input
str = unicode
pwd = os.getcwd()
appver_file = r'.\AppVer'
target_shares = {
'release': [],
'test' : [],
'dev' : ... | lgpl-2.1 | Python | |
badbf8c89216b97ac29ea3582d99d28535f82a7e | Update __init__.py | PySlither/Slither,PySlither/Slither | slither/__init__.py | slither/__init__.py | from . import slither
__all__ = ['slither','Mouse','Stage','Sprite','Sound']
| from slither import slither
__all__ = ['slither','Mouse','Stage','Sprite','Sound']
| mit | Python |
79df8ab80e6b14f16af125895f5b7338e5c41a60 | add IOTools | morgenst/PyAnalysisTools,morgenst/PyAnalysisTools,morgenst/PyAnalysisTools | base/IOTools.py | base/IOTools.py | import ROOT
import os
class Writer:
def __init__(self, directory=None):
"""
:param directory:
"""
if directory is None:
directory = os.path.abspath(os.curdir)
self.dir = directory
self.__check_and_create_directory(self.dir)
def __check_and_create_d... | mit | Python | |
2786dd91b0bb7dc8849e3549ff40de28d72d40d5 | add a django multi-database router | muccg/rdrf,muccg/rdrf,muccg/rdrf,muccg/rdrf,muccg/rdrf | rdrf/rdrf/db.py | rdrf/rdrf/db.py | from io import StringIO
import os
from django.core.management import call_command
from django.db import connections
class RegistryRouter:
# Whether clinical db is configured at all.
one_db = "clinical" not in connections
# Whether clinical db is configured to be the same as main db.
same_db = (one_db ... | agpl-3.0 | Python | |
0b6f6a9fd3916d8a028d5c3ccf4ca4a0277b9781 | Add arena class prototype | Finikssky/gladiators | src/arena.py | src/arena.py | import jsonpickle
class ArenaType():
Circle = 0
Square = 1
class ArenaCoverType():
Soil = 0
Sand = 1
Grass = 2
Stone = 3
class Arena():
def __init__(self, name, size, stype, cover):
self.name = name
self.size = size
self.type = stype
self.cover = cover | mit | Python | |
4b0a21dd813d58370805053e60376f64b5927cd9 | Add tutorial for MakeNumpyDataFrame | olifre/root,olifre/root,olifre/root,olifre/root,olifre/root,olifre/root,olifre/root,olifre/root,olifre/root,olifre/root,olifre/root | tutorials/dataframe/df032_MakeNumpyDataFrame.py | tutorials/dataframe/df032_MakeNumpyDataFrame.py | ## \file
## \ingroup tutorial_dataframe
## \notebook
## Read data from Numpy arrays into RDataFrame.
##
## \macro_code
## \macro_output
##
## \date March 2021
## \author Stefan Wunsch (KIT, CERN)
import ROOT
import numpy as np
# Let's create some data in numpy arrays
x = np.array([1, 2, 3], dtype=np.int32)
y = np.arr... | lgpl-2.1 | Python | |
43eb4f930f14fcf693f0656a3f0bbe749ed98d2e | Move subgraph attribute copies tests to a separate file. | dmoliveira/networkx,dmoliveira/networkx,dhimmel/networkx,ghdk/networkx,wasade/networkx,bzero/networkx,debsankha/networkx,goulu/networkx,bzero/networkx,NvanAdrichem/networkx,debsankha/networkx,bzero/networkx,RMKD/networkx,yashu-seth/networkx,JamesClough/networkx,tmilicic/networkx,ionanrozenfeld/networkx,farhaanbukhsh/ne... | networkx/algorithms/components/tests/test_subgraph_copies.py | networkx/algorithms/components/tests/test_subgraph_copies.py | """ Tests for subgraphs attributes
"""
from copy import deepcopy
from nose.tools import assert_equal
import networkx as nx
class TestSubgraphAttributesDicts:
def setUp(self):
self.undirected = [
nx.connected_component_subgraphs,
nx.biconnected_component_subgraphs,
]
... | bsd-3-clause | Python | |
f36a3e4e6cfbc5d3aa14017dcfea6e0fc67514f0 | add delete_environment command | briandilley/ebs-deploy,cfeduke/ebs-deploy,cookbrite/ebs-deploy | ebs_deploy/commands/delete_environment_command.py | ebs_deploy/commands/delete_environment_command.py | from ebs_deploy import out, parse_env_config
def add_arguments(parser):
"""
Args for the delete environment command
"""
parser.add_argument('-e', '--environment',
help='Environment name', required=True)
def execute(helper, config, args):
"""
Deletes an environment
... | mit | Python | |
cf4e468ed28a7e750adfbcd41235ac5b90cb562b | Add new package: diffmark (#18930) | LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/diffmark/package.py | var/spack/repos/builtin/packages/diffmark/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 Diffmark(AutotoolsPackage):
"""Diffmark is a DSL for transforming one string to another.""... | lgpl-2.1 | Python | |
ddff4237ae0bb8dd2575265707a843f4497ccbf2 | Create headache.py | nbush/headache | headache.py | headache.py | """
python plaintext obfuscator
by n.bush
"""
import string
import random
def mess_maker(size=6, chars=string.ascii_uppercase + string.ascii_lowercase + string.digits):
return ''.join(random.choice(chars) for x in range(size))
def headache(text):
charlist = list(text)
obfuscated = []
class_a = mes... | mit | Python | |
a7d6344428ef43374fb82f5b357968ec38402984 | Create test_step_motor_Model_28BYJ_48p.py | somchaisomph/RPI.GPIO.TH | test/test_step_motor_Model_28BYJ_48p.py | test/test_step_motor_Model_28BYJ_48p.py | from gadgets.motors.step_motor import Model_28BYJ_48
st_mot = Model_28BYJ_48([11,15,16,18])
for i in range(2):
st_mot.angular_step(60,direction=2,waiting_time=2,bi_direction=True)
| mit | Python | |
4585d6426a6c2945a359bbe02c58702a07e68746 | Create new package. (#6209) | EmreAtes/spack,tmerrick1/spack,tmerrick1/spack,matthiasdiener/spack,EmreAtes/spack,krafczyk/spack,LLNL/spack,EmreAtes/spack,iulian787/spack,krafczyk/spack,matthiasdiener/spack,LLNL/spack,mfherbst/spack,matthiasdiener/spack,krafczyk/spack,iulian787/spack,matthiasdiener/spack,skosukhin/spack,tmerrick1/spack,skosukhin/spa... | var/spack/repos/builtin/packages/r-gsubfn/package.py | var/spack/repos/builtin/packages/r-gsubfn/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
e76fa7d23894bb88d47b761f683b4bbd797ef889 | Add Helpers object for cleaner helper syntax | funkybob/knights-templater,funkybob/knights-templater | knights/utils.py | knights/utils.py |
class Helpers:
'''
Provide a cheaper way to access helpers
'''
def __init__(self, members):
for key, value in members.items():
setattr(self, key, value)
| mit | Python | |
2838711c7fa12525c2ae6670bb130999654fe7ea | add shortest-palindrome | zeyuanxy/leet-code,EdisonAlgorithms/LeetCode,EdisonAlgorithms/LeetCode,zeyuanxy/leet-code,EdisonAlgorithms/LeetCode,zeyuanxy/leet-code | vol5/shortest-palindrome/shortest-palindrome.py | vol5/shortest-palindrome/shortest-palindrome.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2015-11-19 20:43:07
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2015-11-19 20:43:21
class Solution(object):
def shortestPalindrome(self, s):
"""
:type s: str
:rtype: str
"""
ss = s... | mit | Python | |
10f72d72e988bf4aa570e21b0e0d6979edb843a7 | add example "fit text path into a box" | mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf | examples/addons/fit_text_path_into_box.py | examples/addons/fit_text_path_into_box.py | # Copyright (c) 2021, Manfred Moitzi
# License: MIT License
from pathlib import Path
import ezdxf
from ezdxf import path, zoom
from ezdxf.math import Matrix44
from ezdxf.tools import fonts
from ezdxf.addons import text2path
DIR = Path('~/Desktop/Outbox').expanduser()
fonts.load()
doc = ezdxf.new()
doc.layers.new('... | mit | Python | |
e075b0b1c8d581107209e869eda7f6ff07a7321c | Add script to create a historic->modern dictionary | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | reverse_dict.py | reverse_dict.py | """Reverse modern->historic spelling variants dictonary to historic->modern
mappings
"""
import argparse
import codecs
import json
from collections import Counter
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('input_dict', help='the name of the json file '
... | apache-2.0 | Python | |
8a4175461e36c11356b41e28ca250121f200dc7e | add a new basic longliving statement checker which looks at the health of items on the server | dataflow/DataStage,dataflow/DataStage,dataflow/DataStage | datastage/dataset/longliving/sword_statement_check.py | datastage/dataset/longliving/sword_statement_check.py | import logging
import time
import thread
import urllib2
import sys
from django_longliving.base import LonglivingThread
from datastage.dataset import SUBMISSION_QUEUE
from datastage.web.dataset.models import DatasetSubmission
from datastage.web.dataset import openers
from sword2 import Connection, UrlLib2Layer
logge... | mit | Python | |
34886d13155af33acd043ddcd0d87738a729115a | Add files via upload | sheabrown/faraday_complexity | faraday_cnn.py | faraday_cnn.py | # ============================================================================
# Convolutional Neural Network for training a classifier to determine the
# complexity of a faraday spectrum.
# Written using Keras and TensorFlow by Shea Brown
# https://sheabrownastro.wordpress.com/
# https://astrophysicalmachinelearnin... | mit | Python | |
64e04143fec40f11cc573140d53bd96765426465 | Add scripts/evt2image.py to make image from event file | liweitianux/chandra-acis-analysis,liweitianux/chandra-acis-analysis,liweitianux/chandra-acis-analysis | scripts/evt2image.py | scripts/evt2image.py | #!/usr/bin/env python3
#
# Copyright (c) 2017 Weitian LI <liweitianux@live.com>
# MIT license
"""
Make image by binning the event file, and update the manifest.
TODO: use logging module instead of print()
"""
import sys
import argparse
import subprocess
from manifest import get_manifest
from setup_pfiles import set... | mit | Python | |
6988a498504b382fd86099d3c037100ad14c62d3 | fix bug, tpl_path is related to simiki source path, not wiki path | zhaochunqi/simiki,9p0le/simiki,tankywoo/simiki,9p0le/simiki,9p0le/simiki,tankywoo/simiki,zhaochunqi/simiki,zhaochunqi/simiki,tankywoo/simiki | simiki/configs.py | simiki/configs.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from os import path as osp
from pprint import pprint
import yaml
from simiki import utils
def parse_configs(config_file):
base_dir = osp.dirname(osp.dirname(osp.realpath(__file__)))
try:
with open(config_file, "rb") as fd:
configs ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from os import path as osp
from pprint import pprint
import yaml
from simiki import utils
def parse_configs(config_file):
#base_dir = osp.dirname(osp.dirname(osp.realpath(__file__)))
try:
with open(config_file, "rb") as fd:
configs... | mit | Python |
6adae60ee018966199ee1f8e2120b2eb65dcdc9e | Add stub for registration executable. | DudLab/nanshe,DudLab/nanshe,jakirkham/nanshe,nanshe-org/nanshe,nanshe-org/nanshe,jakirkham/nanshe | nanshe/nanshe/nanshe_registerer.py | nanshe/nanshe/nanshe_registerer.py | #!/usr/bin/env python
__author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Feb 20, 2015 13:00:51 EST$"
| bsd-3-clause | Python | |
b83c4ddb14c9ba555d187125838a5189dfb3530c | Remove six as an explicit dependency. | martijnengler/mycli,chenpingzhao/mycli,j-bennet/mycli,brewneaux/mycli,suzukaze/mycli,evook/mycli,oguzy/mycli,MnO2/rediscli,D-e-e-m-o/mycli,nkhuyu/mycli,danieljwest/mycli,suzukaze/mycli,j-bennet/mycli,jinstrive/mycli,evook/mycli,ZuoGuocai/mycli,danieljwest/mycli,chenpingzhao/mycli,MnO2/rediscli,mdsrosa/mycli,brewneaux/m... | setup.py | setup.py | import re
import ast
from setuptools import setup, find_packages
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('mycli/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
description = 'CLI for MySQL Database. With auto-completi... | import re
import ast
from setuptools import setup, find_packages
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('mycli/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
description = 'CLI for MySQL Database. With auto-completi... | bsd-3-clause | Python |
540bf48cdca59744baf043cbfa5056b07e493429 | fix sage script to work generally over a list of account ids to produce lists of journals | DOAJ/doaj,DOAJ/doaj,DOAJ/doaj,DOAJ/doaj | portality/scripts/journals_in_doaj_by_account.py | portality/scripts/journals_in_doaj_by_account.py | from portality import models
from portality.core import app
from portality.core import es_connection
import esprit
import csv
import json
from portality.util import ipt_prefix
class JournalQuery(object):
def __init__(self, owner):
self.owner = owner
def query(self):
return {
"query... | apache-2.0 | Python | |
4d139c6d2b9ea368bfc5189537d9af67cea582f6 | Create demo_Take_Photo_when_PIR_high.py | nksheridan/elephantAI,nksheridan/elephantAI | demo_Take_Photo_when_PIR_high.py | demo_Take_Photo_when_PIR_high.py | import time
import picamera
import datetime
import RPi.GPIO as GPIO
def CheckPIR():
# dependencies are RPi.GPIO and time
# returns whats_here with "NOTHING HERE" or "SOMETHING HERE"
time.sleep(1)
#don't rush the PIR!
GPIO.setmode(GPIO.BOARD)
# set numbering system for GPIO PINs are BOARD
GP... | mit | Python | |
feeb386efe01fb3dd4e70e216337c8a4b476cb9a | Add setup.py | JaviMerino/bart,ARM-software/bart | setup.py | setup.py | #!/usr/bin/env python
# Copyright 2015-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | apache-2.0 | Python | |
4a4231976f2f084c1233e3efe27f5d18b486f146 | Create setup.py | jthomm/game-center-db | setup.py | setup.py | from setuptools import setup
import re
name = 'gcdb'
version = ''
with open('{0}/__init__.py'.format(name), 'rb') as f:
match_object = re.search(
r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
f.read(),
re.MULTILINE)
version = match_object.group(1)
setup(
name=name,
version=versio... | mit | Python | |
3c314d006fb1726b671d0223f08fe16f0944cd82 | test call started sla | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend | cla_backend/apps/reports/tests/test_mi_sla_report.py | cla_backend/apps/reports/tests/test_mi_sla_report.py | # -*- coding: utf-8 -*-
from contextlib import contextmanager
import datetime
from django.test import TestCase
from legalaid.forms import get_sla_time
import mock
from core.tests.mommy_utils import make_recipe, make_user
from cla_eventlog import event_registry
from cla_eventlog.models import Log
from reports.forms imp... | mit | Python | |
26cbfe83f0047c8ce66a21237db8ae484736a085 | Add TensorboardLogs class for use as a proxy to tensorboard data. | tsoontornwutikul/mlxm | helpers/tensorboard.py | helpers/tensorboard.py | import glob
import numpy as np
import os
from tensorflow.tensorboard.backend.event_processing.event_accumulator import EventAccumulator
from . import get_first_existing_path, get_nth_matching_path
from ..experiments import Experiment
class TensorboardLogs(object):
def __init__(self, path):
self.path = pat... | mit | Python | |
c184e79b91a63299c249e207dba1e8cd95a8e5d0 | Add fpocket (#12675) | iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/fpocket/package.py | var/spack/repos/builtin/packages/fpocket/package.py | # Copyright 2013-2019 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 Fpocket(MakefilePackage):
"""fpocket is a very fast open source protein pocket detection a... | lgpl-2.1 | Python | |
fb6eee18b2bf48dd0063623515ced00e980bdf10 | Add a few tests for docparse. | carolFrohlich/nipype,carolFrohlich/nipype,sgiavasis/nipype,gerddie/nipype,christianbrodbeck/nipype,glatard/nipype,grlee77/nipype,satra/NiPypeold,arokem/nipype,wanderine/nipype,mick-d/nipype,carlohamalainen/nipype,rameshvs/nipype,dgellis90/nipype,blakedewey/nipype,glatard/nipype,gerddie/nipype,grlee77/nipype,Leoniela/ni... | nipype/utils/tests/test_docparse.py | nipype/utils/tests/test_docparse.py | from nipype.testing import *
from nipype.utils.docparse import reverse_opt_map, build_doc
class Foo(object):
opt_map = {'outline': '-o', 'fun': '-f %.2f', 'flags': '%s'}
foo_doc = """Usage: foo infile outfile [opts]
Bunch of options:
-o something about an outline
-f <f> intensity of fun factor
O... | bsd-3-clause | Python | |
e71742bc0fc09ebf37532b92458670a4efe8926b | Add setup file | roverdotcom/django-device-notifications | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='django-device-notifications',
version='0.0.1',
description='Generic library for APN & GCM notifications',
author='Johann Heller',
author_email='johann@rover.com',
url='https://github.com/roverdotcom/django-device-notifications',
packa... | bsd-3-clause | Python | |
ec54935e169019067f2179a92d0f6e833f133bc9 | add a DataContainer implemented as a subclass of dict | simphony/simphony-common | simphony/core/data_container.py | simphony/core/data_container.py | from collections import Mapping
from simphony.core.cuba import CUBA
_ERROR_MESSAGE = "Keys {!r} are not in the approved CUBA keywords"
_CUBA_KEYS = set(CUBA)
class DataContainer(dict):
""" A DataContainer instance
The DataContainer object is implemented as a python dictionary whose keys
are restricted ... | bsd-2-clause | Python | |
4912bac4ab534ca942393c36f71dd7df4182eb94 | add test_dot.py | yashsharan/sympy,sahilshekhawat/sympy,dqnykamp/sympy,jbbskinny/sympy,debugger22/sympy,Mitchkoens/sympy,toolforger/sympy,VaibhavAgarwalVA/sympy,drufat/sympy,hrashk/sympy,cccfran/sympy,postvakje/sympy,MridulS/sympy,lidavidm/sympy,ga7g08/sympy,pandeyadarsh/sympy,atreyv/sympy,madan96/sympy,lindsayad/sympy,Arafatk/sympy,pbr... | sympy/printing/tests/test_dot.py | sympy/printing/tests/test_dot.py | from sympy.printing.dot import (purestr, styleof, attrprint, dotnode,
dotedges, dotprint)
from sympy import Symbol, Integer, Basic, Expr
from sympy.abc import x
def test_purestr():
assert purestr(Symbol('x')) == "Symbol(x)"
assert purestr(Basic(1, 2)) == "Basic(1, 2)"
def test_styleof():
styles =... | bsd-3-clause | Python | |
4567a9810b8c9abdb450a442c892dbdb4eecf0e0 | Add test.py to test gsutil in pantheon | googleinterns/automated-windows-vms,googleinterns/automated-windows-vms | vm_server/accept/test.py | vm_server/accept/test.py | from google.cloud import storage
bucket_name = "automation-interns"
destination_file_name = ("./text.txt")
source_blob_name = "test/text_file.txt"
storage_client = storage.Client()
bucket = storage_client.bucket(bucket_name)
blob = bucket.blob(source_blob_name)
blob.download_to_filename(destination_file_name) | apache-2.0 | Python | |
a43acda7271c3fc48a82552721aec1332e9892d6 | Create OpticalDensityInv.py | DigitalSlideArchive/HistomicsTK,DigitalSlideArchive/HistomicsTK | OpticalDensityInv.py | OpticalDensityInv.py | import numpy
def OpticalDensityInv( I ):
'''
Transforms input RGB image "I" into optical density space for color deconvolution.
*Inputs:
I (rgbimage) - a floating-point image of optical density values obtained
from OpticalDensityFwd.
*Outputs:
Out (rgbimage) - a ... | apache-2.0 | Python | |
fa049b79c24f8213fa9335a31a34c354faf67459 | Add exmaple about proving equivalence of exprs | JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton | src/examples/python/proving_equivalence.py | src/examples/python/proving_equivalence.py | #!/usr/bin/env python
## -*- coding: utf-8 -*-
##
## $ python ./proving equivalence.py
## True
## True
## True
## True
## True
## True
## True
## True
## True
## True
## True
## True
## True
## True
##
import sys
from triton import *
def prove(ctx, n):
ast = ctx.getAstContext()
if ctx.isSat(ast.lnot(n)) == T... | apache-2.0 | Python | |
3c997e3a9eb92c3053c521f6c2fff6cfdf99c126 | add setup.py | olin-computing/assignment-dashboard,osteele/assignment-dashboard,osteele/assignment-dashboard,olin-computing/assignment-dashboard,olin-computing/assignment-dashboard | setup.py | setup.py | # noqa: D100
import os
import re
from setuptools import setup
requirements_txt = open(os.path.join(os.path.dirname(__file__), 'requirements.txt')).read()
requirements = re.findall(r'^([^\s#]+)', requirements_txt, re.M)
setup(name='assignment_dashboard',
packages=['assignment_dashboard'],
include_package_... | mit | Python | |
11cf7dd63f8fe7453057ef0846d4e645fa05f124 | Add setuptools setup.py | matwey/pybeam | setup.py | setup.py | from setuptools import setup
setup(name='pybeam',
version='0.1',
description='Python module to parse Erlang BEAM files',
url='http://github.com/matwey/pybeam',
author='Matwey V. Kornilov',
author_email='matwey.kornilov@gmail.com',
license='MIT',
packages=['pybeam'],
inst... | mit | Python | |
555dac76a8810cfeaae96f8de04e9eb3362a3314 | Remove old notification status column | alphagov/notifications-api,alphagov/notifications-api | migrations/versions/0109_rem_old_noti_status.py | migrations/versions/0109_rem_old_noti_status.py | """
Revision ID: 0109_rem_old_noti_status
Revises: 0108_change_logo_not_nullable
Create Date: 2017-07-10 14:25:15.712055
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0109_rem_old_noti_status'
down_revision = '0108_change_logo_not_nullable'
def upgrade():... | mit | Python | |
21a67556b83b7905134439d55afe33c35e4b3422 | Add an index on notifications for (service_id, created_at) to improve the performance of the notification queries. We've already performed this update on production since you need to create the index concurrently, which is not allowed from the alembic script. For that reason we are checking if the index exists. | alphagov/notifications-api,alphagov/notifications-api | migrations/versions/0246_notifications_index.py | migrations/versions/0246_notifications_index.py | """
Revision ID: 0246_notifications_index
Revises: 0245_archived_flag_jobs
Create Date: 2018-12-12 12:00:09.770775
"""
from alembic import op
revision = '0246_notifications_index'
down_revision = '0245_archived_flag_jobs'
def upgrade():
conn = op.get_bind()
conn.execute(
"CREATE INDEX IF NOT EXISTS... | mit | Python | |
86b2f32bd212a14e904b9823fbf543b321f46ca7 | Add very basic setup.py | takluyver/astcheck | setup.py | setup.py | from distutils.core import setup
setup(name='astcheck',
version='0.1',
py_modules=['astcheck'],
) | mit | Python | |
5acc7d50cbe199af49aece28b95ea97484ae31c7 | Add solution class for Ghia et al. (1982) | mesnardo/snake | snake/solutions/ghiaEtAl1982.py | snake/solutions/ghiaEtAl1982.py | """
Implementation of the class `GhiaEtAl1982` that reads the centerline velocities
reported in Ghia et al. (1982).
_References:_
* Ghia, U. K. N. G., Ghia, K. N., & Shin, C. T. (1982).
High-Re solutions for incompressible flow using the Navier-Stokes equations
and a multigrid method.
Journal of computational ph... | mit | Python | |
a893a8f9375164cbbec4e276ae73f181f74fd9ae | create image,py | piraaa/VideoDigitalWatermarking | src/image.py | src/image.py | #
# image.py
# Created by pira on 2017/07/28.
#
#coding: utf-8 | mit | Python | |
14068a2e3ca445c02895aed38420baf846338aae | Add smile detection example script. | iabdalkader/openmv,iabdalkader/openmv,iabdalkader/openmv,iabdalkader/openmv,openmv/openmv,kwagyeman/openmv,openmv/openmv,kwagyeman/openmv,kwagyeman/openmv,openmv/openmv,kwagyeman/openmv,openmv/openmv | scripts/examples/25-Machine-Learning/nn_haar_smile_detection.py | scripts/examples/25-Machine-Learning/nn_haar_smile_detection.py | # Simle detection using Haar Cascade + CNN.
import sensor, time, image, os, nn
sensor.reset() # Reset and initialize the sensor.
sensor.set_contrast(2)
sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565
sensor.set_framesize(sensor.QQVGA) # Set frame size to QVGA (320x240... | mit | Python | |
b31e7a3471daefb79b1d63a433c480cf51b75745 | Create __init__.py | TryCatchHCF/DumpsterFire | FireModules/FileDownloads/AccountBruting/__init__.py | FireModules/FileDownloads/AccountBruting/__init__.py | mit | Python | ||
7a4df9d8c385ed53e29e5171c115939920a271b3 | Add a setup.py script | kinverarity1/python-csv-utility | setup.py | setup.py | # Use the setuptools package if it is available. It's preferred
# because it creates an exe file on Windows for Python scripts.
try:
from setuptools import setup
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
setup(name='csv_util',
entr... | mit | Python | |
1e7548a5b237f18c3bf5918a2254d04125492372 | Add setup script | yehzhang/RapidTest,yehzhang/RapidTest | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='rapidtest',
version='0.1',
author='Simon Zhang',
license='MIT',
packages=find_packages(),
install_requires=[])
| mit | Python | |
61fcca809b31372bb5e793359df243cff5ee23cf | Add the setup.py file | fedora-infra/fedmsg-fasclient | setup.py | setup.py | # -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='fedmsg_fasclient',
version='0.1',
description='A fedmsg consumer that runs the fasClient based on fedmsg FAS messages',
license="LGPLv2+",
author='Janez Nemanič, Ralph Bean and Pierre-Yves Chibon',
author_email='admin@fedoraproje... | lgpl-2.1 | Python | |
139123ddb81eec12d0f932ff6ff73aadb4b418cc | Add decorator to make a Node class from a regular function | vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium | ocradmin/lib/nodetree/decorators.py | ocradmin/lib/nodetree/decorators.py | """
Nodetree decorators.
"""
import inspect
import textwrap
import node
def underscore_to_camelcase(value):
def camelcase():
yield str.lower
while True:
yield str.capitalize
c = camelcase()
return "".join(c.next()(x) if x else '_' for x in value.split("_"))
def upper_camelca... | apache-2.0 | Python | |
fe7f07cbd9ff9844efa2b191a900f6efb9de576e | add db model file | taoalpha/XMate,taoalpha/XMate,taoalpha/XMate,taoalpha/XMate | model/db.py | model/db.py | # db model - all db handlers
| mit | Python | |
8ec524a7a64c55f0759e18ea4b70c63c9c83f99a | Add admin for the various models | hzj123/56th,geoffkilpin/pombola,hzj123/56th,patricmutwiri/pombola,geoffkilpin/pombola,patricmutwiri/pombola,mysociety/pombola,ken-muturi/pombola,mysociety/pombola,ken-muturi/pombola,mysociety/pombola,hzj123/56th,mysociety/pombola,geoffkilpin/pombola,mysociety/pombola,patricmutwiri/pombola,patricmutwiri/pombola,patricmu... | pombola/interests_register/admin.py | pombola/interests_register/admin.py | from django.contrib import admin
from . import models
class CategoryAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ["name"]}
list_display = ['slug', 'name', 'sort_order']
search_fields = ['name']
class ReleaseAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ["name"]}
list_displa... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.