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 |
|---|---|---|---|---|---|---|---|---|
dc9c9cfd45726e4f3458fcc0f02c29c61482c0bc | Create gzip_identifier.py | Bindernews/TheHound | identifiers/gzip_identifier.py | identifiers/gzip_identifier.py | from identifier import Result
GZ_PATTERNS = [
'1F 8B 08 08'
]
class GzResolver:
def identify(self, stream):
return Result('GZ')
def load(hound):
hound.add_matches(GZ_PATTERNS, GzResolver())
| mit | Python | |
ffe76ac5d3cd5485dd288415a5845c2d5a247633 | add shipping | douglassquirrel/microservices-hackathon-july-2014,douglassquirrel/combo,douglassquirrel/combo,douglassquirrel/microservices-hackathon-july-2014,douglassquirrel/microservices-hackathon-july-2014,douglassquirrel/microservices-hackathon-july-2014,douglassquirrel/combo | components/shipping_reckoner/shipping_reckoner.py | components/shipping_reckoner/shipping_reckoner.py | #! /usr/bin/env python
from json import loads, dumps
from pika import BlockingConnection, ConnectionParameters
RABBIT_MQ_HOST = '54.76.183.35'
RABBIT_MQ_PORT = 5672
def shipping(ch, method, properties, body):
product = loads(body)
sku, price = product['sku'], product['price']
if price < 50:
shipp... | mit | Python | |
112fadcee2bcb0f0122916ed248df7c965189c36 | Add pagination tests for permission groups | mociepka/saleor,mociepka/saleor,mociepka/saleor | tests/api/pagination/test_account.py | tests/api/pagination/test_account.py | import pytest
from django.contrib.auth import models as auth_models
from ..utils import get_graphql_content
@pytest.fixture
def permission_groups_for_pagination(db):
return auth_models.Group.objects.bulk_create(
[
auth_models.Group(name="Group1"),
auth_models.Group(name="GroupGrou... | bsd-3-clause | Python | |
8c85761d37625393cdb70664af33853cbe105a9d | Create binarytree_intree.py | HeyIamJames/CodingInterviewPractice,HeyIamJames/CodingInterviewPractice | binarytree_intree.py | binarytree_intree.py | """"
find if a is a subset of b,
where both a and b are binary trees
"""
| mit | Python | |
cbef1510b8bf0e7d0d9a3bb5a678d2d118822979 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/d33e1ade02f55fd63e04ccf6e6188d009c9d3b69. | tensorflow/tensorflow-experimental_link_static_libraries_once,paolodedios/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,tensorflow/tensorflow,yongtang/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,Intel-tensorflow/tenso... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "d33e1ade02f55fd63e04ccf6e6188d009c9d3b69"
TFRT_SHA256 = "ac62839411fe0f0cde68daa8f50a... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "272fc1c72b798def2a9e2a384c478a6ee4b357c9"
TFRT_SHA256 = "a6173ac76fc7d2361729f6c268b3... | apache-2.0 | Python |
aeafc18cee3e8d833160d3bc2df6a971878022fe | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/90ada7c89c5d812ae3fe09d7c2cbd9a77e7273b8. | yongtang/tensorflow,paolodedios/tensorflow,yongtang/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-tensorflow/tensorflow,yongtang/ten... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "90ada7c89c5d812ae3fe09d7c2cbd9a77e7273b8"
TFRT_SHA256 = "8f2aab5b834112dd815bac9b0416... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "e66a3653ca77861cb3d9c34eb6bbe05d4f67dfae"
TFRT_SHA256 = "edabb53b75f8fef59d308310d2bf... | apache-2.0 | Python |
941f89dfb8f4c8bf0a8445d3c57ff9e652ad85d1 | Create server.py | rimpybharot/CMPE273 | lab1/server.py | lab1/server.py | ok
| mit | Python | |
bc46efa788a0e3d0aacab724e16b8da01a671331 | Add p1. | bm5w/5problems | p1.py | p1.py | def p1_for(input_list):
"""Compute some of numbers in list with for loop."""
out = 0
for i in input_list:
out += i
return out
def p1_while(input_list):
"""Compute some of numbers in list with while loop."""
out = 0
count = 0
while count < len(input_list):
out += input_l... | mit | Python | |
798a7e553bd67c5a75c7639b73f3a22c03bf32a2 | Create simple_RSA_implementation.py | IEEE-NITK/Daedalus,IEEE-NITK/Daedalus,chinmaydd/NITK_IEEE_SaS,IEEE-NITK/Daedalus | Prabhanjan/simple_RSA_implementation.py | Prabhanjan/simple_RSA_implementation.py | Implementation of RSA
#This can primarily be divided into 3 steps-
#1. Key Generation
#2. Encryption
#3. Decryption
import math
import random
def create_list_primes(sieve_size):
#Returns a list of primes less than or equal to sieveSize
sieve=[True]*sieve_size
sieve[0]=False
sieve[1]=False
#zero and one are not... | mit | Python | |
1a6818d4829c3da42750f6d0f042df203434595c | Add a little to models | LeeYiFang/Carkinos,LeeYiFang/Carkinos,LeeYiFang/Carkinos,LeeYiFang/Carkinos | Carkinos/probes/migrations/0002_auto_20160106_2307.py | Carkinos/probes/migrations/0002_auto_20160106_2307.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-06 15:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('probes', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | mit | Python | |
96d89e4398a68aab8df033847a1cf8fa47cef5dc | Create find-duplicate-file-in-system.py | yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,jaredkoontz/leetcode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,jaredkoontz/leetcode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,kamy... | Python/find-duplicate-file-in-system.py | Python/find-duplicate-file-in-system.py | # Time: O(n * l), l is the average length of file content
# Space: O(n * l)
# Given a list of directory info including directory path,
# and all the files with contents in this directory,
# you need to find out all the groups of duplicate files
# in the file system in terms of their paths.
#
# A group of duplicate fi... | mit | Python | |
2a6d8bc208463a0f903a2b62021abb913ab510c5 | Add TestSuiteHandler. | joyxu/kernelci-backend,kernelci/kernelci-backend,joyxu/kernelci-backend,joyxu/kernelci-backend,kernelci/kernelci-backend | app/handlers/test_suite.py | app/handlers/test_suite.py | # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | agpl-3.0 | Python | |
d1ce76f33bdf93ee631f3ee38b565e79a1f38343 | add a demo of building a custom python wrapper using libgvc | tkelman/graphviz,pixelglow/graphviz,tkelman/graphviz,MjAbuz/graphviz,pixelglow/graphviz,ellson/graphviz,BMJHayward/graphviz,kbrock/graphviz,BMJHayward/graphviz,pixelglow/graphviz,jho1965us/graphviz,jho1965us/graphviz,ellson/graphviz,kbrock/graphviz,BMJHayward/graphviz,tkelman/graphviz,BMJHayward/graphviz,BMJHayward/gra... | dot.demo/gv_test.py | dot.demo/gv_test.py | #!/usr/bin/python
import gv
g = gv.digraph("G")
n = gv.node(g,"hello")
m = gv.node(g,"world")
e = gv.edge(n,m)
gv.layout(g, "dot")
gv.render(g, "png", "gv_test.png")
gv.rm(g)
| epl-1.0 | Python | |
d9b4607819d985dee086ff4f435972d304e3a45e | update Site admin | zdw/xos,jermowery/xos,wathsalav/xos,xmaruto/mcord,cboling/xos,xmaruto/mcord,xmaruto/mcord,xmaruto/mcord,cboling/xos,wathsalav/xos,opencord/xos,wathsalav/xos,cboling/xos,open-cloud/xos,open-cloud/xos,jermowery/xos,wathsalav/xos,opencord/xos,jermowery/xos,cboling/xos,zdw/xos,open-cloud/xos,cboling/xos,jermowery/xos,zdw/x... | plstackapi/core/models/site.py | plstackapi/core/models/site.py | import os
from django.db import models
from plstackapi.core.models import PlCoreBase
from plstackapi.core.models import DeploymentNetwork
from plstackapi.openstack.driver import OpenStackDriver
# Create your models here.
class Site(PlCoreBase):
tenant_id = models.CharField(max_length=200, help_text="Keystone te... | import os
from django.db import models
from plstackapi.core.models import PlCoreBase
from plstackapi.core.models import DeploymentNetwork
from plstackapi.openstack.driver import OpenStackDriver
# Create your models here.
class Site(PlCoreBase):
tenant_id = models.CharField(max_length=200, help_text="Keystone t... | apache-2.0 | Python |
42192dad06079a654945a9a53dcdc548aa7085c4 | Create __init__.py | Timothylock/league-carnage-notifier-Raspberry-Pi,Timothylock/league-carnage-notifier-Raspberry-Pi | modules/datasave/__init__.py | modules/datasave/__init__.py | apache-2.0 | Python | ||
ad72e7cdc02d746ec56dfd85ed5a46de59e57684 | add the pocket pla machine laerning algorithm | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | machine_learning/python/pocket_pla.py | machine_learning/python/pocket_pla.py | import random
import numpy as np
FEATURE = 5
def sign(num):
if np.sign(num) <= 0:
return -1.0
return 1.0
def pla(X,y,m):
''' improved (pocket) perceptron learning algorithm
Arguments:
X {list or numpy array}
y {list or numpy array} -- target
m {integer} -- the size of tr... | cc0-1.0 | Python | |
4fe62ac1211e68f1d9c656453bdf71d6849c3daf | Add organisation values for the Enterprise Europe Network. | alphagov/notifications-api,alphagov/notifications-api | migrations/versions/0101_een_logo.py | migrations/versions/0101_een_logo.py | """empty message
Revision ID: 0101_een_logo
Revises: 0100_notification_created_by
Create Date: 2017-06-26 11:43:30.374723
"""
from alembic import op
revision = '0101_een_logo'
down_revision = '0100_notification_created_by'
ENTERPRISE_EUROPE_NETWORK_ID = '89ce468b-fb29-4d5d-bd3f-d468fb6f7c36'
def upgrade():
... | mit | Python | |
eff52ac7e0177cdf79b4fe4f076bf411a4b2b54b | Add migration file | cgwire/zou | migrations/versions/bf1347acdee2_.py | migrations/versions/bf1347acdee2_.py | """empty message
Revision ID: bf1347acdee2
Revises: b4dd0add5f79
Create Date: 2018-03-23 17:08:11.289953
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'bf1347acdee2'
down_revision = 'b4dd0add5f79'
branch_labels = None
depends_on = None
def upgrade():
# ... | agpl-3.0 | Python | |
845615f2a34c5680ed22a2f4eafa5febe7cd7246 | Add date updated to Owner | CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords,CityOfNewYork/NYCOpenRecords | alembic/versions/20087beff9ea_added_date_updated_t.py | alembic/versions/20087beff9ea_added_date_updated_t.py | """Added date updated to Owner
Revision ID: 20087beff9ea
Revises: 2dc72d16c188
Create Date: 2014-03-09 01:43:00.648013
"""
# revision identifiers, used by Alembic.
revision = '20087beff9ea'
down_revision = '2dc72d16c188'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated ... | apache-2.0 | Python | |
b0480b55ea19bc661091924fb21b1b9b95b54200 | Create NoDuplicateLetters-Hard.py | JLJTECH/TutorialTesting | Edabit/NoDuplicateLetters-Hard.py | Edabit/NoDuplicateLetters-Hard.py | #!/usr/bin/env python3
'''
Given a common phrase, return False if any individual word in the phrase contains duplicate letters.
Return True otherwise.
'''
def no_duplicate_letters(phrase):
val = [phrase]
nlst = ' '.join(val).split()
st = [len(i) for i in nlst]
ev = [len(set(i)) for i in nlst]
return st == ev
#A... | mit | Python | |
d62b0e231177edbd60730470c5213dbff3bfa11c | Implement the PRIVMSG and NOTICE commands | DesertBus/txircd,ElementalAlchemist/txircd,Heufneutje/txircd | txircd/modules/cmd_privmsg_notice.py | txircd/modules/cmd_privmsg_notice.py | from twisted.words.protocols import irc
from txircd.modbase import Command
class MessageCommand(object):
def __init__(self, ircd):
self.ircd = ircd
def onUse(self, cmd, user, data):
if ("targetchan" not in data or not data["targetchan"]) and ("targetuser" not in data or not data["targetuser"]):
return
if ... | bsd-3-clause | Python | |
4745a6e80b978d6310ab59c8ac3f0ce562dd7aa8 | Add module to compile with nuitka | NitorCreations/nitor-deploy-tools,NitorCreations/nitor-deploy-tools,NitorCreations/nitor-deploy-tools | n_utils/nitor-dt-load-project-env.py | n_utils/nitor-dt-load-project-env.py | from n_utils.project_util import load_project_env
load_project_env() | apache-2.0 | Python | |
68b865c120e49c8a64cdeb010893ca6e6c0de32f | Create webapp.py | sky-adams/Practice-for-DSW,sky-adams/Practice-for-DSW,sky-adams/Practice-for-DSW | webapp.py | webapp.py | from flask import Flask
app = Flask(__name__) #__name__ = "__main__" if this is the file that was run. Otherwise, it is the name of the file (ex. webapp)
@app.route("/")
def render_main():
return url_for('static', filename='home.html')
if __name__=="__main__":
app.run(debug=False, port=54321)
| mit | Python | |
a2386d80fbbff2cd3ab3814cd850a8471280dde8 | Check if user.token attribute exists | noironetworks/horizon,NeCTAR-RC/horizon,NeCTAR-RC/horizon,BiznetGIO/horizon,NeCTAR-RC/horizon,NeCTAR-RC/horizon,openstack/horizon,ChameleonCloud/horizon,ChameleonCloud/horizon,yeming233/horizon,BiznetGIO/horizon,BiznetGIO/horizon,openstack/horizon,BiznetGIO/horizon,yeming233/horizon,openstack/horizon,yeming233/horizon,... | openstack_dashboard/views.py | openstack_dashboard/views.py | # Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | # Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | apache-2.0 | Python |
256bd96aabbb4b12972e070e11bfbd95248c3f29 | add new recipe | tonibagur/kivy-ios,tonibagur/kivy-ios,kivy/kivy-ios,cbenhagen/kivy-ios,kivy/kivy-ios,cbenhagen/kivy-ios,rnixx/kivy-ios,rnixx/kivy-ios,kivy/kivy-ios | recipes/sdl2_mixer/__init__.py | recipes/sdl2_mixer/__init__.py | from toolchain import Recipe, shprint
import sh
class LibSDL2MixerRecipe(Recipe):
version = "2.0.0"
url = "http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-{version}.tar.gz"
library = "Xcode-iOS/build/Release-{arch.sdk}/libSDL2_mixer.a"
include_dir = "SDL_mixer.h"
depends = ["sdl2"]
... | mit | Python | |
0c9dcb8c23be8685bfe32a465f8e1b3023c95934 | Create manager_D3S.py | cllamb0/dosenet-raspberrypi,cllamb0/dosenet-raspberrypi,yarocoder/dosenet-raspberrypi,tybtab/dosenet-raspberrypi,yarocoder/dosenet-raspberrypi,bearing/dosenet-raspberrypi,tybtab/dosenet-raspberrypi,bearing/dosenet-raspberrypi | manager_D3S.py | manager_D3S.py | #!/usr/bin/env python
import argparse
import kromek
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--transport', '-t', dest='transport', default='any')
parser.add_argument('--interval', '-i', dest='interval', default=1)
parser.add_argument('--count', '-c', dest='count', default=0... | mit | Python | |
dc9449768dd93ec29a031b31c3a975c2db797252 | Create test_Deter_as_Server_and_Play_Audio.py | nksheridan/elephantAI,nksheridan/elephantAI | test_Deter_as_Server_and_Play_Audio.py | test_Deter_as_Server_and_Play_Audio.py | # DETER DEVICE
# this is test code for putting the deter device into server mode, and getting a message via bluetooth from the detection device, and
# then going ahead and playing scare sounds. You need to determine your MAC address. It is for the server in this case, so the MAC address
# of the deter device. You also ... | mit | Python | |
7735ea4909d30a6592b3bcbcf2752fb3fba8ebb7 | Add Depth-First Search | XeryusTC/search | dfs.py | dfs.py | # -*- coding: utf-8 -*-
import draw
import grid
import util
def dfs(g, start, goal):
return dfs_rec(g, start, goal, [start])
def dfs_rec(g, pos, goal, path):
if pos == goal:
return path
if len(path) > 50:
return None
for n in g.neighbours(*pos):
if n in path:
conti... | mit | Python | |
58d1011b2758f537a3539321bea64cf1c77f39fe | Add spider for Au Bon Pain; closes #783 | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/aubonpain.py | locations/spiders/aubonpain.py | import scrapy
import re
import json
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
class AuBonPainSpider(scrapy.Spider):
name = "aubonpain"
download_delay = 0.5
allowed_domains = [
"www.aubonpain.com",
]
start_urls = (
'https://www.aubonpain.c... | mit | Python | |
ab7006cd6a174273c026fda15e3471b9571ed0a6 | Add some simple tests | remik/django-page-cms,akaihola/django-page-cms,remik/django-page-cms,remik/django-page-cms,pombredanne/django-page-cms-1,oliciv/django-page-cms,pombredanne/django-page-cms-1,remik/django-page-cms,akaihola/django-page-cms,pombredanne/django-page-cms-1,akaihola/django-page-cms,oliciv/django-page-cms,batiste/django-page-c... | pages/tests.py | pages/tests.py | from django.test import TestCase
from pages.models import *
class PagesTestCase(TestCase):
fixtures = ['tests']
def test_01_managers(self):
"""Check the managers"""
pages = Page.published.all()
for p in pages:
self.assertEqual(p.status, 1)
pages = Page.drafts.all()
... | bsd-3-clause | Python | |
414c0a799f7fa1441150d6caae8447a135b9443a | Create sentiment-analysis.py | COMP90024CloudComputing/TwitterHarvest,COMP90024CloudComputing/TwitterHarvest,COMP90024CloudComputing/TwitterHarvest | data-analysis/sentiment-Google-API/sentiment-analysis.py | data-analysis/sentiment-Google-API/sentiment-analysis.py | import couchdb
from google.cloud import language
language_client = language.Client()
try:
couch = couchdb.Server('http://localhost:15984/')
print("Connect to local db")
except:
print ("Cannot find CouchDB Server ... Exiting\n")
print ("----_Stack Trace_-----\n")
raise
db = couch['ten']
print ("Con... | apache-2.0 | Python | |
2859ca788a07338d5bf22a697669358e1f027382 | Add dataset_generation. | ProjetPP/PPP-QuestionParsing-ML-Standalone,ProjetPP/PPP-QuestionParsing-ML-Standalone | dataset_generation.py | dataset_generation.py | import itertools
person = [
"Obama",
"Barack Obama",
"Barack Hussein Obama",
"Lennon",
"John Lennon",
"Saint-Exupéry",
"Antoine de Saint-Exupéry",
"Antoine Marie Jean-Baptiste Roger de Saint-Exupéry"
]
country = [
"United States",
"United States of America",
"USA",
"US"... | mit | Python | |
0781d105e4182bdd8abf1a8c7185311a48273c28 | Add imgadm beacons for SmartOS | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/beacons/smartos_imgadm.py | salt/beacons/smartos_imgadm.py | # -*- coding: utf-8 -*-
'''
Beacon that fires events on image import/delete.
.. code-block:: yaml
## minimal
# - check for new images every 1 second (salt default)
# - does not send events at startup
beacons:
imgadm: []
## standard
# - check for new images every 60 seconds
# - send ... | apache-2.0 | Python | |
8b63dc73b4e3303d1b86faf42f635f3ce01e9da4 | Create helper script providing multiprocessing support. | kubkon/des-in-python | run.py | run.py | #!/usr/bin/env python
# encoding: utf-8
import argparse
import subprocess as sub
### Parse command line arguments
parser = argparse.ArgumentParser(description="M/M/1 queue simulation -- Helper script")
parser.add_argument('reps', metavar='repetitions',
type=int, help='number of repetitions')
pars... | mit | Python | |
401b98d0f3834eebc71342746beb8ce28a73d75f | Add check for AddToHueAndSaturation | aleju/imgaug,aleju/ImageAugmenter,aleju/imgaug | checks/check_add_to_hue_and_saturation.py | checks/check_add_to_hue_and_saturation.py | from __future__ import print_function, division
import imgaug as ia
from imgaug import augmenters as iaa
import numpy as np
from skimage import data
import cv2
from itertools import cycle
VAL_PER_STEP = 1
TIME_PER_STEP = 10
def main():
image = data.astronaut()
cv2.namedWindow("aug", cv2.WINDOW_NORMAL)
c... | mit | Python | |
e0c82bec30568eb845c71fb0335d6ac5edef18e9 | Add migration that had conflict from merge with master | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/translations/migrations/0002_transifexblacklist.py | corehq/apps/translations/migrations/0002_transifexblacklist.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-01-09 19:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('translations', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | bsd-3-clause | Python | |
09a2a2aac94c4ab2a47161d32d77218d18eb6c75 | add queue for data pre_processing using multi-thread | xiaotaw/chembl | dnn_model/pk_queue.py | dnn_model/pk_queue.py | import time
import Queue
import threading
import pk_input as pki
target_list = ["cdk2", "egfr_erbB1", "gsk3b", "hgfr", "map_k_p38a", "tpk_lck", "tpk_src", "vegfr2"]
target = target_list[0]
d = pki.Datasets(target_list)
# using queue
# producer thread
class Producer(threading.Thread):
def __init__(self, t_name... | apache-2.0 | Python | |
6aeab650a43235a463cf9ff8c55b4cd22e6866c7 | Add mapping code | miyyer/qb,miyyer/qb,Pinafore/qb,miyyer/qb,Pinafore/qb,miyyer/qb | qanta/ingestion/annotated_mapping.py | qanta/ingestion/annotated_mapping.py | from unidecode import unidecode
from collections import defaultdict, Counter
import string
import re
PUNCTUATION = string.punctuation
PAREN = re.compile(r'\([^)]*\)')
BRACKET = re.compile(r'\[[^)]*\]')
MULT_SPACE = re.compile(r'\s+')
ANGLE = re.compile(r'<[^>]*>')
def split_and_remove_punc(text):
for i in text.s... | mit | Python | |
28ccfa6f1a2cd58907105afd4844c865191d423d | Add a `more_tearDown` method to MpiTestCase. | RaoUmer/distarray,enthought/distarray,enthought/distarray,RaoUmer/distarray | distarray/testing.py | distarray/testing.py | import unittest
import importlib
import tempfile
import os
from uuid import uuid4
from functools import wraps
from distarray.error import InvalidCommSizeError
from distarray.mpiutils import MPI, create_comm_of_size
def temp_filepath(extension=''):
"""Return a random 8-character filename."""
tempdir = tempfil... | import unittest
import importlib
import tempfile
import os
from uuid import uuid4
from functools import wraps
from distarray.error import InvalidCommSizeError
from distarray.mpiutils import MPI, create_comm_of_size
def temp_filepath(extension=''):
"""Return a random 8-character filename."""
tempdir = tempfil... | bsd-3-clause | Python |
b3df89c93a5d924b83d0dba6d83dd92fe2331f7c | Implementa a classe Agendamento conforme diagrama de classes | ESEGroup/Paraguai,ESEGroup/Paraguai,ESEGroup/Paraguai | domain/Agendamento.py | domain/Agendamento.py | from domain import IntervaloDeTempo
class Agendamento():
def __init__(self, intervalo, IDUsuario = None):
self.intervalo = intervalo
self.responsavel = IDUsuario
| apache-2.0 | Python | |
b41b6998dc14920193f22399804552209f7adcab | add migration script | binoculars/osf.io,baylee-d/osf.io,felliott/osf.io,felliott/osf.io,CenterForOpenScience/osf.io,HalcyonChimera/osf.io,binoculars/osf.io,CenterForOpenScience/osf.io,felliott/osf.io,sloria/osf.io,adlius/osf.io,CenterForOpenScience/osf.io,chennan47/osf.io,aaxelb/osf.io,sloria/osf.io,mattclark/osf.io,baylee-d/osf.io,mfraezz/... | osf/migrations/0078_ensure_schemas.py | osf/migrations/0078_ensure_schemas.py | from __future__ import unicode_literals
import logging
from django.db import migrations
from osf.utils.migrations import ensure_schemas, remove_schemas
logger = logging.getLogger(__file__)
class Migration(migrations.Migration):
dependencies = [
('osf', '0077_add_maintenance_permissions'),
]
... | apache-2.0 | Python | |
3037d356552634bc5d67568e97a9d7aedceb0fdf | Add description to email for non pyvideo events. | xfxf/veyepar,EricSchles/veyepar,CarlFK/veyepar,xfxf/veyepar,yoe/veyepar,CarlFK/veyepar,EricSchles/veyepar,EricSchles/veyepar,yoe/veyepar,yoe/veyepar,CarlFK/veyepar,CarlFK/veyepar,xfxf/veyepar,xfxf/veyepar,yoe/veyepar,yoe/veyepar,EricSchles/veyepar,CarlFK/veyepar,xfxf/veyepar,EricSchles/veyepar | dj/scripts/email_title.py | dj/scripts/email_title.py | #!/usr/bin/python
# email_url.py
# emails the video URL to the presenters
from django.core.mail import get_connection, EmailMessage
from django.template import Context, Template
from process import process
from email_ab import email_ab
# from django.conf import settings
class email_title(email_ab):
ready_stat... | #!/usr/bin/python
# email_url.py
# emails the video URL to the presenters
from django.core.mail import get_connection, EmailMessage
from django.template import Context, Template
from process import process
from email_ab import email_ab
# from django.conf import settings
class email_title(email_ab):
ready_stat... | mit | Python |
c98ff54d2888a0fdaa6634d065876d4cf5514b65 | Add compat file | scaramallion/pynetdicom3,scaramallion/pynetdicom3,scaramallion/pynetdicom,scaramallion/pynetdicom | pynetdicom3/compatibility.py | pynetdicom3/compatibility.py | """Compatibility module for python2.7/python3."""
import sys
IN_PYTHON2 = sys.version_info[0] == 2
if IN_PYTHON2:
import Queue as queue
else:
import queue
| mit | Python | |
5be91f4e7b3607090e94fbf221628a359063823d | Use indexed text with sqlite | PDOK/data.labs.pdok.nl,PDOK/data.labs.pdok.nl,PDOK/data.labs.pdok.nl,PDOK/data.labs.pdok.nl,PDOK/data.labs.pdok.nl | data/bag-brk/create_db.py | data/bag-brk/create_db.py | import csv
import sqlite3
conn = sqlite3.connect('processed-lines.db')
c = conn.cursor()
# c.execute('CREATE TABLE processed (cadastral_designation text, bag_pand_id text, match_type text, parcel_uri text, '
# 'dummy text, mother_parcel_match text, parcel_error text, timestamp timestamp default CURRENT_TIMES... | mit | Python | |
8279485c7c29453bea744ad137bb38552ac83bdb | Create master_script.py | muhdamrullah/air-auth,muhdamrullah/air-auth,muhdamrullah/air-auth | scripts/hello_again/master_script.py | scripts/hello_again/master_script.py | import subprocess
import os
FNULL = open(os.devnull, 'w')
subprocess.Popen('python live_stream.py', shell=True, stdout=FNULL, stderr=subprocess.STDOUT)
subprocess.Popen('python processed_stream.py', shell=True, stdout=FNULL, stderr=subprocess.STDOUT)
subprocess.Popen('python database_lookup.py', shell=True, stdout=FNU... | mit | Python | |
149631d1ad2733792feedf24d67575159289025c | set MOCK_FORENSIC_AUTH default to False | TeamHG-Memex/Datawake,Sotera/datawake-prefetch,Sotera/datawake-prefetch,Sotera/Datawake-Legacy,diffeo/Datawake,Sotera/Datawake-Legacy,Sotera/datawake-prefetch,TeamHG-Memex/Datawake,Sotera/Datawake-Legacy,Sotera/Datawake-Legacy,Sotera/datawake-prefetch,Sotera/Datawake-Legacy,TeamHG-Memex/Datawake,diffeo/Datawake,diffeo/... | forensic/session.py | forensic/session.py | """
Copyright 2014 Sotera Defense Solutions, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writ... | """
Copyright 2014 Sotera Defense Solutions, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writ... | apache-2.0 | Python |
7e5800d46d8dd49b421b3cdcd12701f64da994c3 | Add script for testing performance. | tkelman/utf8rewind,tkelman/utf8rewind,tkelman/utf8rewind,tkelman/utf8rewind | performance.py | performance.py | import argparse
import os.path
import re
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Runs combinations of performance tests.')
parser.add_argument(
'--config',
dest = 'config',
default = '',
help = 'Override configuration to <Platform>_<Configuration>, i.e. x64_Debug.'
... | mit | Python | |
1440023d9a46b5abc0fe9e3a713d437185478102 | Create chucknorris.py | THEMVFFINMAN/PyttleShip,THEMVFFINMAN/Python-Games | Codingame.com/chucknorris.py | Codingame.com/chucknorris.py | import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
message = input()
binaries = []
for ch in message:
binaries.append(bin(ord(ch))[2:].zfill(7))
stringer = ""
zero = False
one = False
for binary in binaries:
for char in bina... | mit | Python | |
2edb50db002e773b66eb1f824894ee362846f86e | add example using 2 env vars | AlanCoding/Ansible-inventory-file-examples,AlanCoding/Ansible-inventory-file-examples | scripts/environment/dual_env_vars.py | scripts/environment/dual_env_vars.py | #!/usr/bin/env python
from argparse import ArgumentParser
from datetime import datetime
import os
inventory = {
'all': {'vars': {'ansible_connection': 'local'}},
'ungrouped': {'hosts': ['localhost']},
'_meta': {'hostvars': {'localhost': {
'test_env': os.environ.get('TEST_ENV', False),
'test... | mit | Python | |
20cc61dd008fa4c1ced0d4726baaeba78d0d1f05 | Update get_posts example script for Python 3. | Aloomaio/facebook-sdk,mobolic/facebook-sdk | examples/get_posts.py | examples/get_posts.py | """
A simple example script to get all posts on a user's timeline.
Originally created by Mitchell Stewart.
<https://gist.github.com/mylsb/10294040>
"""
import facebook
import requests
def some_action(post):
""" Here you might want to do something with each post. E.g. grab the
post's message (post['message']) ... | """
A simple example script to get all posts on a user's timeline.
Originally created by Mitchell Stewart.
<https://gist.github.com/mylsb/10294040>
"""
import facebook
import requests
def some_action(post):
""" Here you might want to do something with each post. E.g. grab the
post's message (post['message']) ... | apache-2.0 | Python |
6a968d47a3605a4ce0af486b7777497749b4fac6 | Add tests for deleted notification objects | j0gurt/ggrc-core,kr41/ggrc-core,plamut/ggrc-core,edofic/ggrc-core,VinnieJohns/ggrc-core,prasannav7/ggrc-core,uskudnik/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,vladan-m/ggrc-core,AleksNeStu/ggrc-core,vladan-m/ggrc-core,kr41/ggrc-core,jmakov/ggrc-core,edofic/ggrc-core,hyperNURb/ggrc-core,kr41/ggrc-core,uskudnik/... | src/tests/ggrc_workflows/notifications/test_deleted_objects.py | src/tests/ggrc_workflows/notifications/test_deleted_objects.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
import random
from tests.ggrc import TestCase
from freezegun import freeze_time
... | apache-2.0 | Python | |
134dbd68cc4630442f1dddb9426207de93c1498b | Add a missing migration for Course.solution_visibility description | matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,matijapretnar/projekt-tomo,ul-fmf/projekt-tomo,ul-fmf/projekt-tomo | web/courses/migrations/0005_update_solution_visibility_text.py | web/courses/migrations/0005_update_solution_visibility_text.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('courses', '0004_course_institution'),
]
operations = [
migrations.AlterField(
model_name='problemset',
... | agpl-3.0 | Python | |
fe5fa8bcde6c98e8dd66cf6190544d4ccf86175e | Add settings file for demo deployments | vladan-m/ggrc-core,jmakov/ggrc-core,j0gurt/ggrc-core,j0gurt/ggrc-core,AleksNeStu/ggrc-core,hyperNURb/ggrc-core,vladan-m/ggrc-core,hyperNURb/ggrc-core,NejcZupec/ggrc-core,hyperNURb/ggrc-core,selahssea/ggrc-core,vladan-m/ggrc-core,plamut/ggrc-core,NejcZupec/ggrc-core,uskudnik/ggrc-core,AleksNeStu/ggrc-core,andrei-karalio... | src/ggrc/settings/app_engine_demo.py | src/ggrc/settings/app_engine_demo.py | from app_engine import *
COMPANY = "Reciprocity, Inc."
COMPANY_LOGO_TEXT = "Demo gGRC Implementation"
| apache-2.0 | Python | |
8e54894906f8a67607deb1d81d42eb2a92fafe2e | add rabbit test code | jasonrbriggs/stomp.py,jasonrbriggs/stomp.py | rabbit-test.py | rabbit-test.py | import time
import sys
import stomp
class MyListener(object):
def on_error(self, headers, message):
print 'received an error %s' % message
def on_connecting(self, host_and_port):
print host_and_port
def on_message(self, headers, message):
print 'received a message %s' % m... | apache-2.0 | Python | |
880d797a6e1f4e3a9182c647c0530976c1a65fc2 | Add FIWARE Doc Style | Fiware/apps.WMarket,conwetlab/WMarket,Fiware/apps.WMarket,conwetlab/WMarket,Fiware/apps.WMarket,conwetlab/WMarket,Fiware/apps.WMarket,conwetlab/WMarket | doc/conf.py | doc/conf.py | # -*- coding: utf-8 -*-
import os
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
extensions = []
templates_path = ['/home/docs/checkouts/readthedocs.org/readthedocs/templates/sphinx', 'templates', '_templates', '.templates']
source_suffix = ['.rst', '.md']
master_doc = 'index'
project = u'WMarket'
copyrigh... | bsd-3-clause | Python | |
1b5a6458c526a9789fab5d08fbbc5cece60f3b62 | add bootstrap file | thomvil/elm-init-scripts,NoRedInk/elm-init-scripts | bootstrap.py | bootstrap.py |
def main():
parser = argparse.ArgumentParser(description='Initialize an Elm page')
parser.add_argument('module_name')
parser.add_argument('destination')
args = parser.parse_args()
bootstrap(args.module_name, args.destination)
if __name__ == '__main__':
main()
| bsd-3-clause | Python | |
8054aa12d4d38b6600750527ed8552058ac216cd | Add 'choose/' from commit '7515ded12265f841375b584cb5da6601cf822a4f' | eddieantonio/big-practice-repo,eddieantonio/big-practice-repo,eddieantonio/big-practice-repo,eddieantonio/big-practice-repo,eddieantonio/big-practice-repo,eddieantonio/big-practice-repo,eddieantonio/big-practice-repo | choose/choose.py | choose/choose.py | #!/usr/bin/env python
# Copyright (C) 2016 Eddie Antonio Santos <easantos@ualberta.ca>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your op... | agpl-3.0 | Python | |
bf6e9fd75b4d7d7d7f4c225ba6684e895b79160e | add sign up script | JamisHoo/Yagra,JamisHoo/Yagra | cgi-bin/signup.py | cgi-bin/signup.py | #!/usr/bin/env python
from __future__ import print_function
from common import populate_html
import os
import hashlib
import cgi
import MySQLdb
import smtplib
def process_input():
# Load email and password
form = cgi.FieldStorage()
email = form.getfirst("email")
password = form.getfirst("password"... | mit | Python | |
64fce7c67849f44492d55ccf8a745b252bf1368b | Add some tests for polynomial printing. | jakirkham/numpy,bertrand-l/numpy,githubmlai/numpy,SiccarPoint/numpy,jorisvandenbossche/numpy,ChristopherHogan/numpy,GrimDerp/numpy,simongibbons/numpy,pizzathief/numpy,ahaldane/numpy,argriffing/numpy,sigma-random/numpy,kirillzhuravlev/numpy,MSeifert04/numpy,NextThought/pypy-numpy,matthew-brett/numpy,astrofrog/numpy,ogri... | numpy/polynomial/tests/test_printing.py | numpy/polynomial/tests/test_printing.py | import numpy.polynomial as poly
from numpy.testing import TestCase, run_module_suite, assert_
class test_str(TestCase):
def test_polynomial_str(self):
res = str(poly.Polynomial([0,1]))
tgt = 'poly([0., 1.])'
assert_(res, tgt)
def test_chebyshev_str(self):
res = str(poly.Chebys... | bsd-3-clause | Python | |
96fa9dd03ec6a97f6b99c1556f84b0b50824ee53 | Create keyexpansion.py | deekshadangwal/PyRTL,nvandervoort/PyRTL,UCSBarchlab/PyRTL,UCSBarchlab/PyRTL,nvandervoort/PyRTL,deekshadangwal/PyRTL | research/aes/keyexpansion.py | research/aes/keyexpansion.py | import sys
sys.path.append("../..")
import pyrtl
from pyrtl import *
import func_g
from func_g import *
def KeyExpansion(in_vector):
""" KeyExpansion round of AES.
Input: 16-byte key.
Output: 176-byte expanded key.
"""
w0 = in_vector[96:128]
w1 = in_vector[64:96]
w2 = in_vector[32:64]
w3 = in_vector[0:32]... | bsd-3-clause | Python | |
d251a2b2cd449ed5078b41b09f50003786f3bbde | Create script to pad and trim fastq reads to one length | alliemacleay/misc | seq_pad.py | seq_pad.py | #!/usr/bin/python
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__author__= 'Allison MacLeay'
import sys
import os
import argparse
import glob
import gzip
#-----------------------------------------
# MAIN
# run umitag.py for all files in a directo... | mit | Python | |
19e3cd7256d5eb25eee8597f82bb2dd3fc019f03 | add a low-level random kick agent | LARG/HFO,mhauskn/HFO,mhauskn/HFO,mhauskn/HFO,LARG/HFO,LARG/HFO | example/low_level_random_kick_agent.py | example/low_level_random_kick_agent.py | #!/usr/bin/env python3
# encoding: utf-8
from hfo import *
import argparse
import numpy as np
import math as m
import sys, os
import itertools
def rad_to_deg(rad):
return rad/m.pi*180
def sign(x):
return (int(x>=0)-0.5)*2
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--po... | mit | Python | |
5eae0b790fb84ec77bc1f7a28706eecb9f25ef1f | Add another specific script | moschlar/SAUCE,moschlar/SAUCE,moschlar/SAUCE,moschlar/SAUCE | sauce/bin/add_dummy_users.py | sauce/bin/add_dummy_users.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Add new users by CSV file
@author: moschlar
"""
#
## SAUCE - System for AUtomated Code Evaluation
## Copyright (C) 2013 Moritz Schlarb
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Public Licen... | agpl-3.0 | Python | |
0095e75ce94b3181d56f7783110cadd3d9730577 | add version 0.0.1 for initialize | ray-g/FormulaCooker | __init__.py | __init__.py | from __future__ import absolute_import
__version__ = '0.0.1' | mit | Python | |
d25af87006ac21f55706c3a5579aec3c961b88e8 | Add script to download data from MDCS | wd15/sem-image-stats | download_mdcs_data.py | download_mdcs_data.py | """Fetch images from MDCS.
"""
import json
import requests
import xmltodict
def download_mdcs_data():
user = "dwheeler"
password = "12345"
mdcs_url = "http://129.6.153.123:8000"
schema_title = 'SemImage'
url = mdcs_url + "/rest/templates/select/all"
allSchemas = json.loads(requests.get(url, ... | mit | Python | |
3e73bbb51c7b5b214dc2c79e5a1cb8b00f243855 | Fix tests | qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/locations/tests/test_location_fixtures.py | corehq/apps/locations/tests/test_location_fixtures.py | from django.test import SimpleTestCase
from corehq.apps.locations.models import SQLLocation, LocationType
from ..fixtures import _location_to_fixture, _location_footprint
class LocationFixturesTest(SimpleTestCase):
def test_metadata(self):
state = LocationType(
domain="test-domain",
... | from django.test import SimpleTestCase
from corehq.apps.locations.models import Location
from ..fixtures import _location_to_fixture, _location_footprint
class LocationFixturesTest(SimpleTestCase):
def test_metadata(self):
location = Location(
_id="unique-id",
domain="test-domain"... | bsd-3-clause | Python |
ae0ef3a709e22774cf98f4c3010b66fb1be172bc | add class Datapoint | Isotop7/pyrtemonnaie | Datapoint.py | Datapoint.py | import re
from datetime import date
class Datapoint:
def __init__(self, recipient, s_date="01.01.1970", value=0.0, comment=""):
self.__Recipient = recipient
self.__Date = s_date
self.__Value = value
self.__Comment = comment
def get_recipient(self):
return self.__Recipie... | mit | Python | |
f6637b7fe03e9d72b8053972c444840921b84d6e | Add a registry that keeps track of tag->renderer/input mappings | motion2015/edx-platform,BehavioralInsightsTeam/edx-platform,hkawasaki/kawasaki-aio8-2,ferabra/edx-platform,halvertoluke/edx-platform,Stanford-Online/edx-platform,tanmaykm/edx-platform,cecep-edu/edx-platform,atsolakid/edx-platform,leansoft/edx-platform,ahmadiga/min_edx,edx/edx-platform,jazkarta/edx-platform-for-isc,jrui... | common/lib/capa/capa/registry.py | common/lib/capa/capa/registry.py | class TagRegistry(object):
"""
A registry mapping tags to handlers.
(A dictionary with some extra error checking.)
"""
def __init__(self):
self._mapping = {}
def register(self, cls):
"""
Register cls as a supported tag type. It is expected to define cls.tags as a list ... | agpl-3.0 | Python | |
6b6adc4dd4441f47f8d4e45a5f8473dbdfec275d | Move get_packs_base_path and get_pack_base_path to utils in st2common. | pinterb/st2,emedvedev/st2,Plexxi/st2,tonybaloney/st2,pixelrebel/st2,tonybaloney/st2,pixelrebel/st2,punalpatel/st2,pinterb/st2,emedvedev/st2,StackStorm/st2,nzlosh/st2,StackStorm/st2,armab/st2,lakshmi-kannan/st2,Plexxi/st2,jtopjian/st2,Plexxi/st2,punalpatel/st2,pixelrebel/st2,alfasin/st2,dennybaa/st2,emedvedev/st2,nzlosh... | st2common/st2common/content/utils.py | st2common/st2common/content/utils.py | import os
import pipes
from oslo.config import cfg
__all__ = [
'get_packs_base_path',
'get_pack_base_path'
]
def get_packs_base_path():
return cfg.CONF.content.packs_base_path
def get_pack_base_path(pack_name):
"""
Return full absolute base path to the content pack directory.
:param pack_... | apache-2.0 | Python | |
effc03fbc0646b875e7cd586b04024dbdd12f806 | Create b.py | y-sira/atcoder,y-sira/atcoder | agc015/b.py | agc015/b.py | def main():
floors = input()
count = 0
for i in range(len(floors)):
if floors[i] == 'U':
count += (len(floors) - (i + 1)) + 2 * i
else:
count += 2 * (len(floors) - (i + 1)) + i
print(count)
if __name__ == '__main__':
main()
| mit | Python | |
b35e780364ca2d06902302b165ce2261ec6795a1 | Add tests for getting all toilets | praekelt/go-imali-yethu-js,praekelt/go-imali-yethu-js,praekelt/go-imali-yethu-js | ona_migration_script/test_migrate_toilet_codes.py | ona_migration_script/test_migrate_toilet_codes.py | import json
import requests
from requests_testadapter import TestAdapter
import unittest
import migrate_toilet_codes
class TestCreateSession(unittest.TestCase):
def test_create_session(self):
username = 'testuser'
password = 'testpass'
s = migrate_toilet_codes.create_session(username, pas... | bsd-3-clause | Python | |
9826ccce540a945a8cb8bb788a8f993aa5aae553 | update stock reco permission | saurabh6790/medapp,susuchina/ERPNEXT,treejames/erpnext,hatwar/Das_erpnext,saurabh6790/medapp,tmimori/erpnext,gangadhar-kadam/latestchurcherp,mbauskar/omnitech-erpnext,rohitwaghchaure/GenieManager-erpnext,gangadhar-kadam/verve-erp,geekroot/erpnext,saurabh6790/test-med-app,Tejal011089/fbd_erpnext,indictranstech/tele-erpn... | erpnext/patches/jan_mar_2012/update_stockreco_perm.py | erpnext/patches/jan_mar_2012/update_stockreco_perm.py | def execute():
import webnotes
webnotes.conn.sql("update `tabDocPerm` set cancel = 1 where parent = 'Stock Reconciliation' and ifnull(submit, 0) = 1")
| agpl-3.0 | Python | |
95ff3a585af98df894e5032da9e0e38622a3d9a9 | Add template field | Net-ng/kansha,bcroq/kansha,Net-ng/kansha,bcroq/kansha,Net-ng/kansha,bcroq/kansha,bcroq/kansha,Net-ng/kansha | kansha/alembic/versions/2b0edcfa57b4_add_templates.py | kansha/alembic/versions/2b0edcfa57b4_add_templates.py | """Add templates
Revision ID: 2b0edcfa57b4
Revises: 24be36b8c67
Create Date: 2015-11-24 17:50:13.280722
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '2b0edcfa57b4'
down_revision = '24be36b8c67'
def upgrade():
op.add_column('board', sa.Column('is_templa... | bsd-3-clause | Python | |
b07f482c0cdc827b0b8d73bd920d9d302d006a91 | Test case for contact references (#15077) | gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext | erpnext/tests/test_search.py | erpnext/tests/test_search.py | from __future__ import unicode_literals
import unittest
import frappe
from frappe.contacts.address_and_contact import filter_dynamic_link_doctypes
class TestSearch(unittest.TestCase):
#Search for the word "clie", part of the word "client" (customer) in french.
def test_contact_search_in_foreign_language(self):
fra... | agpl-3.0 | Python | |
2539e398eccf6134ccdb0c608513c3c5812654b5 | Create File2Txt.py | HeyItsJono/Pythonista | File2Txt.py | File2Txt.py | from console import clear
from console import hud_alert
from os import remove
def drop_extension(filename):
dictionary = dict(enumerate(filename, start = 1))
try:
assert '.' in dictionary.values()
except AssertionError:
return filename
for (k, v) in dictionary.iteritems():
if v == '.':
return filename[:k-... | mit | Python | |
74c89b9fd6ac8f9d32192c0c0fbd5851230538e0 | add a script to run sandman. sandman can be used to edit te sqlite database through a browser. | berz/lossebladjes,berz/lossebladjes,berz/lossebladjes | sandman_run.py | sandman_run.py | #!venv/bin/python
from sandman import app
from sandman.model import activate
from losseblaadjes import app as lossebladjes_app
app.config['SQLALCHEMY_DATABASE_URI'] = lossebladjes_app.config['SQLALCHEMY_DATABASE_URI']
activate()
app.run()
| bsd-3-clause | Python | |
0df8ce131c5ed07b032060d9f460a328324c9974 | add simplistic google docs exporter | zeha/assorted,zeha/assorted,zeha/assorted | google-export/exporter.py | google-export/exporter.py | import gdata.docs.service
import gdata.spreadsheet.service
app_name = 'at.zeha.google-export-v0-github'
login_u = 'username@example.org'
login_p = 'password'
export_folder = '/home/username/google-export/data/'
gd_client = gdata.docs.service.DocsService(source=app_name)
gd_client.ClientLogin(login_u, login_p)
gs_cl... | mit | Python | |
7320e6fd38babe5b7c2d5fbb5121d5845c57bb05 | Add problem75.py | mjwestcott/projecteuler,mjwestcott/projecteuler,mjwestcott/projecteuler | euler_python/problem75.py | euler_python/problem75.py | """
problem75.py
It turns out that 12 cm is the smallest length of wire that can be bent to form
an integer sided right angle triangle in exactly one way, but there are many
more examples.
12 cm: (3,4,5)
24 cm: (6,8,10)
30 cm: (5,12,13)
36 cm: (9,12,15)
40 cm: (8,15,17)
48 cm: (12,16,20)
In c... | mit | Python | |
c7efac00035589f271b2c591489f3b32cabcc6e5 | Add very basic example. | craig552uk/flask-json | examples/example1.py | examples/example1.py | from datetime import datetime
from flask import Flask
from flask_json import FlaskJSON, JsonErrorResponse, json_response
app = Flask(__name__)
FlaskJSON(app)
@app.route('/get_time')
def get_time():
return json_response(time=datetime.utcnow())
@app.route('/raise_error')
def raise_error():
raise JsonErrorRes... | bsd-3-clause | Python | |
ff9ebfb2698c40da5af383b0e620191f4a893e7b | add skitai_pingpong_handler | hansroh/skitai,hansroh/skitai,hansroh/skitai | skitai/tools/benchmark/skitai_pingpong_handler.py | skitai/tools/benchmark/skitai_pingpong_handler.py | """
This module is copy of skitai.handler.pingpong_handler.py.
It's not actually used by skitai, but for just your reference
"""
from . import ssgi_handler
class Handler (ssgi_handler.Handler):
def __init__(self, wasc):
self.wasc = wasc
def match (self, request):
return request.split_uri() [0] == "/ping"
... | mit | Python | |
5cae22b665c250935d7a0c3fdd0e583beff08500 | add nofollow to Link object | Partoo/scrapy,liyy7/scrapy,cyberplant/scrapy,kmike/scrapy,nfunato/scrapy,Digenis/scrapy,Allianzcortex/scrapy,zhangtao11/scrapy,JacobStevenR/scrapy,rahulsharma1991/scrapy,amboxer21/scrapy,github-account-because-they-want-it/scrapy,Timeship/scrapy,elijah513/scrapy,ylcolala/scrapy,jdemaeyer/scrapy,amboxer21/scrapy,xiao26/... | scrapy/link.py | scrapy/link.py | """
This module defines the Link object used in Link extractors.
For actual link extractors implementation see scrapy.contrib.linkextractor, or
its documentation in: docs/topics/link-extractors.rst
"""
class Link(object):
"""Link objects represent an extracted link by the LinkExtractor.
At the moment, it cont... | """
This module defines the Link object used in Link extractors.
For actual link extractors implementation see scrapy.contrib.linkextractor, or
its documentation in: docs/topics/link-extractors.rst
"""
class Link(object):
"""Link objects represent an extracted link by the LinkExtractor.
At the moment, it cont... | bsd-3-clause | Python |
2f180a089450da5241836a1c6dc77f5116a5418d | Add c4_check_move | davidrobles/mlnd-capstone-code | examples/c4_check_move.py | examples/c4_check_move.py | from keras.models import load_model
from capstone.game.games import Connect4 as C4
from capstone.game.players import AlphaBeta, GreedyQ, RandPlayer
from capstone.rl.value_functions import QNetwork
from capstone.game.utils import play_match
board = [[' ', ' ', ' ', ' ', ' ', ' ', ' '], # 6
[' ', ' ', ' ', ' ',... | mit | Python | |
bfbec3452bb518f9bd674a3782a56e45ee2e18da | Add quotes example | tjguk/networkzero,tjguk/networkzero,tjguk/networkzero | examples/quotes/quotes.py | examples/quotes/quotes.py | import sys
print(sys.version_info)
import random
import time
import networkzero as nw0
quotes = [
"Humpty Dumpty sat on a wall",
"Hickory Dickory Dock",
"Baa Baa Black Sheep",
"Old King Cole was a merry old sould",
]
my_name = input("Name: ")
nw0.advertise(my_name)
while True:
services = [(name,... | mit | Python | |
9018954189a6556e6038d01e0766a336d62a91fd | Add __init__.py | lord63/choosealicense-cli | choosealicense/__init__.py | choosealicense/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
choosealicense-cli
~~~~~
Bring http://choosealicense.com to your terminal.
:copyright: (c) 2015 by lord63.
:license: MIT, see LICENSE for more details.
"""
__title__ = "choosealicense-cli"
__version__ = '0.1.0'
__author__ = "lord63"
__license__ ... | mit | Python | |
8d45b85a5726db2cc3038adae2fc2f609c35ed63 | Create analyzer.py | zbigniewz/jenkins-build-failure-analyzer,ZbigniewZabost/jenkins-build-failure-analyzer,zbigniewz/jenkins-build-failure-analyzer,ZbigniewZabost/jenkins-build-failure-analyzer | analyzer.py | analyzer.py | #!/usr/bin/python
import pprint
import re
import argparse
from datetime import datetime
from statsd import StatsClient
from utils import failureReasons, JenkinsClient
def is_build_failed(job):
if job['lastBuild']:
if job['lastBuild']['result'] == 'FAILURE':
return True
return Fals... | apache-2.0 | Python | |
954301b5f3290a85d58d9d16a30c8c50c97e7283 | Add fuzzy match | TheBrane/sodi-data-acquisition | form_matching/fuzzy_match.py | form_matching/fuzzy_match.py | '''
Tashlin Reddy
August 2020
Fuzzy Match strings in Columns of CSV file
'''
#read in dependencies
import pandas as pd
import numpy as np
from fuzzywuzzy import fuzz
#read in csv form
form = pd.read_csv('form.csv')
#form = pd.read_csv('https...')
#iterate over each column and check if there is a list to fuz... | mit | Python | |
b7406691eed7308d7dd4336326c896e22d16d768 | add coins model with save fig in the right spot | probml/pyprobml,probml/pyprobml,probml/pyprobml,probml/pyprobml | book/coins_model_sel_demo.py | book/coins_model_sel_demo.py | import numpy as np
from pyprobml_utils import save_fig
import matplotlib.pyplot as plt
from scipy.special import betaln
theta = 0.7
N = 5
alpha = 1
alphaH = alpha
alphaT = alpha
# instantiate a number of datastructures
flips = np.zeros((2**N, N))
Nh = np.zeros(2**N)
Nt = np.zeros(2**N)
marginal_lik = np.zeros(2**N)
l... | mit | Python | |
8347613940104b77224c48e104f898ac29f0c34d | Add script to generate synthetic CPT documents | NLeSC/cptm,NLeSC/cptm | generateCPTCorpus.py | generateCPTCorpus.py | """Script that generates a (synthetic) corpus to test the CPT model.
The corpus consists of 5 documents containing fixed topics and opinions.
The generation process is described in the CPT paper.
A text document contains the topic words on the first line and the opion words
on the second line.
Usage: python generat... | apache-2.0 | Python | |
32858d93d8fcb0adf3b0da54f607fddbc29926ad | refactor customerRegister | Go-In/go-coup,Go-In/go-coup,Go-In/go-coup,Go-In/go-coup,Go-In/go-coup | usermanage/views/customerRegister.py | usermanage/views/customerRegister.py | from django.shortcuts import render, redirect
from django.http import HttpResponseRedirect
from django.contrib.auth import login, authenticate, logout
from django.contrib.auth.models import User, Group
from django.contrib.auth.decorators import login_required, user_passes_test, permission_required
from django.contrib.a... | mit | Python | |
8f6dd4e4825175b4be37bca85c466b51619c3b89 | Create list-iod-web-index.py | hpautonomy/iod-example-python-scripts,hpe-idol/iod-example-python-scripts | list-iod-web-index.py | list-iod-web-index.py | #!/usr/bin/env python
import os
import unirest
import time
import json
import pprint
import logging
import argparse
unirest.timeout(120)
IODAPIKEY = os.environ.get('IODAPIKEY')
parser = argparse.ArgumentParser(description='List IOD connectors associated with the API key')
parser.add_argument('--apikey', default=IOD... | mit | Python | |
deac3ae3b0f19adcbe612cce7fe9cfbbc2c08c5f | Update to current year | gschizas/praw,praw-dev/praw,praw-dev/praw,gschizas/praw | docs/conf.py | docs/conf.py | import os
import sys
sys.path.insert(0, "..")
from praw import __version__
copyright = "2020, Bryce Boe"
exclude_patterns = ["_build"]
extensions = ["sphinx.ext.autodoc", "sphinx.ext.intersphinx"]
html_static_path = ["_static"]
html_theme = "sphinx_rtd_theme"
html_theme_options = {"collapse_navigation": True}
htmlhe... | import os
import sys
sys.path.insert(0, "..")
from praw import __version__
copyright = "2017, Bryce Boe"
exclude_patterns = ["_build"]
extensions = ["sphinx.ext.autodoc", "sphinx.ext.intersphinx"]
html_static_path = ["_static"]
html_theme = "sphinx_rtd_theme"
html_theme_options = {"collapse_navigation": True}
htmlhe... | bsd-2-clause | Python |
2ea14af13a80b98609108f8824ff1d995b0fecfb | Create img2html.py | gauntletm/img2html | img2html.py | img2html.py | #!/usr/bin/env python
# img to html v0.2
# will convert a non-svg image to html
#
# Gauntlet O. Manatee
# spukspital@openmailbox.org
import os, sys
import Image
imgname = raw_input("Enter the path to the .png file you want to convert.\n(I recommend .png, though it is not mandatory.\n \
Other image files work, t... | apache-2.0 | Python | |
cff78bad619c7fb1e8c9067dedbf6afc38de90d5 | Create 'Python.py'. | toturkmen/baklava,toturkmen/baklava,toturkmen/baklava,toturkmen/baklava,toturkmen/baklava,toturkmen/baklava,toturkmen/baklava,toturkmen/baklava,toturkmen/baklava,toturkmen/baklava,toturkmen/baklava | P/Python.py | P/Python.py | for i in range (0, 10, 1):
print ((" " * (10 - i)) + ("*" * (i * 2 + 1)))
for i in range (10, -1, -1):
print ((" " * (10 - i)) + ("*" * (i * 2 + 1)))
raw_input () | mit | Python | |
16525e1e249d8506f605569c5d6d87b1988e890d | Create PushOver.py | KronosKoderS/py_pushover,KronosKoderS/pypushover | PushOver.py | PushOver.py | import sys
#Making compatible for Python 3 and 2.
if sys.version_info < (3, 0, 0):
import urllib
else:
import urllib2.parse as urllib
import urllib2
class Sounds(object):
Short_Pushover = 'pushover'
Short_Bike = 'bike'
Short_Bugle = 'bugle'
Short_Cash_Register = 'cashregister'
Short_Class... | mit | Python | |
d782809746cfb403358bdfb10215b70c96498264 | Introduce a live camera viewer with Qt. | microy/PyStereoVisionToolkit,microy/VisionToolkit,microy/VisionToolkit,microy/StereoVision,microy/StereoVision,microy/PyStereoVisionToolkit | QtViewer.py | QtViewer.py | #! /usr/bin/env python
# -*- coding:utf-8 -*-
#
# Qt interface to display AVT cameras
#
#
# External dependencies
#
from PyQt4 import QtGui, QtCore
#
# Window to display a camera
#
class QtViewer( QtGui.QWidget ) :
#
# Initialisation
#
def __init__( self, camera ) :
# Initialize parent class
QtGui.QWid... | mit | Python | |
70ed3c4044b425f2b679da3f0a3f33a9f7e6381a | introduce data gatherer for finding new versions of various libraries | cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo,cuckoobox/cuckoo | data/gatherer.py | data/gatherer.py | """Gatherer of software components for further identification by the Cuckoo
Sandbox team.
This file uploads as many relevant software components as possible so that the
Cuckoo Sandbox team may be able to add support for more versions of certain
software packages. E.g., currently we have special support for Office 2007... | mit | Python | |
3bf112fcd3f42716bcf7dad0561280f52fc6a31f | add django-cron suppo | DjangoAdminHackers/django-link-report,DjangoAdminHackers/django-link-report | link_report/cron.py | link_report/cron.py | # This file works with our fork of django-cron.
# It's use is optional
# Use any means you like to run scheduled jobs.
from django_cron import cronScheduler
from django_cron import Job
from django_cron import DAY
from link_report.utils import update_sentry_404s
class RunUpdateSentry404s(Job):
run_every = D... | mit | Python | |
02d7e423416ab90bdc4db6428c51efaf6f33a4c6 | Create templatetag for put a settings var into context | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/dbaas/templatetags/settings_tags.py | dbaas/dbaas/templatetags/settings_tags.py | from django import template
from django.conf import settings
register = template.Library()
@register.assignment_tag()
def setting(var_name):
"""
Get a var from settings
"""
return getattr(settings, var_name)
| bsd-3-clause | Python | |
0c329e33d9b2c0a4101791f4a5597631c61b2255 | Create __init__.py | scienceopen/glowaurora,scienceopen/glowaurora | __init__.py | __init__.py | agpl-3.0 | Python | ||
220086dd3404ad00f113751a78c5abb219d68819 | Introduce resource provider. | Met48/League-of-Legends-DB | loldb/v2/resources.py | loldb/v2/resources.py | import collections
import os
import re
import sqlite3
import raf
def _get_highest_version(versions):
versions = [(v, v.split('.')) for v in versions]
def version_converter(version):
try:
parts = map(int, version[1])
except ValueError:
return None
else:
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.