commit stringlengths 40 40 | subject stringlengths 1 3.25k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | old_contents stringlengths 0 26.3k | lang stringclasses 3
values | proba float64 0 1 | diff stringlengths 0 7.82k |
|---|---|---|---|---|---|---|---|
8deb311e6196c618f9ae3f18d18c1827407b8b96 | Add a snippet. | python/pyside/pyside6/widget_QSqlTableModel_sqlite_from_file.py | python/pyside/pyside6/widget_QSqlTableModel_sqlite_from_file.py | Python | 0.000002 | @@ -0,0 +1,1145 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A# Ref: http://doc.qt.io/qt-5/modelview.html#2-1-a-read-only-table%0A%0Aimport sys%0Afrom PySide6 import QtCore, QtWidgets%0A%0Afrom PySide6.QtCore import Qt%0Afrom PySide6.QtWidgets import QApplication, QTableView%0Afrom PySide6.QtSql import QSql... | |
1fe2e3b2ed933f22ce128ca1ea8c728981009a44 | Add squashed migration | billjobs/migrations/0002_service_is_available_squashed_0005_bill_issuer_address_default.py | billjobs/migrations/0002_service_is_available_squashed_0005_bill_issuer_address_default.py | Python | 0.000002 | @@ -0,0 +1,1157 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.4 on 2016-03-21 16:55%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Afrom billjobs.settings import BILLJOBS_BILL_ISSUER%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A replaces = %5B('billjobs', '0... | |
fb41c5295d867dc9ac6ec64da3646246c897e109 | add running time of algorithms | src/algorithms/arrays_and_sorting/running_time_of_algorithms.py | src/algorithms/arrays_and_sorting/running_time_of_algorithms.py | Python | 0.000162 | @@ -0,0 +1,325 @@
+number = input()%0Anumber_array = %5B(int)(x) for x in raw_input().split()%5D%0Atotal = 0%0Afor i in range(1, number):%0A%09for j in range(i):%0A%09%09ii = number_array%5Bi%5D%0A%09%09jj = number_array%5Bj%5D%0A%09%09if ii %3C jj:%0A%09%09%09total += i - j%0A%09%09%09number_array = number_array%5B:j... | |
1f062298a68aaf6a4161279c539caed07816f1a8 | Add tests for influxdb/alarm_state_history_repository.py | monasca_persister/tests/test_influxdb_alarm_state_history_repository.py | monasca_persister/tests/test_influxdb_alarm_state_history_repository.py | Python | 0.000001 | @@ -0,0 +1,3041 @@
+# (C) Copyright 2019 Fujitsu Limited%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required... | |
1cd457765727a0a65d02ddc9ea164af4913448c6 | Create a python file | InternetOfThings101/main.py | InternetOfThings101/main.py | Python | 0 | @@ -0,0 +1,270 @@
+import time%0Aimport sys%0Aimport signal%0A%0Adef interruptHandler(signal, frame):%0A sys.exit(0)%0A%0Aif __name__ == '__main__':%0A%0A signal.signal(signal.SIGINT, interruptHandler)%0A%0A while True:%0A print %22Hello Internet of Things 101%22%0A time.sleep(5)%0A%0A# End of Fi... | |
2e9f43d1c1679355e2d7d452137ddf7fb2bbdedf | Test Basic.Publish -> Basic.Get message passing | tests/async-send-get-test.py | tests/async-send-get-test.py | Python | 0 | @@ -0,0 +1,1603 @@
+#!/usr/bin/env python%0A%22%22%22%0ASend a message and confirm you can retrieve it with Basic.Get%0ATest Steps:%0A%0A1) Connect to broker - start_test%0A2) Open Channel - on_connected%0A3) Delcare Queue - on_channel_open%0A4) Send test message - on_queue_declared%0A5) Call basic... | |
2cb8f7b2df2583c9fdb545744adad2386b4ee7f3 | Add test for issue #2465 - tuple subsclass subscript | tests/basics/subscr_tuple.py | tests/basics/subscr_tuple.py | Python | 0 | @@ -0,0 +1,87 @@
+# subscripting a subclassed tuple%0Aclass Foo(tuple):%0A pass%0A%0Afoo = Foo((1,2))%0Afoo%5B0%5D%0A%0A
| |
7d46f6e714be4b53a800c72f800d400ef6b280c4 | add tests for core functions | tests/test_core_functions.py | tests/test_core_functions.py | Python | 0 | @@ -0,0 +1,1113 @@
+from pygelf import gelf%0Aimport json%0Aimport zlib%0Aimport struct%0Aimport pytest%0A%0A%0A@pytest.mark.parametrize('compress', %5BTrue, False%5D)%0Adef test_pack(compress):%0A message = %7B'version': '1.1', 'short_message': 'test pack'%7D%0A packed_message = gelf.pack(message, compress)%0A ... | |
2c665dbcb90785b9754f89cb6a0d3d9c3ffddc95 | Add test | tests/test_proxy_nca_loss.py | tests/test_proxy_nca_loss.py | Python | 0.000005 | @@ -0,0 +1,2037 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Tue Feb 07 19:23:18 2017%0A%0A@author: sakurai%0A%22%22%22%0A%0A%0Aimport unittest%0A%0Aimport numpy as np%0A%0Aimport chainer%0Afrom chainer import cuda%0Afrom chainer import gradient_check%0Afrom chainer import testing%0Afrom chainer.testing import ... | |
703a5556174706db330c8d2e426471e490a00cef | Switch rottentomatoes to xfail rather than skip test. | tests/test_rottentomatoes.py | tests/test_rottentomatoes.py | from __future__ import unicode_literals, division, absolute_import
from nose.plugins.skip import SkipTest
class TestRottenTomatoesLookup(object):
config = """
tasks:
test:
mock:
# tests search
- {title: 'Toy Story'}
- {title: 'The Matrix'}... | Python | 0 | @@ -65,50 +65,24 @@
rt%0A%0A
-from nose.plugins.skip
import
-SkipT
+pyt
est%0A%0A%0A
-%0A
clas
@@ -723,16 +723,80 @@
%22%22%22%0A%0A
+ @pytest.mark.xfail(reason='This plugin seems to be broken')%0A
def
@@ -856,65 +856,8 @@
r):%0A
- raise SkipTest('This plugin seems to be broken')%0A
|
ecdda7cf81cb3feb353a1d62441eff92aed082af | Add aggregationtypes to routes | iatidataquality/aggregationtypes.py | iatidataquality/aggregationtypes.py | Python | 0.000001 | @@ -0,0 +1,3204 @@
+%0A# IATI Data Quality, tools for Data QA on IATI-formatted publications%0A# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith%0A#%0A# Copyright (C) 2013 Publish What You Fund%0A#%0A# This programme is free software; you may redistribute and/or modify%0A# it under the terms of the GN... | |
e7e51333133dd561e8a746144c29c6635d8a982a | Add migration to add column for proposal image filename | migrations/versions/320f4eb0698b_add_proposal_image.py | migrations/versions/320f4eb0698b_add_proposal_image.py | Python | 0 | @@ -0,0 +1,622 @@
+%22%22%22add proposal image%0A%0ARevision ID: 320f4eb0698b%0ARevises: 26ef95fc6f2c%0ACreate Date: 2015-03-31 15:55:20.062624%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '320f4eb0698b'%0Adown_revision = '26ef95fc6f2c'%0A%0Afrom alembic import op%0Aimport sqlalchemy as sa%... | |
4990f7c761382654c7577e8c23527ea3c1f8a773 | Patch for saving the pose | models/tridimensional/docking_validation/mutate_pdb.py | models/tridimensional/docking_validation/mutate_pdb.py | import os
from rosetta import *
from toolbox import mutate_residue
def mutate_pose(pose, mutations):
"""Applies list of mutations to the given template pose and returns a mutated version
Args:
pose: PyRosetta Pose() object representing a loaded pdb structure
mutations: list of amino acid swap... | Python | 0 | @@ -2756,16 +2756,20 @@
ant.dump
+_pdb
(output_
|
2233b8cb2e59e4304492b60eb9842962130e14c2 | Create NoisyNeighborsClosedForm.py | NoisyNeighborsClosedForm.py | NoisyNeighborsClosedForm.py | Python | 0 | @@ -0,0 +1,2180 @@
+# Google Code Jam%0A# Google Code Jam 2015%0A# Round 1B%0A# Problem B. Noisy Neighbors%0A%0A# Closed form solution O(1)%0A%0Afrom math import ceil%0A%0AtestCaseFile = open(%22NoisyNeighbors_B-large-practice.in%22, %22r%22)%0Alines = testCaseFile.read().split('%5Cn')%0An = int(lines%5B0%5D)%0AtestCas... | |
f39947677bc2eaf15a0a9d5ef976a29905b23339 | Add AirQuality notification | PushAirQuality.py | PushAirQuality.py | Python | 0 | @@ -0,0 +1,644 @@
+from twitter import *%0Afrom pushbullet import PushBullet%0Aimport config%0A%0ACONSUMER_KEY = config.twitter_consumer_key%0ACONSUMER_SECRET = config.twitter_consumer_secret%0AOAUTH_TOKEN = config.twitter_oauth_token%0AOAUTH_SECRET = config.twitter_oauth_secret%0Apb_api_key = config.pb_api_key%0A%0A%0... | |
d4b86bc3b4440d665eb8119828a9ffe241b321a6 | Update 24-game.py | Python/24-game.py | Python/24-game.py | # Time: O(n^3 * 4^n)
# Space: O(n^2)
from fractions import Fraction
from operator import *
class Solution(object):
def judgePoint24(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
def dfs(nums):
if len(nums) == 1:
return nums[0] == 24
... | Python | 0 | @@ -14,16 +14,23 @@
3 * 4%5En)
+, n = 4
%0A# Space
|
fcf0ed3c4e2deb9ce1d6a758dc18e6a03542eb59 | Add a script to find parties with multiple emblems (logos) from the EC | candidates/management/commands/candidates_parties_with_multiple_emblems.py | candidates/management/commands/candidates_parties_with_multiple_emblems.py | Python | 0 | @@ -0,0 +1,842 @@
+from django.core.management.base import BaseCommand%0A%0Afrom candidates.popit import create_popit_api_object, popit_unwrap_pagination%0A%0Aclass Command(BaseCommand):%0A%0A def handle(self, *args, **options):%0A api = create_popit_api_object()%0A%0A for org in popit_unwrap_paginatio... | |
0f6e065a70bcd1f9dd64dfa04c13cb0065e33c13 | Add basic test for navigator | src/autobot/src/navigator_test.py | src/autobot/src/navigator_test.py | Python | 0.000002 | @@ -0,0 +1,1033 @@
+#!/usr/bin/env python%0Aimport unittest%0Aimport mock%0Afrom autobot.msg import detected_object%0Afrom navigator import *%0A%0A%0Adef fake_stopCar():%0A return True%0A%0A%0Adef fake_srvTogglePathFinder(state):%0A return%0A%0A%0Adef fake_setWallDist(dist, wall):%0A return%0A%0A%0Aclass Navig... | |
bebe5ba7bddd0facf0f5d64d1123d1139fab789e | Remove line overwritting history | axelrod/tests/unit/test_player.py | axelrod/tests/unit/test_player.py | import copy
import random
import unittest
import axelrod
C, D = 'C', 'D'
def cooperate(self):
return 'C'
def defect(self):
return 'D'
class TestPlayerClass(unittest.TestCase):
name = "Player"
player = axelrod.Player
stochastic = False
def test_add_noise(self):
random.seed(1)
... | Python | 0.000002 | @@ -1387,46 +1387,8 @@
ry)%0A
- self.history = player.history%0A
|
dc72a321311f213132ef448afecbe7a0797aede8 | Fix for GLUT | vispy/app/tests/test_context.py | vispy/app/tests/test_context.py | import os
from nose.tools import assert_equal, assert_raises
from vispy.util.testing import requires_application, has_backend
from vispy.app import Canvas
from vispy.app.backends import BACKEND_NAMES
from vispy.gloo import (get_gl_configuration, VertexShader, FragmentShader,
Program, check_erro... | Python | 0.000001 | @@ -1323,28 +1323,8 @@
t()%0A
- cannot = list()%0A
@@ -1357,45 +1357,8 @@
ES:%0A
- if has_backend(backend):%0A
@@ -1407,20 +1407,16 @@
ext'%5D):%0A
-
@@ -1447,60 +1447,119 @@
- else:%0A cannot.append(backend)
+# We could also test backends that can'... |
d11d7c38edef63e50dbd1da78a8829905a86c2a5 | Add forgotten file | bluebottle/assignments/states.py | bluebottle/assignments/states.py | Python | 0.000001 | @@ -0,0 +1,309 @@
+from bluebottle.activities.states import ActivityStateMachine, ContributionStateMachine%0A%0Afrom bluebottle.assignments.models import Assignment, Applicant%0A%0A%0Aclass AssignmentStateMachine(ActivityStateMachine):%0A model = Assignment%0A%0A%0Aclass ApplicantStateMachine(ContributionStateMachin... | |
98f26afc012b1ab25360738776c36b58229d0b3a | Add CLI interface. | fulltext/__main__.py | fulltext/__main__.py | Python | 0 | @@ -0,0 +1,725 @@
+%22%22%22%0AFulltext CLI interface.%0A%22%22%22%0A%0Afrom __future__ import absolute_import%0A%0Aimport sys%0Aimport logging%0A%0Afrom docopt import docopt%0A%0Aimport fulltext%0A%0A%0Adef _handle_open(path):%0A with open(path, 'rb') as f:%0A return fulltext.get(f)%0A%0A%0Adef main(args=sys... | |
5666161f59a8c3efa5b3f884912f9777c9a12edd | Add the ability to get template variables from the CLI | saliere/main.py | saliere/main.py | #!/usr/bin/python3
"""Creates a skeleton for various projects based on Jinja2 templates.
Example:
$ main.py mysql -t salt-formula
$ main.py mysql-django -t django
$ main.py mysql -t salt-formula -o my-formula-directory
$ main.py mysql -t ~/my/custom/template -o my-template-directory
"""
import argpar... | Python | 0 | @@ -1332,16 +1332,97 @@
ype=str)
+%0A parser.add_argument(%22--var%22, default=None, help=%22template values%22, type=str)
%0A%0A #
@@ -2154,16 +2154,251 @@
s.type%0A%0A
+ # Load the template variables, if any, from the command line.%0A if args.var:%0A vars_split = args.var.split('%7C')%0A ... |
1dc11286b21d8a84e3d1d9a194cc49275be4d97d | Add core models example factories | apps/core/factories.py | apps/core/factories.py | Python | 0 | @@ -0,0 +1,1335 @@
+from factory import Faker, Iterator, SubFactory%0Afrom factory.django import DjangoModelFactory%0A%0Afrom apps.data.factories import EntryFactory, RepositoryFactory%0Afrom . import models%0A%0A%0Aclass SpeciesFactory(DjangoModelFactory):%0A%0A name = Faker('word')%0A reference = SubFactory(Ent... | |
38e231076209f0d71ee64bd4d60e1769aac8ce93 | add raspberry pi receiver script | power_monitor_rf24.py | power_monitor_rf24.py | Python | 0 | @@ -0,0 +1,1909 @@
+#!/usr/bin/env python%0A%0A# receive values from CS5460A power monitor via NRF24L01%0A# may need to run as sudo%0A# see https://github.com/zerog2k/power_meter_cs5460a for arduino transmitter code%0A%0Aimport time as time%0Afrom RF24 import *%0Aimport RPi.GPIO as GPIO%0Aimport binascii%0Aimport st... | |
3b33a9410bac5b710a52e603fd40ed88765b7414 | Create colecoes.py | colecoes/colecoes.py | colecoes/colecoes.py | Python | 0 | @@ -0,0 +1,360 @@
+from aula5.pessoa import import Pessoa%0Afrom aula6.pessoas_tipos import Homem, Mulher%0A%0Aif __name__=='__main__':%0A gomes = Homem('Gomes')%0A gomes_igual = Homem('Gomes')%0A gomes_identico=gomes%0A selina=Mulher('Selina')%0A print(gomes is gomes_igual)%0A print(gomes is gomes_... | |
0f06b139ecfbdb05dee86b4cbda5b23c9af4379a | test private name | chap5/test_private_name_coven.py | chap5/test_private_name_coven.py | Python | 0.000011 | @@ -0,0 +1,255 @@
+#!/usr/bin/python%0A# -*- indent-tabs-mode: nil; tab-width: 4 -*-%0A# vi: et ts=4 sts=4 sw=4%0Aclass Foo:%0A def __priv(self):%0A print %22I'm private%22%0A%0Adef main():%0A foo = Foo()%0A getattr(Foo, '_Foo__priv')(foo)%0A%0Aif __name__ == '__main__':%0A main()%0A%0A
| |
c48bf268ec7e077443ad347f007d7477d841cc04 | Add ds_binary_heap.py | ds_binary_heap.py | ds_binary_heap.py | Python | 0.000853 | @@ -0,0 +1,237 @@
+from __future__ import absolute_import%0Afrom __future__ import division%0Afrom __future__ import print_function%0A%0Aclass BinaryHeap(object):%0A def __init__(self):%0A pass%0A%0A%0Adef main():%0A pass%0A%0A%0Aif __name__ == '__main__':%0A main()%0A%0A
| |
cd1c67c34768bdef0cc4649573e2541558e648ad | Add : Basic client implementation | elevator/client.py | elevator/client.py | Python | 0 | @@ -0,0 +1,1308 @@
+#!/usr/bin/env python%0A#Copyright (c) 2011 Fabula Solutions. All rights reserved.%0A#Use of this source code is governed by a BSD-style license that can be%0A#found in the license.txt file.%0A%0A# leveldb client%0Aimport zmq%0Aimport threading%0Aimport time%0Aimport ujson as json%0A%0Aclass Elevato... | |
fc40c3f740f9f5dedbcddd4dcbd274c76aaba529 | Add ToS script | output/tos.py | output/tos.py | Python | 0 | @@ -0,0 +1,961 @@
+#!/usr/bin/python%0D%0A# -*- coding: utf-8 -*-%0D%0A%0D%0A%22%22%22tos.py - Accept PokemonGo ToS for multiple accounts using file.%22%22%22%0D%0A%0D%0Afrom pgoapi import PGoApi%0D%0Afrom pgoapi.utilities import f2i%0D%0Afrom pgoapi import utilities as util%0D%0Afrom pgoapi.exceptions import AuthExcep... | |
db4f449be99d7b66bd7c46a1a3af8b46424421c6 | Add tests for DummyCurrentPlaylistController.get_by_{id,uri} | tests/backends/get_test.py | tests/backends/get_test.py | Python | 0 | @@ -0,0 +1,1739 @@
+import unittest%0A%0Afrom mopidy.backends.dummy import DummyBackend, DummyCurrentPlaylistController%0Afrom mopidy.models import Playlist, Track%0A%0Aclass CurrentPlaylistGetTest(unittest.TestCase):%0A def setUp(self):%0A self.b = DummyBackend()%0A self.c = self.b.current_playlist%0A... | |
069a031ce871125fb727a5ec43f406539be0150f | add .mdown ext in check_ext | simiki/utils.py | simiki/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from os import path as osp
RESET_COLOR = "\033[0m"
COLOR_CODES = {
"debug" : "\033[1;34m", # blue
"info" : "\033[1;32m", # green
"warning" : "\033[1;33m", # yellow
"error" : "\033[1;31m", # red
"critical" : "\033... | Python | 0.000001 | @@ -934,16 +934,26 @@
%22.mkd%22,
+ %22.mdown%22,
%22.markd
|
f68c673273acbc62259213ceb47bb34e7d3f87fd | Create combination_test.py | test/combination_test.py | test/combination_test.py | Python | 0.000004 | @@ -0,0 +1,779 @@
+%0Adef loop(array_input, com_len, head, array_output):%0A n= com_len-1;sign=range(head+1,head+com_len)%0A while(sign%5Bn-1%5D%3C=len(array_input)-n):%0A core(head,sign, n,array_input,array_output)%0A sign=%5Bx + 1 for x in sign%5D %0A%0A %0Adef core(head, sign, n, array_inp... | |
cc7ff0ef2ce94b0ac39af4c03d08f8a82bc2ff53 | Print installation instruction | tests/sync_test_megacli.py | tests/sync_test_megacli.py | """
Application for testing syncing algorithm
(c) 2013-2014 by Mega Limited, Wellsford, New Zealand
This file is part of the MEGA SDK - Client Access Engine.
Applications using the MEGA API must present a valid application key
and comply with the the rules set forth in the Terms of Service.
The MEGA SDK is di... | Python | 0 | @@ -4777,24 +4777,151 @@
ng.info(%22%22)%0A
+ logging.info(%22 Make sure you have unittest module installed: pip install unittest-xml-reporting%22)%0A logging.info(%22%22)%0A
time.sle
|
c9b61a3f2599826d17f8a667837b0663be0ce6d0 | Revert "TEST: isposinf and isneginf is now also tested with complex values" | numpy/lib/tests/test_ufunclike.py | numpy/lib/tests/test_ufunclike.py | from __future__ import division, absolute_import, print_function
import numpy as np
import numpy.core as nx
import numpy.lib.ufunclike as ufl
from numpy.testing import (
assert_, assert_equal, assert_array_equal, assert_warns
)
class TestUfunclike(object):
def test_isposinf(self):
for dtype in [... | Python | 0 | @@ -295,57 +295,8 @@
f):%0A
- for dtype in %5Bnp.float, np.complex%5D:%0A
@@ -353,35 +353,18 @@
0, -3.0%5D
-, dtype=dtype)%0A
+)%0A
@@ -393,36 +393,32 @@
, bool)%0A
-
-
tgt = nx.array(%5B
@@ -460,36 +460,32 @@
alse%5D)%0A%0A
-
res = ufl.isposi
@@ -486,28 +486... |
d4d5ef52cf7ac9f40bb8ada199b6c035690eacfa | Add tests for transmission | rpihelper/transmission/tests.py | rpihelper/transmission/tests.py | Python | 0 | @@ -0,0 +1,1456 @@
+# -*- coding: utf-8 -*-%0A%0Aimport transmissionrpc%0A%0Afrom unittest import TestCase%0Afrom unittest.mock import patch, MagicMock%0A%0Afrom rpihelper.transmission.logic import (%0A transmissionrpc_client, transmissionrpc_add_torrent,%0A)%0A%0A__all__ = (%0A 'TransmissionrpcClientLogicTests',... | |
cb1e797c6039a1677024a563852b117b581faaf2 | Add solution of problem 1 in Python | problem1/rumen.py | problem1/rumen.py | Python | 0.998909 | @@ -0,0 +1,64 @@
+sum(filter(lambda x: x %25 3 == 0 or x %25 5 == 0, range(1, 1000)))%0A
| |
cb82fd05c02b97bfc82668164fe3f3bb22faaade | Add fair and square | 2013/qualification_round/fair_and_square.py | 2013/qualification_round/fair_and_square.py | Python | 0.002189 | @@ -0,0 +1,2063 @@
+#!/usr/bin/env python%0A# Need solve time complexity%0A%0Afrom __future__ import print_function%0Afrom collections import deque%0A%0Adef count_fair_and_square_numbers(a, b):%0A count = 0%0A n = a%0A while n %3C= b:%0A if is_fair_and_square(n):%0A count += 1%0A n += ... | |
8a245ab951e1c5a72e8a14a8bb95d3f1d3a549ee | Hello World | pyexamples/conditions.py | pyexamples/conditions.py | Python | 0.99998 | @@ -0,0 +1,22 @@
+print ('Hello World')%0A
| |
463b20a1fa6740e6db2c8abac3861fa9a30f9a2e | Add Django 1.4.1 as a support version to suppress warning. | src/reversion/__init__.py | src/reversion/__init__.py | """
Transactional version control for Django models.
Developed by Dave Hall.
<http://www.etianen.com/>
"""
import django, warnings
from reversion.revisions import default_revision_manager, revision_context_manager, VersionAdapter
from reversion.admin import VersionAdmin
from reversion.models import pre_revision_com... | Python | 0 | @@ -453,16 +453,31 @@
4, 0),%0A
+ (1, 4, 1),%0A
)%0A%0Adef c
|
0b445c9606d30f31a6df1d99ef4d564f931014f2 | use unittest | python/calc/calc_test.py | python/calc/calc_test.py | Python | 0.000001 | @@ -0,0 +1,384 @@
+import unittest%0Afrom calc import Calc%0A%0Aclass CalcTest(unittest.TestCase):%0A def setUp(self):%0A print %22Calc Test%22%0A def test_add(self):%0A c = Calc()%0A x = 100%0A y = 200%0A result = 0%0A result = c.add(x,y)%0A print '%7B0%7D + %7B1%... | |
4972930bb42ed6d7ebc1bad2909ede1a3c213cec | Add preprocessing functions. | preprocess.py | preprocess.py | Python | 0.000001 | @@ -0,0 +1,529 @@
+import numpy as np%0A%0A%22%22%22This file contains some functions related to preprocessing.%22%22%22%0A%0Adef get_output_array_from_labels(output_labels, labels_encoding=None):%0A%09labels = np.unique(output_labels)%0A%09labels = labels.reshape(len(labels), 1)%0A%09outputs = np.zeros((output_labels.... | |
c1d66909a6ce9903aa0a856d80721c756bc54806 | test for neo4j | test/test_neo4j_graph.py | test/test_neo4j_graph.py | Python | 0.000001 | @@ -0,0 +1,762 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A# from py2neo import neo4j, node, rel%0Afrom bulbs.config import DEBUG%0Afrom bulbs.neo4jserver import Graph, Config, NEO4J_URI%0Afrom message import Message, IsRetweet # models%0Afrom datetime import datetime%0A%0A# setup %0Aconfig = Config(NEO4J_... | |
9ff3b324a2ca82378e0b9d51515941d62d00109c | fix handling of missing collections in API | aleph/views/entities_api.py | aleph/views/entities_api.py | from flask import Blueprint, request
from apikit import obj_or_404, jsonify, request_data, arg_bool
from apikit import get_limit, get_offset, Pager
from sqlalchemy import func, not_
from aleph import authz
from aleph.model import Entity, Collection, db
from aleph.logic import update_entity
from aleph.views.cache impor... | Python | 0.000001 | @@ -810,22 +810,23 @@
-for
coll
+ection
_id
-in
+=
dat
@@ -847,16 +847,55 @@
ion_id')
+ or %5B%5D%0A for coll_id in collection_id
:%0A
|
09f1cf984a456a4a452f1a1c0a0ff6fd09b7b415 | add code.py | code.py | code.py | Python | 0.000008 | @@ -0,0 +1,20 @@
+print 'Hello GitHub'
| |
a5012c9fb81768e85b555b52264baa11efc17ba1 | Add unittest for select_taxa that runs main and selects a single genome | test/test_select_taxa.py | test/test_select_taxa.py | Python | 0 | @@ -0,0 +1,814 @@
+import logging%0Aimport os%0Aimport tempfile%0Aimport unittest%0A%0Aimport select_taxa%0A%0A%0Aclass Test(unittest.TestCase):%0A%0A def setUp(self):%0A self.longMessage = True%0A logging.root.setLevel(logging.DEBUG)%0A%0A def test_main(self):%0A '''%0A Select a singl... | |
b5207cfcee8bd3f1a41fc87f3e9afcfe94646314 | Add example of how to list of codecs. | src/swig/python/codecs.py | src/swig/python/codecs.py | Python | 0 | @@ -0,0 +1,475 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A# Import required modules%0Aimport mlt%0A%0A# Start the mlt system%0Amlt.Factory().init( )%0A%0A# Create the consumer%0Ac = mlt.Consumer( mlt.Profile(), %22avformat%22 )%0A%0A# Ask for video codecs supports%0Ac.set( 'vcodec', 'list' )%0A%0A# Start ... | |
872e2a38845d8a9d321435092f808e2eb79a26e3 | test case for issue #9 | tests/test_formatters.py | tests/test_formatters.py | Python | 0 | @@ -0,0 +1,1567 @@
+import os%0Afrom unittest import TestCase%0Afrom textwrap import dedent%0A%0Aimport pyexcel as pe%0A%0A%0Aclass TestAutoDetectInt(TestCase):%0A def setUp(self):%0A self.content = %5B%5B1,2,3.1%5D%5D%0A self.test_file = %22test_auto_detect_init.ods%22%0A pe.save_as(array=self.... | |
5692f64619bf009cf92bf0a8c6f77bf82f0e3d02 | Add a new regression testing module | tests/test_regression.py | tests/test_regression.py | Python | 0.000001 | @@ -0,0 +1,1134 @@
+# Copyright: See the LICENSE file.%0A%0A%0A%22%22%22Regression tests related to issues found with the project%22%22%22%0A%0Aimport datetime%0Aimport typing as T%0Aimport unittest%0A%0Aimport factory%0A%0A# Example objects%0A# ===============%0A%0A%0Aclass Author(T.NamedTuple):%0A fullname: str%0A... | |
58354f477decff942a3063a12fb72684beca8233 | Add singleton tests | tests/test_singletons.py | tests/test_singletons.py | Python | 0.000001 | @@ -0,0 +1,1132 @@
+# coding=utf-8%0Afrom __future__ import absolute_import%0Afrom __future__ import division%0Afrom __future__ import print_function%0Afrom __future__ import unicode_literals%0A%0Aimport unittest%0A%0Aimport properties%0Afrom properties.extras import Singleton%0A%0A%0Aclass TestSingleton(unittest.TestC... | |
b93b8d96114338809e6a082f819291144eedd4af | add an utils to reduce the original dataset to a choosen class samples size | reduce_dataset.py | reduce_dataset.py | Python | 0.000002 | @@ -0,0 +1,1728 @@
+import sys, os%0Afrom shutil import copyfile%0A%0Asupplied_args = sys.argv%5B1:%5D%0A%0ADATA_DIRECTORY = %22data_dir%22%0ANEW_DATA_DIRECTORY = supplied_args%5B0%5D if supplied_args else sys.exit(%22You need to supplied a new data directory name : $python reduce_dataset.py %3Cnew data directory name%... | |
ab164307310474625926bbc9ea7fae03b99c99cf | Create architecture core models | opps/core/models/__init__.py | opps/core/models/__init__.py | Python | 0.000001 | @@ -0,0 +1,104 @@
+# -*- coding: utf-8 -*-%0Afrom opps.core.models.channel import *%0Afrom opps.core.models.publisher import *%0A
| |
9fde684095ba34300fcade827dfb17eae99f4daa | add advanced.py | renew/advanced.py | renew/advanced.py | Python | 0.000001 | @@ -0,0 +1,133 @@
+%0Adef fib(max):%0A%09a, b, n = 0, 1, 0%0A%09while n %3C max:%0A%09%09yield b%0A%09%09a, b = b, a + b%0A%09%09n += 1%0A%0A%09print('done')%0A%0Afor i in fib(20):%0A%09print(i)%0A%0A
| |
fab91baa976693f89c6001a0e09e0f351d30ccfe | add decorator timeout test | test/test_decorator.py | test/test_decorator.py | Python | 0.000001 | @@ -0,0 +1,575 @@
+# coding=utf-8%0Aimport unittest%0Afrom decorators.decorator import *%0Aimport time%0A%0A%0Aclass TestDecorator(unittest.TestCase):%0A def test_timeout(self):%0A @timeout(1)%0A def test_timeout_no_params():%0A time.sleep(2)%0A self.assertTrue()%0A%0A test... | |
db85c1a9aca124ef4cf45c61244c6cf556138d77 | Add cmd.py script | python/cmd.py | python/cmd.py | Python | 0.000002 | @@ -0,0 +1,1011 @@
+#!/usr/bin/env python3%0A%0A# Copyright (c) 2014, Ruslan Baratov%0A# All rights reserved.%0A%0Aimport argparse%0Aimport os%0Aimport stat%0Aimport subprocess%0Aimport sys%0A%0Aimport detail.os%0Aimport detail.command%0A%0Aassert(sys.version_info.major == 3)%0A%0Aparser = argparse.ArgumentParser(descr... | |
6d80008e2d14621943830ba6ca4a533f1bdc1da3 | add test which is checking answer after user input | quiz/tests.py | quiz/tests.py | # coding=utf-8
from django.core.urlresolvers import resolve
from django.test import TestCase
from django.http import HttpRequest
from django.template.loader import render_to_string
from django.shortcuts import render
from quiz.views import home_page
from quiz.models import Phrase
from quiz.models import PlayerRecord
... | Python | 0.000008 | @@ -1596,16 +1596,444 @@
(), 0)%0A%0A
+ def test_home_page_can_show_a_answer_after_user_input(self):%0A request = HttpRequest()%0A request.method = 'POST'%0A request.POST%5B'user_text'%5D = 'I have question'%0A response = home_page(request)%0A%0A expected_html = render_to_string(%... |
48faf04cfcd40739e2a0ddfc593f2320f1aeef65 | Create re_install.py | re_install.py | re_install.py | Python | 0.000001 | @@ -0,0 +1,1718 @@
+# -*- coding: utf-8 -*-%0A%0A#-----------------------------------------------------------------------------#%0A# #%0A# import libs #%0A# ... | |
4411c676426fb580d33ae09682444c093ab2c204 | Add multi-processing tests | test/test_mp.py | test/test_mp.py | Python | 0.000001 | @@ -0,0 +1,2152 @@
+import unittest%0Aimport time%0A%0Afrom clopure.core import ClopureRunner%0Afrom clopure.parser import ClopureParser%0A%0A%0Aclass TestMultiprocessing(unittest.TestCase):%0A%0A def setUp(self):%0A self.parser = ClopureParser()%0A self.runner = ClopureRunner(procs=4)%0A%0A def tes... | |
122eb3c6eb9f8467fc5d3325f0e5c58cc285cb50 | Add a script to convert hex formatted key to token using random partitioner | token-hexkey.py | token-hexkey.py | Python | 0 | @@ -0,0 +1,1336 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# Licensed to the Apache Software Foundation (ASF) under one%0A# or more contributor license agreements. See the NOTICE file%0A# distributed with this work for additional information%0A# regarding copyright ownership. The ASF licenses this file%0A#... | |
b35a0d2415cfc8d8d5d4060f1cf411a42c90a9a0 | add leetcode Pascal's Triangle. | leetcode/PascalTriangle/solution.py | leetcode/PascalTriangle/solution.py | Python | 0 | @@ -0,0 +1,681 @@
+# -*- coding:utf-8 -*-%0Aclass Solution:%0A # @return a list of lists of integers%0A def generate(self, numRows):%0A ret = %5B%5D%0A if numRows == 0:%0A return %5B%5D%0A if numRows == 1:%0A ret.append(%5B1%5D)%0A return ret%0A if numR... | |
8b5f09708eb79abdcde730727f6788881a3a68a3 | Initialize P4_textToExcel | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P4_textToExcel.py | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P4_textToExcel.py | Python | 0.00127 | @@ -0,0 +1,334 @@
+# Write a program to read in the contents of several text files (you can make%0A# the text files yourself) and insert those contents into a spreadsheet, with%0A# one line of text per row. The lines of the first text file will be in the%0A# cells of column A, the lines of the second text file will be ... | |
c50e072c5e79083ec3ec4104789a64223c2f63f8 | Create tao.py | tao.py | tao.py | Python | 0.000028 | @@ -0,0 +1,515 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0Afrom apscheduler.schedulers.blocking import BlockingScheduler%0Aimport itchat, time%0A%0Aitchat.auto_login()%0A%0Adef task():%0A chatroomList = itchat.get_chatrooms(False);%0A for m in chatroomList:%0A NickName = m%5B'NickName'%5D.encode('utf-8')... | |
7e757d24bff5758350dd2bc92b9e2b1e2f919c12 | Add compute synth (#3830) | java-compute/google-cloud-compute/synth.py | java-compute/google-cloud-compute/synth.py | Python | 0 | @@ -0,0 +1,934 @@
+# Copyright 2018 Google LLC%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by ap... | |
2d88daf10d11033bfd597112fb6484783c5a852a | Create xyz.py | xyz.py | xyz.py | Python | 0.000768 | @@ -0,0 +1,5 @@
+#...%0A
| |
e61840020820af4e7a625e472c060e8396b24055 | add migrations | gem/migrations/0013_gemsettings_moderator_name.py | gem/migrations/0013_gemsettings_moderator_name.py | Python | 0.000001 | @@ -0,0 +1,523 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.12 on 2017-03-09 13:45%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('gem', '0012_partner_credit'),%0A %5D%0A%0A op... | |
955ae619a6502a68f9a8d34022a4a8b1ebeb5ce2 | Create 20.py | E/20.py | E/20.py | Python | 0.000015 | @@ -0,0 +1,333 @@
+# Problem 20 - Factorial digit sum%0A# n! means n %C3%97 (n %E2%88%92 1) %C3%97 ... %C3%97 3 %C3%97 2 %C3%97 1%0A# For example, 10! = 10 %C3%97 9 %C3%97 ... %C3%97 3 %C3%97 2 %C3%97 1 = 3628800,%0A# and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27%0A# Find the sum of the ... | |
81f983c833d9858ad23f589367bf601babddf858 | Add some useful activation functions. | elements/activation_functions.py | elements/activation_functions.py | Python | 0 | @@ -0,0 +1,1155 @@
+import theano%0Aimport theano.tensor as T%0A%0A%22%22%22%0AA set of activation functions for Neural Network layers.%0AThey're in the form of class so we can take advantage of constructor%0Ato set initial value for some parameters.%0A%22%22%22%0A%0Adef tanh(x):%0A%09%22%22%22%0A%09tanh function (-1 t... | |
b8e7f5381abcf15d07cac07c20c671ec7cc64c90 | Add missing migration. | ideascube/mediacenter/migrations/0013_auto_20170323_1525.py | ideascube/mediacenter/migrations/0013_auto_20170323_1525.py | Python | 0 | @@ -0,0 +1,668 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.6 on 2017-03-23 15:25%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('mediacenter', '0012_auto_20170210_0940'),%0A %5D... | |
6585ca91a399a06094636a505fe813a0425c1a35 | add auth module (split from server mod.) | auth.py | auth.py | Python | 0 | @@ -0,0 +1,950 @@
+from urllib import urlencode%0Afrom requests import post%0A%0Aauth_url = 'https://github.com/login/oauth/authorize'%0Aaccess_token_url = 'https://github.com/login/oauth/access_token'%0A%0A%0Adef generate_auth_link(client_id, scopes):%0A%0A # append the client_id and scopes list to the url query st... | |
dbc20f37c7fb1dd00c90ac54d2021fb1ba3b5eda | Add some end-to-end functional tests | exam.py | exam.py | Python | 0.000003 | @@ -0,0 +1,2666 @@
+import time%0Aimport sys%0A%0Afrom groupy.client import Client%0A%0A%0Adef read_token_from_file(filename):%0A with open(filename) as f:%0A return f.read().strip()%0A%0A%0Adef test_groups(groups):%0A for group in groups:%0A print(group)%0A%0A print('Members:')%0A for... | |
64139e0a41c1b1da81e9b5e244b2d7095c4a7a2b | Add delete old sessions command | core/management/commands/delete_old_sessions.py | core/management/commands/delete_old_sessions.py | Python | 0.000001 | @@ -0,0 +1,1078 @@
+from datetime import datetime%0A%0Afrom django.core.management.base import BaseCommand%0Afrom django.contrib.sessions.models import Session%0A%0A%22%22%22%0A%3E%3E%3E def clean(count):%0A... for idx, s in enumerate(Session.objects.filter(expire_date__lt=now)%5B:count+1%5D):%0A... s.delete()%0A... | |
53add23b6dcb19251a41c7a99347ef6592b2898f | Add tests for serving precompressed files | tests/sentry/web/frontend/generic/test_static_media.py | tests/sentry/web/frontend/generic/test_static_media.py | from __future__ import absolute_import
from django.test.utils import override_settings
from sentry.testutils import TestCase
from sentry.web.frontend.generic import FOREVER_CACHE, NEVER_CACHE
class StaticMediaTest(TestCase):
@override_settings(DEBUG=False)
def test_basic(self):
url = '/_static/sentry... | Python | 0 | @@ -33,16 +33,26 @@
import%0A%0A
+import os%0A
from dja
@@ -502,38 +502,53 @@
assert
-'Vary' not in response
+response%5B'Vary'%5D == 'Accept-Encoding'
%0A
@@ -593,32 +593,75 @@
-Origin'%5D == '*'
+%0A 'Content-Encoding' not in response
%0A%0A @override_
@@ -934,38 +934,53 @@
assert
-'Vary' ... |
bb0cff292f1931b52bf05a3a0630dda9a508023f | Add basic wrapper for gym env | packages/syft/src/syft/lib/gym/env.py | packages/syft/src/syft/lib/gym/env.py | Python | 0 | @@ -0,0 +1,516 @@
+# third party%0Aimport gym%0A%0A# syft relative%0Afrom ...generate_wrapper import GenerateWrapper%0Afrom ...proto.lib.gym.env_pb2 import Env as Env_PB%0A%0Agym_env_type = type(gym.Env())%0A%0A%0Adef object2proto(obj: gym.Env) -%3E Env_PB:%0A return Env_PB(id=obj.unwrapped.spec.id)%0A%0A%0Adef prot... | |
05bf0cd188d4666c9c0aeb56a95d7867f25952c2 | Add a script for dqn continuous task demo | demo_dqn_continuous.py | demo_dqn_continuous.py | Python | 0 | @@ -0,0 +1,1847 @@
+import argparse%0A%0Aimport chainer%0Afrom chainer import serializers%0Aimport gym%0Aimport numpy as np%0A%0Aimport random_seed%0Aimport env_modifiers%0Aimport q_function%0A%0A%0Adef eval_single_run(env, model, phi):%0A test_r = 0%0A obs = env.reset()%0A done = False%0A while not done:%0... | |
a2cb69b40daa7ab7b222e7d670dd1022571395a1 | add aiohttp demon | demos/aiohttp_demon.py | demos/aiohttp_demon.py | Python | 0 | @@ -0,0 +1,857 @@
+# -*- coding: utf-8 -*-%0A# 18/5/22%0A# create by: snower%0A%0Aimport datetime%0Afrom torpeewee import *%0Afrom aiohttp import web%0A%0Adb = MySQLDatabase(%22test%22, host=%22127.0.0.1%22, user=%22root%22, passwd=%22123456%22)%0A%0Aclass BaseModel(Model):%0A class Meta:%0A database = db%0A%... | |
f61570297ef56e94b104aff42c822ea82a66030b | Add tests for database | tests/test_database.py | tests/test_database.py | Python | 0.000001 | @@ -0,0 +1,2195 @@
+import unittest%0A%0Afrom rcblog import db%0A%0A%0Aclass TestDataBase(unittest.TestCase):%0A @classmethod%0A def setUpClass(cls):%0A db.DB_NAME = 'test'%0A date_base = db.DataBase()%0A try:%0A db.r.table_drop('languages').run(date_base.connection)%0A exce... | |
054c71e88a5fb278ffcdac2ce85a59843f5e3ac0 | add new tests for oop | tests/scripts/oop/ex1.py | tests/scripts/oop/ex1.py | Python | 0 | @@ -0,0 +1,482 @@
+# coding: utf-8%0A%0A#$ header class Point(public)%0A#$ header method __init__(Point, double, double)%0A#$ header method __del__(Point)%0A#$ header method translate(Point, double, double)%0A%0Aclass Point(object):%0A def __init__(self, x, y):%0A self.x = x%0A self.y = y%0A%0A def ... | |
8d280e5a464a9ca75ac7c35e02d8de6bddbaaa7e | Add reaction tests | tests/test_reaction.py | tests/test_reaction.py | Python | 0.000051 | @@ -0,0 +1,998 @@
+import pytest%0Aimport linkatos.reaction as react%0A%0Adef test_positive_reaction():%0A reaction = '+1'%0A assert react.positive_reaction(reaction) is True%0A%0A%0Adef test_not_positive_reaction():%0A reaction = '-1'%0A assert react.positive_reaction(reaction) is False%0A%0A%0Adef test_kn... | |
c0f7be02fb1dc294a9bac2867fc695e353ea3445 | Test Resource. | tests/test_resource.py | tests/test_resource.py | Python | 0 | @@ -0,0 +1,887 @@
+# -*- coding: utf-8 -*-%0A%0Afrom unittest import TestCase%0Afrom electro.resource import Resource%0A%0Aclass TestResource(TestCase):%0A%0A def assert_parser(self, assert_value, values):%0A resource = Resource()%0A value = resource._parse_response(values)%0A self.assertEqual(v... | |
5adf35b9131ea6c0a16f6765cf44c50767ddc3f3 | add testanalyzing | tests/testanalyzing.py | tests/testanalyzing.py | Python | 0.998693 | @@ -0,0 +1,907 @@
+from timeside.decoder import *%0Afrom timeside.analyzer import *%0Afrom unit_timeside import *%0A%0Aimport os.path%0A%0A__all__ = %5B'TestAnalyzing'%5D%0A%0Aclass TestAnalyzing(TestCase):%0A %22Test all analyzers%22%0A%0A def setUp(self):%0A self.source = os.path.join (os.path.dirname(__... | |
b2a083e1531134ec82a70ca581fca31db7867566 | add test for data with no coincidences | tests/test_singletons.py | tests/test_singletons.py | Python | 0.000009 | @@ -0,0 +1,1215 @@
+# -*- coding: utf-8 -*-%0A# pylint: disable=missing-docstring%0A# pylint: disable=redefined-outer-name%0A%22%22%22Test ref results for data with no coincidences.%22%22%22%0Aimport numpy%0Aimport pytest%0Afrom pytest import approx%0A%0Afrom ndd.estimators import NSB, AsymptoticNSB, Plugin%0Afrom ndd.... | |
ad54db707004dd2b6e445c72462c1e937417d046 | test viz lib on fibonacci numbers | algopy/fib_gcd.py | algopy/fib_gcd.py | Python | 0 | @@ -0,0 +1,623 @@
+from rcviz import viz, callgraph%0A%0A%0A@viz%0Adef fib1(num):%0A assert num %3E= 0%0A if num %3C= 1:%0A return num%0A%0A fb1 = fib1(num - 1)%0A fb2 = fib1(num - 2)%0A res = fb1 + fb2%0A%0A return res%0A%0A%0A@viz%0Adef fib2(num):%0A assert num %3E= 0%0A return num if n... | |
8510352580ac6f39d706b6a4ace8426f9b45ca6c | Add unit tests for security_group_rules_client | tempest/tests/services/compute/test_security_group_rules_client.py | tempest/tests/services/compute/test_security_group_rules_client.py | Python | 0.000001 | @@ -0,0 +1,2571 @@
+# Copyright 2015 NEC Corporation. All rights reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/licenses... | |
0d32be58f5145c067e012a9d314be3f688bcbc2a | Add tests for view | go/scheduler/tests/test_views.py | go/scheduler/tests/test_views.py | Python | 0 | @@ -0,0 +1,3221 @@
+import datetime%0Afrom go.vumitools.tests.helpers import djangotest_imports%0A%0Awith djangotest_imports(globals()):%0A from django.core.urlresolvers import reverse%0A from django.template import defaultfilters%0A from django.conf import settings%0A from go.base.tests.helpers import GoDj... | |
c39b95eebb402d1d0137448b3f0efd9b6d7ec169 | Test if repository manager if retrieving a repository when we lookup after one | tests/managers/test_repository.py | tests/managers/test_repository.py | Python | 0 | @@ -0,0 +1,1005 @@
+from unittest import TestCase%0A%0Afrom mock import MagicMock, patch%0Afrom nose.tools import eq_%0A%0Afrom pyolite.managers.repository import RepositoryManager%0A%0A%0Aclass TestRepositoryManager(TestCase):%0A def test_get_repository(self):%0A mocked_repository = MagicMock()%0A mocked_reposi... | |
d124b7f51f0719f58e629d615c51522884515656 | delete commented code | bihar/reports/indicators/reports.py | bihar/reports/indicators/reports.py | from bihar.reports.supervisor import BiharNavReport, MockEmptyReport, \
url_and_params, BiharSummaryReport, \
ConvenientBaseMixIn, GroupReferenceMixIn, list_prompt, shared_bihar_context,\
team_member_context
from copy import copy
from corehq.apps.reports.generic import GenericTabularReport, summary_context
... | Python | 0 | @@ -4040,77 +4040,8 @@
lug%0A
- %0A # params%5B%22next_report%22%5D = IndicatorNav.slug%0A
|
9ad755263fe12fa16c0b27381893c380626c85d8 | Add unittest for string_view conversion | bindings/pyroot/test/conversions.py | bindings/pyroot/test/conversions.py | Python | 0 | @@ -0,0 +1,346 @@
+import unittest%0Aimport ROOT%0A%0Acppcode = %22%22%22%0Avoid stringViewConv(std::string_view) %7B%7D;%0A%22%22%22%0A%0Aclass ListInitialization(unittest.TestCase):%0A @classmethod%0A def setUpClass(cls):%0A ROOT.gInterpreter.Declare(cppcode)%0A%0A def test_string_view_conv(self):%0A ... | |
6cfca819bbefab1f38904fc73b46dae80e03b32e | Create __init__.py | knockoutpy/__init__.py | knockoutpy/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
9eb5f67a954888c4e14789b5b8acc785c789a77c | Add a command for creating rsa key. | oidc_provider/management/commands/creatersakey.py | oidc_provider/management/commands/creatersakey.py | Python | 0 | @@ -0,0 +1,653 @@
+from Crypto.PublicKey import RSA%0A%0Afrom django.conf import settings%0Afrom django.core.management.base import BaseCommand, CommandError%0A%0A%0Aclass Command(BaseCommand):%0A help = 'Randomly generate a new RSA key for the OpenID server'%0A%0A def handle(self, *args, **options):%0A tr... | |
aaddd474b8e17164c59f445d14b75b9f20a95948 | add post install | setup_post_install.py | setup_post_install.py | Python | 0 | @@ -0,0 +1,1606 @@
+import urllib2%0Aimport zipfile%0Aimport re%0Aimport sys%0Afrom glob import glob%0Afrom os import chdir, mkdir, rename, getcwd%0Afrom os.path import exists%0A%0Afrom resample_all import resample_all%0A%0Adef run_post_install():%0A%0A%09# Double check modules%0A%0A%09modules = set(%5B'numpy', 'scipy'... | |
768b0ec7afa92156f35663d45b2ef3e091f35da5 | Allow helpers to return None | smore/apispec/core.py | smore/apispec/core.py | # -*- coding: utf-8 -*-
from .exceptions import APISpecError, PluginError
class Path(object):
"""Represents a Swagger Path object.
https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#pathsObject
:param str path: The path template, e.g. ``"/pet/{petId}"``
:param str method: The H... | Python | 0.999319 | @@ -1990,32 +1990,74 @@
s%0A )%0A
+ if isinstance(ret, Path):%0A
path
|
45140f281ac8df0a8f325e99d2cc17385eabbcf4 | Create fizzbuzz.py | solutions/fizzbuzz.py | solutions/fizzbuzz.py | Python | 0.00001 | @@ -0,0 +1,232 @@
+def fizzbuzz(number):%0A%09for i in range(number):%0A%09%09if i%2515 == 0:%0A%09%09%09print %22FizzBuzz%22%0A%09%09elif i%255 == 0:%0A%09%09%09print %22Buzz%22%0A%09%09elif i%253 == 0:%0A%09%09%09print %22Fizz%22%0A%09%09else:%0A%09%09%09print i%0A%0Adef main():%0A%09fizzbuzz(101)%0A%0Aif __name__ ==... | |
feb7b6c627c05412176fd070abd8d5116d30f227 | :sparkles:find smallest letter greater than target | python/problems/find_smallest_letter_greater_than_target.py | python/problems/find_smallest_letter_greater_than_target.py | Python | 0.999505 | @@ -0,0 +1,1251 @@
+%22%22%22%0Ahttps://leetcode.com/problems/find-smallest-letter-greater-than-target/description/%0A%0Ahttps://leetcode.com/submissions/detail/131676021/%0A%22%22%22%0A%0A%0Aclass Solution:%0A def nextGreatestLetter(self, letters, target):%0A %22%22%22%0A :type letters: List%5Bstr%5D%... | |
2ea891fd99eb50f58abb6cf1dba55950916742ab | Clear solution for roman-numerals. | roman-numerals.py | roman-numerals.py | Python | 0 | @@ -0,0 +1,961 @@
+# I 1 (unus)%0A# V 5 (quinque)%0A# X 10 (decem)%0A# L 50 (quinquaginta)%0A# C 100 (centum)%0A# D 500 (quingenti)%0A# M 1,000 (mille)%0A%0Aplace2symbol = %7B%0A 0: %22I%22,%0A 1: %22X%22,%0A 2: %22C%22,%0A 3: %22M%22,%0A%7D%0A%0Areplacements = %5B%0A (%22I%22 * 9, %22IX%22),%0A (%22I... | |
d0c4ff9461144e9608c30c8d5a43381282912cc0 | Add builtin/github/writer.py | anchorhub/builtin/github/writer.py | anchorhub/builtin/github/writer.py | Python | 0 | @@ -0,0 +1,986 @@
+%22%22%22%0AFile that initializes a Writer object designed for GitHub style markdown files.%0A%22%22%22%0A%0Afrom anchorhub.writer import Writer%0Afrom anchorhub.builtin.github.wstrategies import MarkdownATXWriterStrategy, %5C%0A MarkdownSetextWriterStrategy, MarkdownInlineLinkWriterStrategy%0Aimp... | |
ed19693800bbe50121fead603a3c645fdc1ed81a | Add migration | services/migrations/0059_add_unit_count_related_name.py | services/migrations/0059_add_unit_count_related_name.py | Python | 0.000002 | @@ -0,0 +1,598 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.11 on 2018-05-17 11:34%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('services', '005... | |
c83cc4a60c719cf07d5ee3fe14556f8bb9542d22 | check zmq version in ProxyDevice | zmq/devices/proxydevice.py | zmq/devices/proxydevice.py | """Proxy classes and functions.
Authors
-------
* MinRK
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is... | Python | 0 | @@ -647,37 +647,18 @@
me%0A%0A
-from zmq import ZMQError, PUB
+import zmq
%0Afro
@@ -1022,16 +1022,20 @@
on_type=
+zmq.
PUB):%0A
@@ -1107,32 +1107,172 @@
t_type)%0A
+if zmq.zmq_version_info() %3C (3,2):%0A raise RuntimeError(%22zmq.proxy only available with libzmq %3E= 3.2, not %25s%22 %25 zmq... |
d46374388596fee83be8aa850afc961579b71a22 | add basic settings.py | uiautomator2/settings.py | uiautomator2/settings.py | Python | 0.000001 | @@ -0,0 +1,1189 @@
+# coding: utf-8%0A#%0A%0Afrom typing import Any%0Aimport uiautomator2 as u2%0A%0A%0Aclass Settings(object):%0A def __init__(self, d: u2.Device = None):%0A self._d = d%0A self._defaults = %7B%0A %22post_delay%22: 0,%0A %22implicitly_wait%22: 20.0,%0A %7D%... | |
c2470e9710d29cc4bfe38f1598eb2025d52507d2 | Use internal class variable for resolving templates in makefiles | tools/export/makefile/__init__.py | tools/export/makefile/__init__.py | """
mbed SDK
Copyright (c) 2011-2016 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wr... | Python | 0 | @@ -3532,36 +3532,32 @@
pl' %25 (self.
-NAME.lower()
+TEMPLATE
,%0A
@@ -3653,28 +3653,24 @@
%25 (self.
-NAME.lower()
+TEMPLATE
,%0A
@@ -3824,20 +3824,16 @@
elf.
-NAME.lower()
+TEMPLATE
%5D:%0A
@@ -4295,16 +4295,46 @@
CC-ARM'%0A
+ TEMPLATE = 'make-gcc-arm'%0A
TOOL
@@ -4706,16 +4706,44 @@
... |
9327b5f0836652c4225af2c4e10cda592ce15a09 | Distinct subsequence | DP/distinct_subsequences.py | DP/distinct_subsequences.py | Python | 0.99897 | @@ -0,0 +1,1272 @@
+import unittest%0A%22%22%22%0AGiven two sequences A and B, find out number of distinct subsequences in A which are equal to B.%0AInput: A: rabbbit, B: rabbit%0AOutput: 2 %5BOne subsequence which includes first b and one excludes first b%5D%0A%22%22%22%0A%0A%22%22%22%0AApproach:%0A1. Following optima... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.