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 |
|---|---|---|---|---|---|---|---|---|
d5250790d3509dfe4cbd1f507c83a92bef9614fe | Test cache instance. | soasme/Flask-CacheOBJ,liwushuo/Flask-CacheOBJ | tests.py | tests.py | # -*- coding: utf-8 -*-
import pytest
from flask import Flask
from flask.ext.cacheobj import FlaskCacheOBJ, Msgpackable
app = Flask(__name__)
cache = FlaskCacheOBJ()
cache.init_app(app)
@pytest.fixture
def app(request):
app = Flask(__name__)
ctx = app.app_context()
ctx.push()
request.addfinalizer(c... | mit | Python | |
e87fb6fc09e70dbcd9c65d183c0addb1b290ffcf | Add test cases for Tradfri sensor platform (#64165) | nkgilley/home-assistant,GenericStudent/home-assistant,mezz64/home-assistant,rohitranjan1991/home-assistant,w1ll1am23/home-assistant,toddeye/home-assistant,rohitranjan1991/home-assistant,rohitranjan1991/home-assistant,nkgilley/home-assistant,GenericStudent/home-assistant,toddeye/home-assistant,mezz64/home-assistant,w1ll... | tests/components/tradfri/test_sensor.py | tests/components/tradfri/test_sensor.py | """Tradfri sensor platform tests."""
from unittest.mock import MagicMock, Mock
from .common import setup_integration
def mock_sensor(state_name: str, state_value: str, device_number=0):
"""Mock a tradfri sensor."""
dev_info_mock = MagicMock()
dev_info_mock.manufacturer = "manufacturer"
dev_info_mock... | apache-2.0 | Python | |
5938881e939ce5088974489a943bd7d86925732f | Add unittest for inception | jnishi/chainer,ytoyama/yans_chainer_hackathon,masia02/chainer,minhpqn/chainer,hvy/chainer,t-abe/chainer,muupan/chainer,yanweifu/chainer,anaruse/chainer,ktnyt/chainer,okuta/chainer,hvy/chainer,muupan/chainer,sinhrks/chainer,wkentaro/chainer,hvy/chainer,okuta/chainer,sinhrks/chainer,cupy/cupy,jnishi/chainer,niboshi/chain... | tests/functions_tests/test_inception.py | tests/functions_tests/test_inception.py | import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
if cuda.available:
cuda.init()
class TestInception(unittest.TestCase):
i... | mit | Python | |
92a911a53158a89f0bd7f7e989de47f1854268ff | make ogvs for just one episode | xfxf/veyepar,CarlFK/veyepar,CarlFK/veyepar,CarlFK/veyepar,yoe/veyepar,xfxf/veyepar,yoe/veyepar,yoe/veyepar,xfxf/veyepar,CarlFK/veyepar,EricSchles/veyepar,yoe/veyepar,CarlFK/veyepar,xfxf/veyepar,yoe/veyepar,EricSchles/veyepar,EricSchles/veyepar,xfxf/veyepar,EricSchles/veyepar,EricSchles/veyepar | dj/scripts/dv2ogv.py | dj/scripts/dv2ogv.py | #!/usr/bin/python
# makes .ogv for all dv in a show
import os
import subprocess
from process import process
from main.models import Client, Show, Location, Episode, Raw_File, Cut_List
class mkpreview(process):
def one_dv(self,loc_dir,dv):
print dv.filename,
src = os.path.join(loc_dir,dv.fil... | #!/usr/bin/python
# makes .ogv for all dv in a show
import os
import subprocess
from process import process
from main.models import Client, Show, Location, Episode, Raw_File, Cut_List
class mkpreview(process):
def one_dv(self,loc_dir,dv):
src = os.path.join(loc_dir,dv.filename)
dst = os.path... | mit | Python |
36756dbd6b287f8dc6d5629027a8fe75d0f4bb09 | Add Chuck Norris bot to the team | farhaanbukhsh/Telegram-Bots | NorrisIsSoFunny_bot.py | NorrisIsSoFunny_bot.py | import telegram
LAST_UPDATE_ID = None
def main():
''' This is the main function that has to be called '''
global LAST_UPDATE_ID
# Telegram Bot Authorization Token
bot = telegram.Bot('put your token here')
# This will be our global variable to keep the latest update_id when requesting
# f... | mit | Python | |
924ef1395214c2f71b96c21f41e240c88f0570a1 | Add project_security.xml file entry in update_xml section | gavin-feng/odoo,hip-odoo/odoo,SerpentCS/odoo,OpusVL/odoo,ecosoft-odoo/odoo,abstract-open-solutions/OCB,ojengwa/odoo,cloud9UG/odoo,spadae22/odoo,chiragjogi/odoo,rdeheele/odoo,fevxie/odoo,gavin-feng/odoo,jolevq/odoopub,alhashash/odoo,ramitalat/odoo,numerigraphe/odoo,apanju/GMIO_Odoo,blaggacao/OpenUpgrade,shivam1111/odoo,... | addons/project/__terp__.py | addons/project/__terp__.py | {
"name" : "Project Management",
"version": "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com/module_project.html",
"category" : "Generic Modules/Projects & Services",
"depends" : ["product", "account", 'mrp', 'sale', 'base'],
"description": "Project management module that track multi-level projects, tas... | {
"name" : "Project Management",
"version": "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com/module_project.html",
"category" : "Generic Modules/Projects & Services",
"depends" : ["product", "account", 'mrp', 'sale', 'base'],
"description": "Project management module that track multi-level projects, tas... | agpl-3.0 | Python |
c1a378adcfd4ccccc44b0c9272e84a765f61f88a | add import script for Selby | chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_selby.py | polling_stations/apps/data_collection/management/commands/import_selby.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000169'
addresses_name = 'SelbyDemocracy_Club__04May2017.tsv'
stations_name = 'SelbyDemocracy_Club__04May2017.tsv'
elections = ['local.north-yorkshire.2... | bsd-3-clause | Python | |
c92fbe2d0d40d3fa1339bf9e2a645c0c8d36bdc3 | Add a tool to be able to diff sln files | csulmone/gyp,csulmone/gyp,csulmone/gyp,csulmone/gyp | tools/pretty_sln.py | tools/pretty_sln.py | #!/usr/bin/python2.5
# Copyright 2009 Google Inc.
# All Rights Reserved.
"""Prints the information in a sln file in a diffable way.
It first outputs each projects in alphabetical order with their
dependencies.
Then it outputs a possible build order.
"""
__author__ = 'nsylvain (Nicolas Sylvain)'
import re
... | bsd-3-clause | Python | |
b01b2757e5bfd9835ce28e6d5e27137c7aa5075b | Add a small test script to call individual methods of a driver | Vauxoo/stoqdrivers,stoq/stoqdrivers,vauxoo-dev/stoqdrivers,stoq/stoqdrivers | tools/testdriver.py | tools/testdriver.py | # -*- Mode: Python; coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2007 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## This program 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 Sof... | lgpl-2.1 | Python | |
fb08ad77a821d86a3049628d907577949d525dac | Add unittests to test environment.py methods | Telefonica/toolium,Telefonica/toolium,Telefonica/toolium | toolium/test/behave/test_environment.py | toolium/test/behave/test_environment.py | # -*- coding: utf-8 -*-
u"""
Copyright 2016 Telefónica Investigación y Desarrollo, S.A.U.
This file is part of Toolium.
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/lic... | apache-2.0 | Python | |
032876577fa94e2d9ca668d6fe108d725696088b | add 20newsgroups/ml.py | arosh/ml | 20newsgroups/ml.py | 20newsgroups/ml.py | from __future__ import division, print_function, unicode_literals
import numpy
from sklearn.datasets import fetch_20newsgroups_vectorized
from sklearn.preprocessing import StandardScaler
from sklearn.naive_bayes import MultinomialNB
from sklearn.linear_model import SGDClassifier
from sklearn.svm import LinearSVC
from s... | mit | Python | |
63a0a0347272b2ae19f9caa5200aca5c03d67bab | add userselfinfo | OmegaEinstein/opsdev,OmegaEinstein/opsdev | api/user.py | api/user.py | #coding:utf-8
from flask import Flask
from . import app, jsonrpc
import json
from auth import auth_login
@jsonrpc.method('user.getinfo')
@auth_login
def userselfinfo(auth_info, **kwargs):
username = auth_info['username']
fields = ['id','username','name','email','mobile','is_lock','r_id']
try:
use... | mit | Python | |
c43000d2f9ec20a1c0cdbbec86270d88acb36104 | Add implementation of more generic store calls | ktbs/ktbs-bench,ktbs/ktbs-bench | bench_examples/sparqlstore.py | bench_examples/sparqlstore.py | from ktbs_bench.graph_store import GraphStore
import rdflib
rdflib.plugin.register('BN', rdflib.store.Store, 'ktbs_bench.bnsparqlstore', 'SPARQLUpdateStore')
def get_sparqlstore(query_endpoint, update_endpoint, identifier="http://localhost/generic_sparqlstore/"):
triple_store = GraphStore(store='BN', identifier=... | mit | Python | |
a6c96caa1392868402be9f89db034ef664a12bda | Add open time range support. | google/ctfscoreboard,google/ctfscoreboard,google/ctfscoreboard,google/ctfscoreboard | utils.py | utils.py | import datetime
import flask
import functools
from app import app
# Use dateutil if available
try:
from dateutil import parser as dateutil
except ImportError:
dateutil = None
class GameTime(object):
@classmethod
def setup(cls):
"""Get start and end time."""
cls.start, cls.end = app.config.get('GAME_T... | apache-2.0 | Python | |
135645a91d08267a0cc04b5c5840ac9c84af03b5 | Add pytorch_CAM.py file for Lecture 05 | jastarex/DeepLearningCourseCodes,jastarex/DeepLearningCourseCodes | 05_Image_recognition_and_classification/pytorch_CAM.py | 05_Image_recognition_and_classification/pytorch_CAM.py | # simple implementation of CAM in PyTorch for the networks such as ResNet, DenseNet, SqueezeNet, Inception
import io
import requests
from PIL import Image
from torchvision import models, transforms
from torch.autograd import Variable
from torch.nn import functional as F
import numpy as np
import cv2
# input image
LAB... | apache-2.0 | Python | |
a11a32f754a356dfc008e69b62d930af3754aec4 | Add : LFI Exploit tool | m101/m101-tools | exploit-lfi.py | exploit-lfi.py | #!/usr/bin/python
import argparse
import base64
import re
import requests
import sys
def scrap_results (content):
# regexp
regexp_start = re.compile ('.*STARTSTART.*')
regexp_end = re.compile ('.*ENDEND.*')
# results
results = list()
# result start and end
found_start = False
found_end... | agpl-3.0 | Python | |
70f48f8b72a49929ddba7908fd47175fd4c1685d | add yarn support (test failing) | Ron89/thesaurus_query.vim | autoload/thesaurus_query/backends/yarn_synsets_lookup.py | autoload/thesaurus_query/backends/yarn_synsets_lookup.py | # Thesaurus Lookup routine for local synsets.csv file.
# Author: HE Chong [[chong.he.1989@gmail.com][E-mail]]
'''
Lookup routine for local mthesaur.txt file. When query_from_source is called, return:
[status, [[def_0, [synonym_0, synonym_1, ...]], [def_1, [synonym_0, synonym_1, ...]], ...]]
status:
0: no... | apache-2.0 | Python | |
b036acb164bc0efce18299341b04a7acf226c7db | solve pep_745 | filippovitale/pe,filippovitale/pe,filippovitale/pe,filippovitale/pe | pe-solution/src/main/python/pep_745.py | pe-solution/src/main/python/pep_745.py | from collections import defaultdict
from math import sqrt
MODULO = 1_000_000_007
def g_naive(n: int) -> int:
"""maximum perfect square that divides n."""
upper = int(sqrt(n))
for i in range(0, upper):
sq = (upper - i) ** 2
if n % sq == 0:
return sq % MODULO
def s_naive(nn: ... | mit | Python | |
a59d07a5bfb9f32c37242fd8ffb06d0409896485 | add a welch periodogram tool | evandromr/python_scitools | welch.py | welch.py | #!/bin/env python
import numpy as np
import scipy.signal as ss
import astropy.io.fits as fits
import matplotlib.pyplot as plt
inpt = str(raw_input("Nome do Arquivo: "))
lc = fits.open(inpt)
bin = float(raw_input("bin size (or camera resolution): "))
# Convert to big-endian array is necessary to the lombscargle func... | mit | Python | |
f204c881aabb07dbe6f04008e0637dc4430ae8c8 | Add jon submission for problem 01 | lypnol/graph-theory | problem-01/submissions/jon.py | problem-01/submissions/jon.py | from submission import Submission
import collections
import random
class JonSubmission(Submission):
def author(self):
return 'jon'
def run(self, input):
class Traveler(object):
def __init__(self, graph, start_point):
if start_point not in graph:
... | mit | Python | |
9999c27f5a6121d8488c14dd4a2b9843eef9cec9 | Add merge migration | aapris/linkedevents,City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents,aapris/linkedevents,aapris/linkedevents,City-of-Helsinki/linkedevents | events/migrations/0030_merge.py | events/migrations/0030_merge.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-09-27 09:05
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('events', '0029_make_api_key_non_nullable'),
('events', '0028_add_photographer_name'),
]
... | mit | Python | |
aa0e10116580ab013e911c2b14cf216a19716abd | Add schedule to static renderers | CTPUG/wafer,CTPUG/wafer,CarlFK/wafer,CarlFK/wafer,CTPUG/wafer,CarlFK/wafer,CarlFK/wafer,CTPUG/wafer | wafer/schedule/renderers.py | wafer/schedule/renderers.py | from django_medusa.renderers import StaticSiteRenderer
class ScheduleRenderer(StaticSiteRenderer):
def get_paths(self):
paths = ["/schedule/", ]
return paths
renderers = [ScheduleRenderer, ]
| isc | Python | |
51d3dee22c3c563b486038edcd9f18fa02b46448 | Add new admin views to show how to use RBAC system | andreffs18/flask-template-project,andreffs18/flask-template-project,andreffs18/flask-template-project | project/admin/views.py | project/admin/views.py | from werkzeug.exceptions import HTTPException
from flask import Response, redirect
from flask_admin import BaseView, expose
from flask_admin.contrib.sqla import ModelView as DefaultModelView
from flask_login import login_required
from project.home.decorators import roles_required
class BasicAuthException(HTTPExceptio... | mit | Python | |
46074336a9ffc8a566a88a8e70c37ca56635ff7d | Create app2.py | belmih/simpleworks | python/pla.rix/app2.py | python/pla.rix/app2.py | #!C:/Python35/python.exe
# -*- coding: UTF-8 -*-
#
# belmih 2016
#
from multiprocessing import Process, Queue, Lock
import os
import xml.etree.cElementTree as ET
import shutil
import zipfile
import time
import csv
import argparse
abspath = os.path.abspath(__file__)
workdir = os.path.dirname(abspath)
os.chdir(workdi... | mit | Python | |
68babe2de9a8204c46ad23e1c82dd0ff8fe44c94 | Add a unittest on plot_figs module. | jeremiedecock/pyarm,jeremiedecock/pyarm | pyarm/tests/test_plot_figs.py | pyarm/tests/test_plot_figs.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2010 Jérémie DECOCK (http://www.jdhp.org)
import unittest
import os
import sys
dirname = os.path.dirname(__file__)
if dirname == '':
dirname = '.'
dirname = os.path.realpath(dirname)
updir = os.path.split(dirname)[0]
if updir not in sys.path:
sys... | mit | Python | |
f34fb2b060c7fd977ca50753c8c1c9d5beaf0516 | return index at which acf drops below thresh | isomerase/RoboSkeeter,isomerase/mozziesniff | agent_model/acfanalyze.py | agent_model/acfanalyze.py | __author__ = 'richard'
import os
import numpy as np
import pandas as pd
from glob import glob
import statsmodels.tsa
import statsmodels.graphics.tsaplots
import matplotlib.pyplot as plt
plt.style.use('ggplot')
TRAJECTORY_DATA_DIR = "experimental_data/control_trajectories/"
def make_csv_name_list():
# TODO expor... | mit | Python | |
96ca06b93aa33fbe779a6e7c6c85439e5b62b1a8 | Add `pysymoro/screw6.py` | galou/symoro,ELZo3/symoro,symoro/symoro,galou/symoro,symoro/symoro,ELZo3/symoro | pysymoro/screw6.py | pysymoro/screw6.py | # -*- coding: utf-8 -*-
"""
This module contains the Screw6 data structure.
"""
from sympy import zeros
from sympy import ShapeError
class Screw6(object):
"""
Data structure:
Represent the data structure (base class) to hold a 6x6 matrix
which in turn contains four 3x3 matrices.
"""
... | mit | Python | |
e3b5f7b0f47b1e7ad4ab024c76a270ba9e88aa02 | add impala sqlalchemy resource function | alexmojaki/blaze,jcrist/blaze,ContinuumIO/blaze,LiaoPan/blaze,cpcloud/blaze,maxalbert/blaze,cowlicks/blaze,caseyclements/blaze,ChinaQuants/blaze,ChinaQuants/blaze,dwillmer/blaze,xlhtc007/blaze,scls19fr/blaze,cpcloud/blaze,ContinuumIO/blaze,nkhuyu/blaze,caseyclements/blaze,mrocklin/blaze,scls19fr/blaze,nkhuyu/blaze,cowl... | blaze/sql.py | blaze/sql.py | from __future__ import absolute_import, division, print_function
from .compute.sql import select
from .data.sql import SQL, dispatch, first
from .expr import Expr, TableExpr, Projection, Column, UnaryOp
from .expr.scalar.core import Scalar
from .compatibility import basestring
from .api.resource import resource
impo... | from __future__ import absolute_import, division, print_function
from .compute.sql import select
from .data.sql import SQL, dispatch, first
from .expr import Expr, TableExpr, Projection, Column, UnaryOp
from .expr.scalar.core import Scalar
from .compatibility import basestring
from .api.resource import resource
impo... | bsd-3-clause | Python |
d952776a78901ecd20cb8e79cd00f5498e4b04be | Add generate anagrams | gsathya/dsalgo,gsathya/dsalgo | algo/generate_anagrams.py | algo/generate_anagrams.py | import sys
import shuffle from random
word = list(sys.argv[1])
anagrams = []
for i in range(10):
anagrams.append(''.join(shuffle(word)))
print anagrams
| mit | Python | |
2cfd4864df3536f7d8523a0f5f5ef98a5c6113af | add bootstrap.py | nylas/icalendar,untitaker/icalendar,geier/icalendar | bootstrap.py | bootstrap.py | ##############################################################################
#
# Copyright (c) 2006 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | bsd-2-clause | Python | |
4d021acd89abc127d50e6bf82064bd7aac2bca1a | Solve compree the string with groupby | rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank | python/compress-the-string.py | python/compress-the-string.py | from itertools import groupby
string = input()
print(" ".join(["({}, {})".format(len(list(group)), char) for char, group in groupby(string)]))
| mit | Python | |
cf3a1c26ab650ad2a87d4b4dcc6754c70abde802 | Create compat.py | Programmeerclub-WLG/Agenda-App | backend/compat.py | backend/compat.py | apache-2.0 | Python | ||
f11ce837f0200d501c34c8fa7b2f5cfd149c18b6 | Add db migrations | wk-tech/crm-smsfly,wk-tech/crm-smsfly,wk-tech/crm-smsfly | SMSFlyCRM/SMSApp/migrations/0002_auto_20160602_2034.py | SMSFlyCRM/SMSApp/migrations/0002_auto_20160602_2034.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-02 20:34
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('SMSApp', '0001_initial'),
]
operations = [
migrations.Remove... | mit | Python | |
86657d78f220345391dc764db22cd9f02903f3a9 | Add tests | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/initiatives/tests/test_admin.py | bluebottle/initiatives/tests/test_admin.py | # -*- coding: utf-8 -*-
from django.contrib.admin.sites import AdminSite
from django.urls.base import reverse
from bluebottle.initiatives.admin import InitiativeAdmin
from bluebottle.initiatives.models import Initiative
from bluebottle.initiatives.tests.factories import InitiativeFactory
from bluebottle.test.utils im... | bsd-3-clause | Python | |
a383d1220c31f153a5519e4aab4703db2b71ef53 | Add initial version of season goal leader retrieval | leaffan/pynhldb | analysis/_goal_leaders.py | analysis/_goal_leaders.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from lxml import html
SEASON_URL_TEMPLATE = "http://www.hockey-reference.com/leagues/NHL_%d.html"
CAREER_GOAL_LEADERS_URL = "http://www.hockey-reference.com/leaders/goals_career.html"
season_goal_leaders = set()
for year in range(1918, 2017)[:0]:
... | mit | Python | |
10ce581d1ecbba29913982a56f32c3d93a1b54fe | Add Python benchmark | stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib | lib/node_modules/@stdlib/math/base/special/gamma/benchmark/python/benchmark.py | lib/node_modules/@stdlib/math/base/special/gamma/benchmark/python/benchmark.py | #!/usr/bin/env python
"""Benchmark gamma."""
from __future__ import print_function
import timeit
NAME = "gamma"
REPEATS = 3
ITERATIONS = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments... | apache-2.0 | Python | |
66328709459b2217b3c964848a363c4f3b1cdf5e | Add Python benchmark | stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib | lib/node_modules/@stdlib/math/base/special/trunc/benchmark/python/benchmark.py | lib/node_modules/@stdlib/math/base/special/trunc/benchmark/python/benchmark.py | #!/usr/bin/env python
"""Benchmark trunc."""
from __future__ import print_function
import timeit
NAME = "trunc"
REPEATS = 3
ITERATIONS = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments... | apache-2.0 | Python | |
37b175b6a6ac3f0fd7fdaa5c2ed6435c159a29c2 | Add py solution for 553. Optimal Division | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/optimal-division.py | py/optimal-division.py | from fractions import Fraction
class Solution(object):
def optimalDivision(self, nums):
"""
:type nums: List[int]
:rtype: str
"""
min_result, max_result = dict(), dict()
min_offset, max_offset = dict(), dict()
lnums = len(nums)
def print_ans(start, end... | apache-2.0 | Python | |
e14c4f1aeb15491ecbf2981527e2409ab3e82653 | Test for BuildQuerySet.concurrent logic | rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org | readthedocs/builds/tests/test_build_queryset.py | readthedocs/builds/tests/test_build_queryset.py | import pytest
import django_dynamic_fixture as fixture
from django.conf import settings
from readthedocs.builds.querysets import BuildQuerySet
from readthedocs.builds.models import Build, Version
from readthedocs.projects.models import Project, Feature
@pytest.mark.django_db
class TestBuildQuerySet:
def test_c... | mit | Python | |
4c428b78f9bf4d5f044a23921a6f29df34c93753 | add python process pool example | yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn,yuncliu/Learn | python/process_pool.py | python/process_pool.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from multiprocessing import Pool
def worker(a):
print(a)
if __name__ == "__main__":
p = Pool(10)
p.map(worker, range(0, 1000))
| bsd-3-clause | Python | |
565dab9ae60d6c7fa92d3385ef4515933850d4a0 | Create __init__.py | gwsilva/rdc-16 | rdc_16/__init__.py | rdc_16/__init__.py |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Gideoni Silva (Omnes)
# Copyright 2013-2014 Omnes Tecnologia
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Lice... | agpl-3.0 | Python | |
1199bba46cc16ec1285ab9d58fa1c74e9061f874 | Create PedidoDeletar.py | AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb | backend/Models/Predio/PedidoDeletar.py | backend/Models/Predio/PedidoDeletar.py | from Framework.Pedido import Pedido
from Framework.ErroNoHTTP import ErroNoHTTP
class PedidoDeletar(Pedido):
def __init__(self,variaveis_do_ambiente):
super(PedidoDeletar, self).__init__(variaveis_do_ambiente)
try:
self.id = self.corpo['id']
except:
raise ErroNoHTTP(400)
def getId(self):
return ... | mit | Python | |
8561fba46509db7f74f9770d71dd0ba41e4cb594 | Add bids.ext namespace package for subpackages | INCF/pybids | bids/ext/__init__.py | bids/ext/__init__.py | __path__ = __import__('pkgutil').extend_path(__path__, __name__)
| mit | Python | |
a75b7cf5634e580b78c5f4cad9255735982b51d1 | bump to 0.9.3 | loandy/billy,loandy/billy,sunlightlabs/billy,sunlightlabs/billy,loandy/billy,mileswwatkins/billy,openstates/billy,openstates/billy,sunlightlabs/billy,mileswwatkins/billy,mileswwatkins/billy,openstates/billy | billy/__init__.py | billy/__init__.py | __version__ = '0.9.3'
from billy.conf import settings
class LazyDb(object):
def __init__(self):
self._db = None
def __getattr__(self, attr):
if not self._db:
import pymongo
host = settings.MONGO_HOST
port = settings.MONGO_PORT
db_name = sett... | __version__ = '0.9.2'
from billy.conf import settings
class LazyDb(object):
def __init__(self):
self._db = None
def __getattr__(self, attr):
if not self._db:
import pymongo
host = settings.MONGO_HOST
port = settings.MONGO_PORT
db_name = sett... | bsd-3-clause | Python |
ac9bcdea0ece3e34943471336499f42213ef5c47 | Create zinnia_markitup module | django-blog-zinnia/zinnia-wysiwyg-markitup,django-blog-zinnia/zinnia-wysiwyg-markitup | zinnia_markitup/__init__.py | zinnia_markitup/__init__.py | """MarkItUp for Django-blog-zinnia"""
| bsd-3-clause | Python | |
d61fc5b219186824b8b198c5a4679602372039da | Create leapBasic.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/Alessandruino/leapBasic.py | home/Alessandruino/leapBasic.py | leap = Runtime.start("leap","LeapMotion")
leap.addLeapDataListener(python)
def onLeapData(data):
print (data.rightHand.index)
leap.startTracking()
| apache-2.0 | Python | |
c25c0a9942345ed46d8091f7705cb26bbb21dfe5 | add plugin test cases | ssato/python-anyconfig-pyjavaproperties-backend,ssato/python-anyconfig-pyjavaproperties-backend | tests/plugin.py | tests/plugin.py | #
# Copyright (C) 2017 Satoru SATOH <satoru.satoh @ gmail.com>
# License: MIT
#
# pylint: disable=missing-docstring,invalid-name
from __future__ import absolute_import
import os.path
import os
import unittest
import anyconfig
_CURDIR = os.path.dirname(__file__)
class Test(unittest.TestCase):
conf_path = os.p... | mit | Python | |
c4bad78b508369e7ef1c682114c0b04340ed371b | Create an abstract Player class | mbrookes1304/Dudo | Player.py | Player.py | from abc import ABCMeta, abstractmethod
from Dice import Dice
class Player(object):
"""An abstract Dudo player"""
__metaclass__ = ABCMeta
def __init__(self, name):
self._name = name
# Create a set of five dice
self._diceset = set()
self._diceset.add(Dice())
self._d... | mit | Python | |
a9ec0b508f9d59d0c920a53141d25de0d6eb1c5f | work in progress | SageBerg/LearnYouATypist,SageBerg/LearnYouATypist,SageBerg/LearnYouATypist | make_lessons.py | make_lessons.py | # -*- coding: utf-8 -*-
import sys
def make_lesson():
arg = sys.argv[1]
f = open(arg)
text = ""
count = 0
for line in f:
text += line
count += 1
if count > 9:
count = 0
text = clean(text)
print text + "\n"
text = ""
print t... | apache-2.0 | Python | |
54afce985f7f24e74cd5796e12e3c5f2c4616590 | Add Python script to generate (huge) test dumps. | CoolV1994/zPermissions,TWSSYesterday/zPermissions,TWSSYesterday/zPermissions,CoolV1994/zPermissions,ZerothAngel/zPermissions,ZerothAngel/zPermissions | etc/gen-test-dump.py | etc/gen-test-dump.py | #!/usr/bin/env python
import random
WORLDS = [None] * 8 + ['world', 'world_nether', 'creative', 'hardcore']
REGIONS = [None] * 20 + ['Region%d' % i for i in range(10)]
NUM_PLAYERS = 100
NUM_PERMISSIONS_PER_PLAYER = 50
NUM_GROUPS = (3, 13, 23, 31, 41)
NUM_PERMISSIONS_PER_GROUP = 50
NUM_PLAYERS_PER_GROUP = 50
P... | apache-2.0 | Python | |
f264a4a15682467549326cc530c152f647bf7832 | Add a convenience python script to inline the imports of a file. | JasonGross/catdb,CategoricalData/catdb,CategoricalData/catdb,JasonGross/catdb | replace_imports.py | replace_imports.py | from __future__ import with_statement
import os
file_contents = {}
file_imports = {}
def get_file(file_name):
if file_name[-2:] != '.v': file_name += '.v'
if file_name not in file_contents.keys():
print(file_name)
try:
with open(file_name, 'r', encoding='UTF-8') as f:
... | mit | Python | |
fa067ee22e89111848536c7fa9396575a8f31ac6 | add testhttp.py. | kurniawano/pythymiodw | examples/testhttp.py | examples/testhttp.py | from pythymiodw import ThymioReal
t = ThymioReal()
t.wheels(100,100)
t.sleep(1)
t.quit() | mit | Python | |
5c40193fe8bce5601190223503d27e73cb8dff39 | Create zip.py | DataMonster/Python | exer/zipunzip/zip.py | exer/zipunzip/zip.py | def zip(*arg):
Result = []
Check = 1
#check if every item in arg has the same length
for i in arg:
if len(i) != len(arg[0]):
print 'please make sure enter all items with the same length'
Check = 0
break
while (Check):
for j in range(0,len(arg[0])):... | unlicense | Python | |
6701b9001b85b440f1cea8bdca5f93fb9abbf9b8 | Add buzzer1 script(node) | DaisukeUra/pimouse_ros,DaisukeUra/pimouse_ros | scripts/buzzer1.py | scripts/buzzer1.py | #!/usr/bin/env python
import rospy
rospy.init_node('buzzer')
rospy.spin()
| bsd-3-clause | Python | |
4f9db89ea1beae50c27f00f4e52279af60987df2 | Set up sprint template script | rdocking/bits_and_bobs | sprint_template.py | sprint_template.py | #!/usr/bin/env python
# encoding: utf-8
"""
sprint_template.py
Created by Rod Docking on 2016-12-28.
Copyright (c) 2016 Canada's Michael Smith Genome Sciences Centre.
All rights reserved.
"""
import sys
import os
import argparse
SPRINT_TEMPLATE = """---
title: "Sprint $NUM: Witty Subtitle"
author: "Rod Docking"
date... | mit | Python | |
3fc4f4305f59e3dc42478e1b0812aeaa1eee91fa | Add labview_remote_panels | morelab/weblabdeusto,porduna/weblabdeusto,morelab/weblabdeusto,porduna/weblabdeusto,porduna/weblabdeusto,weblabdeusto/weblabdeusto,weblabdeusto/weblabdeusto,weblabdeusto/weblabdeusto,morelab/weblabdeusto,weblabdeusto/weblabdeusto,porduna/weblabdeusto,porduna/weblabdeusto,morelab/weblabdeusto,porduna/weblabdeusto,morela... | server/src/experiments/labview_remote_panels.py | server/src/experiments/labview_remote_panels.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | bsd-2-clause | Python | |
963c0479b22e1cc142b015b5afdccfb8c35aa4b6 | Add initial SD cog | Naught0/qtbot | cogs/diffusion.py | cogs/diffusion.py | import asyncio
import backoff
from typing import Any, Literal
from discord import Embed
from discord.ext import commands
from aiohttp import ClientResponseError
from bot import QTBot
from utils.custom_context import CustomContext
class DiffusionError(Exception):
pass
class Diffusion(commands.Cog):
INPUT = ... | mit | Python | |
68ba7f13c0a1db663d97ffc8f1601eb15cfa52b3 | Create wireless_scanner.py | rs91092/Scapy-wireless-scanner | wireless_scanner.py | wireless_scanner.py | #Implementation of a wireless scanner using Scapy library
#!/usr/bin/env python
# rs.py - Wireless AP scanner
#author rahil sharma
# date 15/3/2013 @rs
#usage python rs.py mon0
import sys, os, signal
from multiprocessing import Process
from scapy.all import *
interface='' # monitor interface
aps = {} # dictionar... | mit | Python | |
01c619826a32a78c121b1ded0c6c5cf3195a0cfe | refactor currency | Go-In/go-coup,Go-In/go-coup,Go-In/go-coup,Go-In/go-coup,Go-In/go-coup | storemanage/models/Currency.py | storemanage/models/Currency.py | from django.db import models
from django.contrib.auth.models import User
from django.contrib.postgres.fields import JSONField
# Create your models here.
class Currency(models.Model):
name = models.CharField(max_length=30)
store = models.ForeignKey(User, on_delete=models.CASCADE)
attribute = JSONField(defa... | mit | Python | |
cdefa248cb481f8b8a676fd674a4290f95d15145 | Add tool to fix MP4 file timestamp from GPMF GPS clock | rambo/python-gpmf,rambo/python-gpmf | fix_mp4_timestamp.py | fix_mp4_timestamp.py | #!/usr/bin/env python3
import datetime
import shutil
import gpmf.extract
import gpmf.parse
import hachoir.editor
import hachoir.parser
import hachoir.stream
from hachoir.field import MissingField
def locate_fields_by_subpath(parser, subpath):
"""Locate mp4 fields by their subpath element name"""
def recursiv... | mit | Python | |
5a36c269a89d5c2a835696a817ea24ea4d4ce72e | add script to performance of trace processor ingestion am: c893b17841 am: 69ca53841e am: b084bd3e82 | google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto | tools/measure_tp_performance.py | tools/measure_tp_performance.py | #!/usr/bin/env python3
# Copyright (C) 2021 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | apache-2.0 | Python | |
8103632a7acc080e8a9d108c047acffa2539c4b9 | solve factorial problem | vtemian/uni-west,vtemian/uni-west,vtemian/uni-west,vtemian/uni-west,vtemian/uni-west,vtemian/uni-west,vtemian/uni-west | graph/2/factorial.py | graph/2/factorial.py | def factorial(n):
if n <= 1:
return 1
return n * factorial(n - 1)
if __name__ == "__main__":
n = raw_input("n: ")
print "result is:", factorial(int(n))
| apache-2.0 | Python | |
08e52c671ef405c34e532f1ca29e7fc2ee6892d9 | Add python script that should submit to view.cwl API | curoverse/l7g,curoverse/l7g,curoverse/l7g,curoverse/l7g,curoverse/l7g,curoverse/l7g,curoverse/l7g | viewcwl-json.py | viewcwl-json.py | #!/usr/bin/env python
import fnmatch
import requests
import time
import os
import glob
# You can alternatively define these in travis.yml as env vars or arguments
BASE_URL = 'https://view.commonwl.org'
WORKFLOW_PATH = '/workflows/workflow.cwl'
#get the cwl in l7g/cwl-version
matches = []
for root, dirnames, filename... | agpl-3.0 | Python | |
9700cf8aa468ce364067d1cdf80cd5e968aef08a | Create classification_examples.py | mcStargazer/nlp_talk_apr2017 | classification_examples.py | classification_examples.py | # -*- coding: utf-8 -*-
##############################################################################
# references
##############################################################################
# www.udemy.com/machinelearning/ - I really enjoyed this course. Take it!
# original data/code at www.superdatascience.com/... | mit | Python | |
f498610ce8b4d9ec4b010e16a9d738c937ff3c72 | add db only tests utility #96 | biothings/biothings.api,biothings/biothings.api | biothings/tests/hub.py | biothings/tests/hub.py |
# DatabaseCollectionTesting
# Author: Amiteshk Sharma
# https://github.com/amiteshksharma/Database-Testing
import pymongo
from jsonpath_ng import jsonpath, parse
class DatabaseCollectionTesting:
"""
Constructor that takes in three items
db_url - string - the mongoDB url to connect to
... | apache-2.0 | Python | |
af6b04531ebbb0d86bf0177f30e7691221e2b17e | fix date citation for gob's | suranap/boltons,siemens/boltons,kevinastone/boltons,neuropil/boltons,markrwilliams/boltons,mgaitan/boltons,doublereedkurt/boltons,zeroSteiner/boltons | boltons/easterutils.py | boltons/easterutils.py | # -*- coding: utf-8 -*-
def gobs_program():
"""
A pure-Python implementation of Gob's Algorithm (2006). A brief
explanation can be found here:
https://www.youtube.com/watch?v=JbnjusltDHk
"""
while True:
print "Penus",
if __name__ == '__main__':
gobs_program()
| # -*- coding: utf-8 -*-
def gobs_program():
"""
A pure-Python implementation of Gob's Algorithm (2013). A brief
explanation can be found here:
https://www.youtube.com/watch?v=JbnjusltDHk
"""
while True:
print "Penus",
if __name__ == '__main__':
gobs_program()
| bsd-3-clause | Python |
caf0ea95a03b06e09e640799a1f0d959658373ab | Create email.py | IntegrarOffshore/Rastema,Alzemand/Rastema,Alzemand/Rastema,IntegrarOffshore/Rastema,Alzemand/Rastema,IntegrarOffshore/Rastema,IntegrarOffshore/Rastema,Alzemand/Rastema | models/email.py | models/email.py | import smtplib
# Credenciais
remetente = 'seu-email@gmail.com'
senha = 'sua-senha'
# Informações da mensagem
destinatario = 'email-do-destinatario@qualquercoisa.com'
assunto = 'Enviando email com python'
texto = 'Esse email foi enviado usando python! :)'
# Preparando a mensagem
msg = '\r\n'.... | mit | Python | |
a11b064622f8dd56f76828f396d29072ece50ab9 | Add Python benchmark | stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib | lib/node_modules/@stdlib/math/base/special/erfcinv/benchmark/python/benchmark.scipy.py | lib/node_modules/@stdlib/math/base/special/erfcinv/benchmark/python/benchmark.scipy.py | #!/usr/bin/env python
"""Benchmark scipy.special.erfcinv."""
import timeit
name = "erfcinv"
repeats = 3
iterations = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
* `total`: to... | apache-2.0 | Python | |
4582d020ec6fe8ef6035fc4a4de484f557f2d026 | Add 025 | ufjfeng/leetcode-jf-soln,ufjfeng/leetcode-jf-soln | python/025_reverse_nodes_in_k_group.py | python/025_reverse_nodes_in_k_group.py | """
Given a linked list, reverse the nodes of a linked list k at a time and return
its modified list.
If the number of nodes is not a multiple of k then left-out nodes in the end
should remain as it is.
You may not alter the values in the nodes, only nodes itself may be changed.
Only constant memory is allowed.
For... | mit | Python | |
6e44d244a11664798be24a88681f37aad9b0329e | add url | palloc/face_t,palloc/face_t | backend-api/image_api/authapp/urls.py | backend-api/image_api/authapp/urls.py | # config: utf-8
from rest_framework import routers
from .views import *
router = routers.DefaultRouter()
router.register(r'faceimage', FaceImageViewSet)
| mit | Python | |
48bfe2d20cca35885ad0a460679d0a951d0c584e | Add spider for Giant Eagle | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/gianteagle.py | locations/spiders/gianteagle.py | # -*- coding: utf-8 -*-
import json
import re
import scrapy
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
DAY_MAPPING = {
1: "Su",
2: "Mo",
3: "Tu",
4: "We",
5: "Th",
6: "Fr",
7: "Sa"
}
class GiantEagleSpider(scrapy.Spider):
name = "gianteagle... | mit | Python | |
d29e7ff4153ddcf616f8d03c08f6f95e3a348263 | Create command to calculate quantity of similar apps per app | bkosawa/admin-recommendation | crawler/management/commands/distribution_of_similar.py | crawler/management/commands/distribution_of_similar.py | import logging.config
from operator import or_
from django.core.management.base import BaseCommand
from crawler.models import *
logger = logging.getLogger('crawler.command')
class Command(BaseCommand):
help = 'Generate comparison between google similar app and ours'
def handle(self, *args, **options):
... | apache-2.0 | Python | |
023e88f264274211674a100820d590dcee694445 | Allow neutron network list to be used as pillar data | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/pillar/neutron.py | salt/pillar/neutron.py | # -*- coding: utf-8 -*-
'''
Use Openstack Neutron data as a Pillar source. Will list all networks listed
inside of Neutron, to all minions.
.. versionadded:: Beryllium
:depends: - python-neutronclient
A keystone profile must be used for the pillar to work (no generic keystone
configuration here).
For example::... | apache-2.0 | Python | |
6df4cdd8fe629fabadd792d0b7507a57f9dc37b7 | refactor tests | sumit12dec/pyquora,iammxt/pyquora,rohithpr/pyquora | tests/test_helper_functions.py | tests/test_helper_functions.py | import quora
class TestHelperFunctions:
def test_try_cast_int(self):
input_strings = ['200 Upvotes', '2k Upvotes', '2 K Upvotes', '2.3k Upvotes', '2.3 K Upvotes', '<span class="count">3</span>']
expected = [200, 2000, 2000, 2300, 2300, 3]
for i in range(0, len(input_strings)):
... | import quora
def test_try_cast_int():
assert quora.try_cast_int('200 Upvotes') == 200
assert quora.try_cast_int('2k Upvotes') == 2000
assert quora.try_cast_int('2 K Upvotes') == 2000
assert quora.try_cast_int('2.3k Upvotes') == 2300
assert quora.try_cast_int('2.3 K Upvotes') == 2300
assert quora.try_cast_int('<s... | agpl-3.0 | Python |
2b0ade5407902c2b8d8a0853967bbe01c9e38e7e | test file for paraview functions | PMEAL/OpenPNM | tests/unit/io/test_paraview.py | tests/unit/io/test_paraview.py | import os
import sys
import pytest
import numpy as np
import porespy as ps
import openpnm as op
from numpy.testing import assert_allclose
import psutil
from openpnm.io.__paraview__ import export_data
from openpnm.io.__paraview__ import open_paraview
class ExportTest():
def setup_class(self):
self.path = o... | mit | Python | |
1f281a1279b7b185559d9d267a69ea24024c633e | Transpose of a Matrix | 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... | math/Matrix/Python/transpose.py | math/Matrix/Python/transpose.py | """ Transpose of a Matrix
Following is a simpler code for Transpose
of a matrix using the NUMPY library of Python.
The transpose of a matrix swaps its rows and columns:
[[a,b,c],
[d,e,f]]
Would be written as :
[[a,d],
[b,e],
[c,f]]
... | cc0-1.0 | Python | |
bf98a5d06436a905aa5710db4a60f1e6b7c8f7fc | Add link local plugin | Daksh/sugar-toolkit-gtk3,quozl/sugar-toolkit-gtk3,gusDuarte/sugar-toolkit-gtk3,tchx84/sugar-toolkit-gtk3,i5o/sugar-toolkit-gtk3,quozl/sugar-toolkit-gtk3,sugarlabs/sugar-toolkit,quozl/sugar-toolkit-gtk3,i5o/sugar-toolkit-gtk3,samdroid-apps/sugar-toolkit-gtk3,puneetgkaur/backup_sugar_sugartoolkit,ceibal-tatu/sugar-toolki... | services/presence2/linklocal_plugin.py | services/presence2/linklocal_plugin.py | # Copyright (C) 2007, Red Hat, Inc.
# Copyright (C) 2007, Collabora Ltd.
#
# This program 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 2 of the License, or
# (at your option) any later versio... | lgpl-2.1 | Python | |
2ab796aeb53e650b8a1dd828b5daaca16850d9c3 | Add tests for APNS message. | hackerkid/zulip,ahmadassaf/zulip,vaidap/zulip,peguin40/zulip,AZtheAsian/zulip,dhcrzf/zulip,brainwane/zulip,ahmadassaf/zulip,rishig/zulip,sharmaeklavya2/zulip,dattatreya303/zulip,calvinleenyc/zulip,jphilipsen05/zulip,j831/zulip,sonali0901/zulip,eeshangarg/zulip,synicalsyntax/zulip,jrowan/zulip,punchagan/zulip,verma-vars... | zerver/tests/test_push_notifications.py | zerver/tests/test_push_notifications.py | import mock
from django.test import TestCase
from django.conf import settings
from zerver.models import PushDeviceToken, UserProfile
from zerver.models import get_user_profile_by_email
from zerver.lib import push_notifications as apn
from zerver.lib.redis_utils import get_redis_client
class PushNotificationTest(Tes... | apache-2.0 | Python | |
6064180a636ecbf5e25742b87fe1f2365ea1e8b5 | add controlchar plugin | melmothx/jsonbot,melmothx/jsonbot,melmothx/jsonbot | commonplugs/controlchar.py | commonplugs/controlchar.py | # commonplugs/controlchar.pu
#
#
"""
command to control the control (command) characters. The cc is a string
containing the allowed control characters.
"""
from gozerlib.commands import cmnds
from gozerlib.examples import examples
def handle_cc(bot, ievent):
""" cc [<controlchar>] .. set/get control ... | mit | Python | |
f491db91ed2608698d2d91558f41f544819684bf | Add python-copy to calvinsys | les69/calvin-base,les69/calvin-base,EricssonResearch/calvin-base,les69/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base,les69/calvin-base | calvin/calvinsys/native/python-copy.py | calvin/calvinsys/native/python-copy.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 | |
5975fc773b1dff894fbd3f9dcff34c88dd52a17b | Create Random-Word-Constructor.py | jweinst1/Random-Word-Generator,jweinst1/Random-Word-Generator | Random-Word-Constructor.py | Random-Word-Constructor.py | import random
"""A Random Word Generator that uses a built-in algorithm that follows the syllable rules
in the English language. Useful for finding a creative name for a business or app."""
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',... | mit | Python | |
f62f8971bcaddc93cf9993e7ff0e4bfd70e0735d | Connect attribute filling signal to profile to dic function. | adieu/authentic2,BryceLohr/authentic,pu239ppy/authentic2,pu239ppy/authentic2,adieu/authentic2,pu239ppy/authentic2,pu239ppy/authentic2,adieu/authentic2,BryceLohr/authentic,adieu/authentic2,BryceLohr/authentic,BryceLohr/authentic | authentic2/idp/signals.py | authentic2/idp/signals.py | from django.dispatch import Signal
from django.conf import settings
from authentic2.idp.attributes import provide_attributes_at_sso, \
provide_attributes_of_user_profile
'''authorize_decision
Expect a dictionnaries as return with:
- the authorization decision e.g. dic['authz'] = True or False
- optionnaly a me... | from django.dispatch import Signal
from authentic2.idp.attributes import provide_attributes_at_sso
'''authorize_decision
Expect a dictionnaries as return with:
- the authorization decision e.g. dic['authz'] = True or False
- optionnaly a message e.g. dic['message'] = message
'''
authorize_service = Signal(providin... | agpl-3.0 | Python |
88bb5d1a42b817a000f10ec0989282c0998cc1b0 | Add approved and open | JohnGarbutt/reviewstats,cp16net/reviewstats,openstack-infra/reviewstats,cp16net/reviewstats,JohnGarbutt/reviewstats,openstack-infra/reviewstats | openapproved.py | openapproved.py | #!/usr/bin/env python
#
# Copyright (C) 2011 - Soren Hansen
# Copyright (C) 2013 - Red Hat, 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/LICEN... | apache-2.0 | Python | |
9bfbf6eb6f65fa745d0ef3777ad4486f47c69b87 | Add pose_to_kml.py formatting script | EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes,EndPointCorp/lg_ros_nodes | scripts/pose_to_kml.py | scripts/pose_to_kml.py | import sys
import csv
from math import sin, radians, fabs
KML_TEMPLATE = """
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2"
xmlns:kml="http://www.opengis.net/kml/2.2"
xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<nam... | apache-2.0 | Python | |
846ce88f199381387f612463da51c6b17281dd21 | Add script for checking Python3 compatibility | google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot,google/skia-buildbot | scripts/check_python3_compatibility.py | scripts/check_python3_compatibility.py | #!/usr/bin/env python
#
# Copyright 2021 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Check for Python scripts which are incompatible with Python 3."""
import ast
import os
import subprocess
import sys
def check_file(fp):
content = open(f... | bsd-3-clause | Python | |
4402506527cbc7dfbf648a90e4e2c665e27a5a34 | Add new package: py-rbtools (#18963) | LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/py-rbtools/package.py | var/spack/repos/builtin/packages/py-rbtools/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 PyRbtools(PythonPackage):
"""RBTools is a set of command line tools and a rich Python API ... | lgpl-2.1 | Python | |
88d9e6bd216bee0c78f437bdf15362efbebe2e0b | Create new package. (#6504) | mfherbst/spack,iulian787/spack,mfherbst/spack,LLNL/spack,LLNL/spack,EmreAtes/spack,matthiasdiener/spack,matthiasdiener/spack,iulian787/spack,tmerrick1/spack,iulian787/spack,tmerrick1/spack,LLNL/spack,LLNL/spack,tmerrick1/spack,LLNL/spack,matthiasdiener/spack,EmreAtes/spack,mfherbst/spack,krafczyk/spack,iulian787/spack,... | var/spack/repos/builtin/packages/r-bookdown/package.py | var/spack/repos/builtin/packages/r-bookdown/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 | |
5558cce438134c722a8c96d7d2badc03b6fd45f5 | Create new package. (#6214) | matthiasdiener/spack,LLNL/spack,LLNL/spack,krafczyk/spack,tmerrick1/spack,krafczyk/spack,skosukhin/spack,krafczyk/spack,matthiasdiener/spack,tmerrick1/spack,mfherbst/spack,matthiasdiener/spack,skosukhin/spack,mfherbst/spack,EmreAtes/spack,mfherbst/spack,tmerrick1/spack,LLNL/spack,matthiasdiener/spack,matthiasdiener/spa... | var/spack/repos/builtin/packages/r-fracdiff/package.py | var/spack/repos/builtin/packages/r-fracdiff/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 | |
28c6f1ddc23ee170522b1225bbf60f9b1d244189 | Add new package: logrotate (#18786) | LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/logrotate/package.py | var/spack/repos/builtin/packages/logrotate/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 Logrotate(AutotoolsPackage):
"""The logrotate utility is designed to simplify the administ... | lgpl-2.1 | Python | |
8fe2be0010e45f6b2ba339f5a7fe350bb7efed42 | add new package (#24045) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-nipype/package.py | var/spack/repos/builtin/packages/py-nipype/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 PyNipype(PythonPackage):
"""Neuroimaging in Python: Pipelines and Interfaces."""
home... | lgpl-2.1 | Python | |
9363331f96805bcc180a081cf9d28b5dab70e25b | Create undoclose.py | TingPing/plugins,TingPing/plugins | HexChat/undoclose.py | HexChat/undoclose.py | from sys import platform
from collections import deque
import hexchat
__module_name__ = "Undo Close"
__module_version__ = "0.1"
__module_description__ = "Adds keybinding to undo close tab"
__module_author__ = "TingPing"
if platform == 'win32':
shiftctrlmod = '5'
elif platform == 'darwin':
shiftctrlmod = '268435473'... | mit | Python | |
37cc64eec2681c4a1e8d3ad3c7f5971ce4c0c6e8 | add home view | SimonJakubowski/pyKitty,SimonJakubowski/pyKitty | kitty/views.py | kitty/views.py | from django.shortcuts import render_to_response
def home(request):
return render_to_response('welcome_page.html') | mit | Python | |
f226ab5b8ecd4faa80a349ab033702d716a6864c | Add initial migration | lnhubbell/Timers,lnhubbell/Timers | timer/migrations/0001_initial.py | timer/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Timer',
fields=[
('id', models.AutoField(verbos... | mit | Python | |
e3665928c80da9df192f8edb5dc28e3200e34fdc | Add a "image me [thing]" handler | tgerdes/toolbot,tgerdes/toolbot | toolbot/scripts/google_images.py | toolbot/scripts/google_images.py | import re
import json
import asyncio
import random
import aiohttp
GOOGLE_IMAGE_API = 'http://ajax.googleapis.com/ajax/services/search/images'
def plugin(bot):
@bot.respond(re.compile(r'(image|img)( me)? (.*)', re.I))
def image_me(msg):
asyncio.Task(imageMe(msg, msg.match.group(3), cb=msg.reply))
@... | mit | Python | |
fbc5b10b977d20cff340cfb130cec22d49842b5a | Add repos admin | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | api/repos/admin.py | api/repos/admin.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from django.contrib import admin
from repos.models import Repo, ExternalRepo
admin.site.register(Repo)
admin.site.register(ExternalRepo)
| apache-2.0 | Python | |
f1189f4774e469e39097e4d10159425a9ed40757 | Bump version to 2013.1 | JioCloud/nova,yrobla/nova,Brocade-OpenSource/OpenStack-DNRM-Nova,virtualopensystems/nova,rajalokan/nova,ewindisch/nova,orbitfp7/nova,sridevikoushik31/nova,cloudbase/nova,klmitch/nova,bigswitch/nova,LoHChina/nova,sridevikoushik31/nova,OpenAcademy-OpenStack/nova-scheduler,devendermishrajio/nova,yatinkumbhare/openstack-no... | nova/version.py | nova/version.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC
#
# 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
... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC
#
# 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
... | apache-2.0 | Python |
1681651b7d606436550aad3d696f5f1ba335caa9 | Add dump_useractivity migration helper tool. | wavelets/zulip,jonesgithub/zulip,mahim97/zulip,vikas-parashar/zulip,natanovia/zulip,proliming/zulip,gkotian/zulip,LeeRisk/zulip,jeffcao/zulip,kokoar/zulip,dxq-git/zulip,ipernet/zulip,itnihao/zulip,schatt/zulip,xuxiao/zulip,nicholasbs/zulip,yocome/zulip,isht3/zulip,willingc/zulip,aakash-cr7/zulip,noroot/zulip,DazWorrall... | zephyr/management/commands/dump_useractivity.py | zephyr/management/commands/dump_useractivity.py | from optparse import make_option
from django.core.management.base import BaseCommand
from zephyr.models import Realm, UserProfile, UserActivity, get_client
import simplejson
from zephyr.lib.time import datetime_to_timestamp, timestamp_to_datetime
def dump():
pointers = []
for activity in UserActivity.objects.s... | apache-2.0 | Python | |
c56eab117a2cdf652ce816190e69ccb7a0b171f9 | Create EmailEventLog.py | schandok/EmailEventLog | EmailEventLog.py | EmailEventLog.py | '''
This module emails event logs since the last saved time stamp. If no time stamp exists (1st time), last 10 events will be sent.
This module can be attached as a task in Windows Event Viewer to be executed when certain event is logged.
Configure the params below to macth the event that triggered the mod... | apache-2.0 | Python | |
9d76f77feebdf20b993385f7022334a4e964e0ad | Create ExampleImport.py | PhoduCoder/HelloWorld | ExampleImport.py | ExampleImport.py | #!/usr/bin/python
print ("This is from the ExampleImport Module")
| apache-2.0 | Python | |
e0a6f86983cb140f9686fe7a9d554707fbd32d52 | 添加celery 的tasks.py | yueyongyue/saltshaker,yueyongyue/saltshaker,yueyongyue/saltshaker | shaker/tasks.py | shaker/tasks.py | from celery import task
from shaker.shaker_core import *
from minions.models import Minions_status
from dashboard.models import *
from returner.models import *
import logging
logger = logging.getLogger('django')
sapi = SaltAPI()
@task()
def dashboard_task():
# minion status data save to mysql
status = sapi.ru... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.