commit
stringlengths
40
40
subject
stringlengths
1
1.49k
old_file
stringlengths
4
311
new_file
stringlengths
4
311
new_contents
stringlengths
1
29.8k
old_contents
stringlengths
0
9.9k
lang
stringclasses
3 values
proba
float64
0
1
2cfd4864df3536f7d8523a0f5f5ef98a5c6113af
add bootstrap.py
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...
Python
0.000003
4d021acd89abc127d50e6bf82064bd7aac2bca1a
Solve compree the string with groupby
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)]))
Python
0.999999
cf3a1c26ab650ad2a87d4b4dcc6754c70abde802
Create compat.py
backend/compat.py
backend/compat.py
Python
0.000001
f11ce837f0200d501c34c8fa7b2f5cfd149c18b6
Add db migrations
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...
Python
0
86657d78f220345391dc764db22cd9f02903f3a9
Add tests
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...
Python
0.000001
a383d1220c31f153a5519e4aab4703db2b71ef53
Add initial version of season goal leader retrieval
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]: ...
Python
0
10ce581d1ecbba29913982a56f32c3d93a1b54fe
Add Python benchmark
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...
Python
0.000138
66328709459b2217b3c964848a363c4f3b1cdf5e
Add Python benchmark
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...
Python
0.000138
37b175b6a6ac3f0fd7fdaa5c2ed6435c159a29c2
Add py solution for 553. Optimal Division
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...
Python
0.000072
e14c4f1aeb15491ecbf2981527e2409ab3e82653
Test for BuildQuerySet.concurrent logic
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...
Python
0
4c428b78f9bf4d5f044a23921a6f29df34c93753
add python process pool example
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))
Python
0.000001
565dab9ae60d6c7fa92d3385ef4515933850d4a0
Create __init__.py
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...
Python
0.000429
1199bba46cc16ec1285ab9d58fa1c74e9061f874
Create PedidoDeletar.py
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 ...
Python
0
8561fba46509db7f74f9770d71dd0ba41e4cb594
Add bids.ext namespace package for subpackages
bids/ext/__init__.py
bids/ext/__init__.py
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Python
0
a75b7cf5634e580b78c5f4cad9255735982b51d1
bump to 0.9.3
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...
Python
0.000008
ac9bcdea0ece3e34943471336499f42213ef5c47
Create zinnia_markitup module
zinnia_markitup/__init__.py
zinnia_markitup/__init__.py
"""MarkItUp for Django-blog-zinnia"""
Python
0
d61fc5b219186824b8b198c5a4679602372039da
Create leapBasic.py
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()
Python
0.000001
c25c0a9942345ed46d8091f7705cb26bbb21dfe5
add plugin test cases
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...
Python
0.000001
c4bad78b508369e7ef1c682114c0b04340ed371b
Create an abstract Player class
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...
Python
0.000063
a9ec0b508f9d59d0c920a53141d25de0d6eb1c5f
work in progress
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...
Python
0.000005
54afce985f7f24e74cd5796e12e3c5f2c4616590
Add Python script to generate (huge) test dumps.
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...
Python
0
f264a4a15682467549326cc530c152f647bf7832
Add a convenience python script to inline the imports of a file.
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: ...
Python
0
fa067ee22e89111848536c7fa9396575a8f31ac6
add testhttp.py.
examples/testhttp.py
examples/testhttp.py
from pythymiodw import ThymioReal t = ThymioReal() t.wheels(100,100) t.sleep(1) t.quit()
Python
0
5c40193fe8bce5601190223503d27e73cb8dff39
Create zip.py
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])):...
Python
0.000003
6701b9001b85b440f1cea8bdca5f93fb9abbf9b8
Add buzzer1 script(node)
scripts/buzzer1.py
scripts/buzzer1.py
#!/usr/bin/env python import rospy rospy.init_node('buzzer') rospy.spin()
Python
0
4f9db89ea1beae50c27f00f4e52279af60987df2
Set up sprint template script
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...
Python
0
3fc4f4305f59e3dc42478e1b0812aeaa1eee91fa
Add labview_remote_panels
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...
Python
0.000001
963c0479b22e1cc142b015b5afdccfb8c35aa4b6
Add initial SD cog
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 = ...
Python
0.000001
68ba7f13c0a1db663d97ffc8f1601eb15cfa52b3
Create wireless_scanner.py
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...
Python
0.000012
01c619826a32a78c121b1ded0c6c5cf3195a0cfe
refactor currency
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...
Python
0.999995
cdefa248cb481f8b8a676fd674a4290f95d15145
Add tool to fix MP4 file timestamp from GPMF GPS clock
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...
Python
0
5a36c269a89d5c2a835696a817ea24ea4d4ce72e
add script to performance of trace processor ingestion am: c893b17841 am: 69ca53841e am: b084bd3e82
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...
Python
0.000001
8103632a7acc080e8a9d108c047acffa2539c4b9
solve factorial problem
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))
Python
0.99882
08e52c671ef405c34e532f1ca29e7fc2ee6892d9
Add python script that should submit to view.cwl API
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...
Python
0
9700cf8aa468ce364067d1cdf80cd5e968aef08a
Create classification_examples.py
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/...
Python
0.000778
f498610ce8b4d9ec4b010e16a9d738c937ff3c72
add db only tests utility #96
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 ...
Python
0
af6b04531ebbb0d86bf0177f30e7691221e2b17e
fix date citation for gob's
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()
Python
0.000007
caf0ea95a03b06e09e640799a1f0d959658373ab
Create email.py
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'....
Python
0.000002
a11b064622f8dd56f76828f396d29072ece50ab9
Add Python benchmark
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...
Python
0.000138
4582d020ec6fe8ef6035fc4a4de484f557f2d026
Add 025
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...
Python
0.999153
6e44d244a11664798be24a88681f37aad9b0329e
add url
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)
Python
0.000013
48bfe2d20cca35885ad0a460679d0a951d0c584e
Add spider for Giant Eagle
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...
Python
0.00064
d29e7ff4153ddcf616f8d03c08f6f95e3a348263
Create command to calculate quantity of similar apps per app
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): ...
Python
0.000001
023e88f264274211674a100820d590dcee694445
Allow neutron network list to be used as pillar data
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::...
Python
0.000001
6df4cdd8fe629fabadd792d0b7507a57f9dc37b7
refactor tests
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...
Python
0.00002
2b0ade5407902c2b8d8a0853967bbe01c9e38e7e
test file for paraview functions
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...
Python
0
1f281a1279b7b185559d9d267a69ea24024c633e
Transpose of a Matrix
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]] ...
Python
0
bf98a5d06436a905aa5710db4a60f1e6b7c8f7fc
Add link local plugin
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...
Python
0
2ab796aeb53e650b8a1dd828b5daaca16850d9c3
Add tests for APNS message.
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...
Python
0
6064180a636ecbf5e25742b87fe1f2365ea1e8b5
add controlchar plugin
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 ...
Python
0
f491db91ed2608698d2d91558f41f544819684bf
Add python-copy to calvinsys
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 ...
Python
0.000018
5975fc773b1dff894fbd3f9dcff34c88dd52a17b
Create Random-Word-Constructor.py
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',...
Python
0.000001
f62f8971bcaddc93cf9993e7ff0e4bfd70e0735d
Connect attribute filling signal to profile to dic function.
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...
Python
0
ff6d8d03f2db6842fd6f8ef539f31310ed66dd18
Add API endpoint RBAC tests for webhooks get all and get one controller.
st2api/tests/unit/controllers/v1/test_webhooks_rbac.py
st2api/tests/unit/controllers/v1/test_webhooks_rbac.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
Python
0
e1429aab658337a2bb293c4d157a0839553d96d7
work on user configuration
config.py
config.py
#!/usr/bin/env python ''' description: Configuration part of wrfpy license: APACHE 2.0 author: Ronald van Haren, NLeSC (r.vanharen@esciencecenter.nl) ''' import json import os import utils class config: ''' description ''' def __init__(self): home = os.path.expanduser("~") # get users ...
Python
0.000001
88bb5d1a42b817a000f10ec0989282c0998cc1b0
Add approved and open
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...
Python
0.000001
9bfbf6eb6f65fa745d0ef3777ad4486f47c69b87
Add pose_to_kml.py formatting script
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...
Python
0.000001
846ce88f199381387f612463da51c6b17281dd21
Add script for checking Python3 compatibility
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...
Python
0.000002
4402506527cbc7dfbf648a90e4e2c665e27a5a34
Add new package: py-rbtools (#18963)
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 ...
Python
0.000001
88d9e6bd216bee0c78f437bdf15362efbebe2e0b
Create new package. (#6504)
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...
Python
0
5558cce438134c722a8c96d7d2badc03b6fd45f5
Create new package. (#6214)
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...
Python
0
28c6f1ddc23ee170522b1225bbf60f9b1d244189
Add new package: logrotate (#18786)
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...
Python
0
8fe2be0010e45f6b2ba339f5a7fe350bb7efed42
add new package (#24045)
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...
Python
0
39a826531ac716976285b03aefc253b10cbb5061
Add script to generate get responses.
sli/config/scripts/documentation/gr.py
sli/config/scripts/documentation/gr.py
# gr.py <urls-file> <request base url> <print base url> <oauth token> # linda.kim 4cf7a5d4-37a1-ca19-8b13-b5f95131ac85 # rrogers 4cf7a5d4-37a1-ca19-8b13-b5f95131ac85 # python gr.py urls-nocustom http://local.slidev.org:8080/api/rest/v1/ https://localhost/api/rest/v1/ cacd9227-5b14-4685-babe-31230476cf3b import sys im...
Python
0
9363331f96805bcc180a081cf9d28b5dab70e25b
Create undoclose.py
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'...
Python
0.000003
f0d86dbc61a12aaa3eec91f9ef2daba756e44925
Add a script to mimic DDPG of the TD3 paper
examples/mujoco/ddpg/train_ddpg.py
examples/mujoco/ddpg/train_ddpg.py
from __future__ import print_function from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() # NOQA import argparse import logging import os import sys import chainer from chainer import fun...
Python
0
37cc64eec2681c4a1e8d3ad3c7f5971ce4c0c6e8
add home view
kitty/views.py
kitty/views.py
from django.shortcuts import render_to_response def home(request): return render_to_response('welcome_page.html')
Python
0
e9813045f95b8d524e17c7938db0f4df7c29e7bf
day 14
2019/14.py
2019/14.py
#!/usr/bin/env python3 import sys def parse(s): a, b = s.split(" ") return int(a), b def has(side, x): return any(x == s[1] for s in side) def consumes(rxn, x): return has(rxn[0], x) def produces(rxn, x): return has(rxn[1], x) def go(producers, num): required = {"FUEL": num} produced ...
Python
0.999563
f226ab5b8ecd4faa80a349ab033702d716a6864c
Add initial migration
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...
Python
0
e3665928c80da9df192f8edb5dc28e3200e34fdc
Add a "image me [thing]" handler
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)) @...
Python
0.999936
fbc5b10b977d20cff340cfb130cec22d49842b5a
Add repos admin
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)
Python
0
f1189f4774e469e39097e4d10159425a9ed40757
Bump version to 2013.1
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 ...
Python
0
1681651b7d606436550aad3d696f5f1ba335caa9
Add dump_useractivity migration helper tool.
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...
Python
0
c56eab117a2cdf652ce816190e69ccb7a0b171f9
Create EmailEventLog.py
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...
Python
0.000001
9d76f77feebdf20b993385f7022334a4e964e0ad
Create ExampleImport.py
ExampleImport.py
ExampleImport.py
#!/usr/bin/python print ("This is from the ExampleImport Module")
Python
0
e0a6f86983cb140f9686fe7a9d554707fbd32d52
添加celery 的tasks.py
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...
Python
0
ef8d86704c0930091b8b8f07842e46ffff5bfc34
Correct empty lines in imported files
correct_empty_lines.py
correct_empty_lines.py
print('\n\n\n\n') print('Now:\n') for p in c.all_positions(): try: # Corrects empty lines around @language python\n@tabwidth -4 if p.h.startswith('@clean') and p.h.endswith('py'): # Corrects empty lines after @first if p.h == '@clean manage.py': splited = p....
Python
0.000039
08e6a7821283da3898d2eeb4418b6e035effb2f0
Create spelling_bee.py
spelling_bee.py
spelling_bee.py
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Spelling Bee #Problem level: 6 kyu def how_many_bees(hive): if not hive: return 0 count = 0 for i in range(len(hive)): for j in range(len(hive[i])): try: if hive[i][j]=='b' and hive[i][j+1]=='e' and hive[i][j+2]=='e'...
Python
0.999938
706f29660c9fe6f21af3544ea7871ffdfd56db4a
Create sprintreport.py
sprintreport.py
sprintreport.py
from jirawrapper import JIRAWrapper import sys import getopt if __name__ == "__main__": argv = sys.argv[1:] print_help = lambda: print('sprintreport.py [-p project] -c <username:password>') try: opts, args = getopt.getopt(argv, "p:c:", ["project=", "credentials="]) except getopt.GetoptError: ...
Python
0.000001
729ab39844bcf6700ccdeb28955e90220d2bab86
convert ip v4
base/convert_ip.py
base/convert_ip.py
import socket from binascii import hexlify def convert_ip4_address(): for ip_addr in ['127.0.0.1','192.168.0.1']: packed_ip_addr = socket.inet_aton(ip_addr) unpacked_ip_addr = socket.inet_ntoa(packed_ip_addr) print "IP Address : %s => Packed: %s, Unpacked: %s"\ %(ip_addr, hexlify(pa...
Python
0.999975
d427012df993dcffb77de05502fcc170cff6cdcb
Add Notebook test
datasciencebox/tests/salt/test_notebook.py
datasciencebox/tests/salt/test_notebook.py
import pytest import requests import utils def setup_module(module): utils.invoke('install', 'notebook') @utils.vagranttest def test_salt_formulas(): project = utils.get_test_project() kwargs = {'test': 'true', '--out': 'json', '--out-indent': '-1'} out = project.salt('state.sls', args=['ipython.n...
Python
0
1380ee2a9eff29bd1271eb0e920b75752f7346c7
Add (transitional?) db_oldrotate.py that finds exif rotate in old posts.
db_oldrotate.py
db_oldrotate.py
#!/usr/bin/env python # -*- coding: iso-8859-1 -*- from pyexiv2 import Image as ExivImage from db_add import exif2rotation from dbclient import dbclient client = dbclient() posts = client._search_post("SPFrotate", ["rotate"]) print len(posts), "posts" for post in posts: if post["rotate"] == -1: m = post["md5"] e...
Python
0
7da454aafc0821a6692edb9f829d0bd2e841c534
Add tool support for DIVINE.
benchexec/tools/divine.py
benchexec/tools/divine.py
""" BenchExec is a framework for reliable benchmarking. This file is part of BenchExec. Copyright (C) 2007-2015 Dirk Beyer All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at ...
Python
0
35eee909fa90d06efa34a39667db6345725bc177
Add tool _list paging test
Allura/allura/tests/functional/test_tool_list.py
Allura/allura/tests/functional/test_tool_list.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (t...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (t...
Python
0
64b03bd53f6f494398818199caabe10138469719
Create couples-holding-hands.py
Python/couples-holding-hands.py
Python/couples-holding-hands.py
# Time: O(n) # Space: O(n) class Solution(object): def minSwapsCouples(self, row): """ :type row: List[int] :rtype: int """ N = len(row)//2 couples = [[] for _ in xrange(N)] for seat, num in enumerate(row): couples[num//2].append(seat//2) ...
Python
0.000001
364de0a95b868bba980bfe6445cd80f55b39bb63
add amber ti estimator test code
src/alchemlyb/tests/test_ti_estimators_amber.py
src/alchemlyb/tests/test_ti_estimators_amber.py
"""Tests for all TI-based estimators in ``alchemlyb``. """ import pytest import pandas as pd from alchemlyb.parsing import amber from alchemlyb.estimators import TI import alchemtest.amber def amber_simplesolvated_charge_dHdl(): dataset = alchemtest.amber.load_simplesolvated() dHdl = pd.concat([amber.ext...
Python
0.000061
a8f4d9252016aa9c656ad6d06558b520af06b489
Create spyne_webservice.py
PythonTests/spyne_webservice.py
PythonTests/spyne_webservice.py
""" USE: Wizdler Chrome Extension from suds.client import Client c = Client('http://localhost:8008/...?wsdl') c.service.SmokeTest('XXX') """ response_file = '$RESP_FILE' from spyne import Application, rpc, ServiceBase, Iterable, Integer, Unicode from spyne.protocol.soap import Soap11 from spyne.server.wsgi import Wsg...
Python
0.000001
f4b1ad081dc6a7e83d0342d00c82549cde72c3fa
improve user search capabilities
src/sentry/api/endpoints/user_index.py
src/sentry/api/endpoints/user_index.py
from __future__ import absolute_import import six from django.db.models import Q from sentry.api.base import Endpoint from sentry.api.paginator import DateTimePaginator from sentry.api.permissions import SuperuserPermission from sentry.api.serializers import serialize from sentry.db.models.query import in_iexact fro...
from __future__ import absolute_import import six from django.db.models import Q from sentry.api.base import Endpoint from sentry.api.paginator import DateTimePaginator from sentry.api.permissions import SuperuserPermission from sentry.api.serializers import serialize from sentry.db.models.query import in_iexact fro...
Python
0.000001
ecabc90a6f55fdd2fa0d0ed789b72d3196d3e2eb
Correct query to members and pending members
src/sentry/web/forms/teams.py
src/sentry/web/forms/teams.py
""" sentry.web.forms.teams ~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from django import forms from sentry.models import Team, TeamMember, PendingTeamMember from sentry.web.forms.fields import UserField from djang...
""" sentry.web.forms.teams ~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from django import forms from sentry.models import Team, TeamMember, PendingTeamMember from sentry.web.forms.fields import UserField from djang...
Python
0.998939
9a6fe771ba03cd64c4f6d764125457ed808feca2
Add datacite harvester
scrapi/harvesters/datacite.py
scrapi/harvesters/datacite.py
''' Harvester for the DataCite MDS for the SHARE project Example API call: http://oai.datacite.org/oai?verb=ListRecords&metadataPrefix=oai_dc ''' from __future__ import unicode_literals from scrapi.base import OAIHarvester from scrapi.base.helpers import updated_schema, oai_extract_dois class DataciteHarvester(OAIH...
Python
0.000001
c63f2e2993b0c32d7bc2de617dfb147c0f6a2d89
patch fix
erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py
erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py
from __future__ import unicode_literals import frappe def execute(): for doctype in ["Sales Person", "Customer Group", "Item Group", "Territory"]: # convert to 1 or 0 frappe.db.sql("update `tab{doctype}` set is_group = if(is_group='Yes',1,0) " .format(doctype=doctype)) frappe.db.commit() # alter field...
import frappe def execute(): for doctype in ["Sales Person", "Customer Group", "Item Group", "Territory"]: frappe.reload_doctype(doctype) #In MySQL, you can't modify the same table which you use in the SELECT part. frappe.db.sql(""" update `tab{doctype}` set is_group = 1 where name in (select parent_{fiel...
Python
0.000001
70b2fcb7ca85878b2012cab8c476b40f2624e7ee
Add migration new_name
geotrek/trekking/migrations/0003_auto_20181113_1755.py
geotrek/trekking/migrations/0003_auto_20181113_1755.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-11-13 16:55 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('trekking', '0002_trek_pois_excluded'), ] operations = [ migrations.AlterFi...
Python
0.000009
43fbaa6c109c51a77832d6f09e0543794882b518
Add scripts printing special:mode.yml from model.npz
scripts/contrib/model_info.py
scripts/contrib/model_info.py
#!/usr/bin/env python3 import sys import argparse import numpy as np import yaml DESC = "Prints version and model type from model.npz file." S2S_SPECIAL_NODE = "special:model.yml" def main(): args = parse_args() model = np.load(args.model) if S2S_SPECIAL_NODE not in model: print("No special Ma...
Python
0
89aaf8161bb776db672949e9e48f8f9af1b45837
Delete subscriptions list
scripts/delete_subscr_list.py
scripts/delete_subscr_list.py
# -*- coding: utf-8 -*- # # Author: Cayetano Benavent, 2016. # cayetano.benavent@geographica.gs # # 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 ...
Python
0.000002
7ce1d49c5528b763c5f5915ea71c5cade07c47a7
Add new purefa_pgsnap module
lib/ansible/modules/storage/purestorage/purefa_pgsnap.py
lib/ansible/modules/storage/purestorage/purefa_pgsnap.py
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, Simon Dodsley (simon@purestorage.com) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1',...
Python
0
0ad94dd854172f008156ec599ad8324091361fca
Create Sakula.py
Sakula.py
Sakula.py
#!/usr/bin/env python ''' Sakula Rat Rat Config Extractor ''' __description__ = 'Sakula Rat Config Extractor' __author__ = 'Kevin Breen http://techanarchy.net http://malwareconfig.com' __version__ = '0.1' __date__ = '2015/11/10' #Standard Imports Go Here import os import re import sys import string from struct import ...
Python
0
af5e58c2fefdffa8046ecace238a3fd1a2a43387
Add Naive Bayes base class:
ML/naivebayes.py
ML/naivebayes.py
""" Naive Bayes Classifier Includes gaussian, bernoulli and multinomial models """ import abc import numpy as np class NaiveBayes: """ Naive Bayes Classifier Given class label, assumes features are independent """ __metaclass__ = abc.ABCMeta def __init__(self): """ Attributes...
Python
0.000001
9d27a2f2791a26c3ff326d16001363ef48650596
Rename jokes.py to geek.py and separate explicit jokes
pyjokes/geek.py
pyjokes/geek.py
# -*- coding: utf-8 -*- """ Jokes from stackoverflow - provided under CC BY-SA 3.0 http://stackoverflow.com/questions/234075/what-is-your-best-programmer-joke?page=4&tab=votes#tab-top """ geek_neutral = [ "A SQL query goes into a bar, walks up to two tables and asks, 'Can I join you?'", "When your hammer is C...
Python
0.998826
837e9db39b2c9010a5cc43f21821b5dec90a18b1
add rdds.fileio to setup.py
python/setup.py
python/setup.py
#!/usr/bin/env python from setuptools import setup import thunder setup( name='thunder-python', version=str(thunder.__version__), description='Large-scale neural data analysis in Spark', author='The Freeman Lab', author_email='the.freeman.lab@gmail.com', url='https://github.com/freeman-lab/thu...
#!/usr/bin/env python from setuptools import setup import thunder setup( name='thunder-python', version=str(thunder.__version__), description='Large-scale neural data analysis in Spark', author='The Freeman Lab', author_email='the.freeman.lab@gmail.com', url='https://github.com/freeman-lab/thu...
Python
0
ee3b5d0d14403bd5964f0609eb48848833bff2c0
Add a draft for a backup class
quilt/backup.py
quilt/backup.py
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80: # python-quilt - A Python implementation of the quilt patch system # # Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as ...
Python
0