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 |
|---|---|---|---|---|---|---|---|
70116d7181f48c16d614063df4de54dff172e8c6 | Add internal note | conda_env/cli/main_export.py | conda_env/cli/main_export.py | from argparse import RawDescriptionHelpFormatter
from copy import copy
import os
import sys
import textwrap
import yaml
from conda.cli import common
from conda.cli import main_list
from conda import config
from conda import install
description = """
Export a given environment
"""
example = """
examples:
conda e... | Python | 0 | @@ -903,16 +903,86 @@
cute)%0A%0A%0A
+# TODO Make this aware of channels that were used to install packages%0A
def exec
|
f66038d1599843913dbe88eb02fa80b79e0d6e57 | add script for bitwise operation | codecademy/bitwise.py | codecademy/bitwise.py | Python | 0 | @@ -0,0 +1,1244 @@
+%0Aprint 5 %3E%3E 4 # Right Shift%0Aprint 5 %3C%3C 1 # Left Shift%0Aprint 8 & 5 # Bitwise AND%0Aprint 9 %7C 4 # Bitwise OR%0Aprint 12 %5E 42 # Bitwise XOR%0Aprint ~88 # Bitwise NOT%0A%0Aprint %22the base 2 number system%22%0Aprint 0b1, #1%0Aprint 0b10, #2%0Aprint 0b11, #3%0Aprint 0b... | |
059ab529b05d0640e7099e307878db58d6f2ffc9 | update board test | scripts/test-board.py | scripts/test-board.py | Python | 0 | @@ -0,0 +1,370 @@
+%22%22%22Test script for the game board.%0A%0AAuthor: Yuhuang Hu%0AEmail : duguyue100@gmail.com%0A%22%22%22%0A%0Afrom __future__ import print_function%0Afrom minesweeper.msgame import MSGame%0A%0A%0Agame = MSGame(10, 10, 20)%0A%0Agame.print_board()%0A%0Atry:%0A input = raw_input%0Aexcept NameError... | |
65d2202bc686019ebdaf292693c79ace326ef798 | Create MyoThalmic.py | service/MyoThalmic.py | service/MyoThalmic.py | Python | 0 | @@ -0,0 +1,198 @@
+%0Afrom com.thalmic.myo import Pose%0A%0Amyo = Runtime.start(%22python%22, %22Python%22)%0Amyo = Runtime.start(%22myo%22, %22MyoThalmic%22)%0A%0Amyo.connect()%0Amyo.addPoseListener(python)%0A%0AonPose(pose):%0A print(pose.getType())%0A
| |
c1b27a617c9050799bb11f4c161f925f153da5bc | add test_gst_rtsp_server.py | test_gst_rtsp_server.py | test_gst_rtsp_server.py | Python | 0.000002 | @@ -0,0 +1,1286 @@
+#!/usr/bin/env python%0A# -*- coding:utf-8 vi:ts=4:noexpandtab%0A# Simple RTSP server. Run as-is or with a command-line to replace the default pipeline%0A%0Aimport sys%0Aimport gi%0A%0Agi.require_version('Gst', '1.0')%0Afrom gi.repository import Gst, GstRtspServer, GObject%0A%0Aloop = GObject.MainLo... | |
3e9fc3e3b4b5b870578d2c642d88a6ef14b340dd | max path 1: python | max_path_1/python/max_path_1.py | max_path_1/python/max_path_1.py | Python | 0.999998 | @@ -0,0 +1,1070 @@
+triangle = %5B%0A %5B75%5D,%0A %5B95, 64%5D,%0A %5B17, 47, 82%5D,%0A %5B18, 35, 87, 10%5D,%0A %5B20, 4, 82, 47, 65%5D,%0A %5B19, 1, 23, 75, 3, 34%5D,%0A %5B88, 2, 77, 73, 7, 63, 67%5D,%0A %5B99, 65, 4, 28, 6, 16, 70, 92%5D,%0A %5B41, 41, 26, 56, 83, 40, 80, 70, 33%5D,%0A %5B41, 48, ... | |
497f1c70d0ecedb904f5b71be494e01246d874f6 | Add weight test | kansha/card_addons/weight/tests.py | kansha/card_addons/weight/tests.py | Python | 0.000006 | @@ -0,0 +1,767 @@
+# -*- coding:utf-8 -*-%0A#--%0A# Copyright (c) 2012-2014 Net-ng.%0A# All rights reserved.%0A#%0A# This software is licensed under the BSD License, as described in%0A# the file LICENSE.txt, which you should have received as part of%0A# this distribution.%0A#--%0A%0Afrom kansha.cardextension.tests impo... | |
6aed81e89e321f45ba2ff95bfb0c78504c0bf79e | add setup_database script (tests) using scripts/import_osm.sh (in progress) | tests/setup_database.py | tests/setup_database.py | Python | 0 | @@ -0,0 +1,826 @@
+#!/usr/bin/env python%0A%0Aimport argparse%0Aimport subprocess%0A%0A%0Adef main():%0A parser = argparse.ArgumentParser()%0A parser.add_argument(%22-l%22, %22--osm_url%22, required=True, help=%22OSM download URL (*.osm.bz2)%22, type=str)%0A parser.add_argument(%22-p%22, %22--user%22, required... | |
783b04ad8da2b65d9a07a0bdd4f236273f9ad39d | Create test.py | ProjectMidway/test.py | ProjectMidway/test.py | Python | 0.000005 | @@ -0,0 +1 @@
+%0A
| |
7383343f7fb77c74455a50490ad2886fcf36bbd5 | Comment test for the moment | dlstats/fetchers/test_ecb.py | dlstats/fetchers/test_ecb.py | Python | 0 | @@ -0,0 +1,325 @@
+import unittest%0Aimport mongomock%0Aimport ulstats %0Afrom dlstats.fetchers._skeleton import (Skeleton, Category, Series, BulkSeries,%0A Dataset, Provider)%0Aimport datetime%0Afrom bson import ObjectId%0A%0A#class CategoriesTestCase(unittest.TestCase):%0A%0A#if _... | |
e446ab24ba981b22bf84ae2e09a8ba62cf17528e | Create batch_download.py | batch_download.py | batch_download.py | Python | 0.000001 | @@ -0,0 +1,1126 @@
+import time #used to pause script%0Aimport os #library used to open magnet link%0Afrom selenium import webdriver #use selenium%0A%0A#global variables%0AdriverLocation = %22C:/Users/Kevin/Downloads/Browsers/chromedriver.exe%22%0Aurl = %22http://horriblesubs.info/shows/shigatsu-wa-kimi-no-uso/%22%0Aqu... | |
fa0886bdeab19cb326a3e751dff1c46fb7911228 | Apply migration 1160 again | migrations/versions/1180_set_framework_datetimes_not_nullable_again.py | migrations/versions/1180_set_framework_datetimes_not_nullable_again.py | Python | 0 | @@ -0,0 +1,2724 @@
+%22%22%22Remove deprecated application_close_date field and set the remaining date fields to non-nullable.%0A%0ARevision ID: 1180%0ARevises: 1170%0ACreate Date: 2018-05-08 09:53:43.699711%0A%0A%22%22%22%0Afrom alembic import op%0Aimport sqlalchemy as sa%0Afrom sqlalchemy.dialects import postgresql%0... | |
9167643047c61bae50a7c73775631c7bfe434cc9 | Add a new wrapper class for managing ansible static inventory. | spam/ansiInventory.py | spam/ansiInventory.py | Python | 0 | @@ -0,0 +1,936 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A%22%22%22%0AAnsibleInventory:%0A%0AINTRO:%0A%0AUSAGE:%0A%0A%22%22%22%0A%0Aimport os%0Aimport ansible.inventory%0A%0A%0Aclass AnsibleInventory(object):%0A '''%0A Ansible Inventory wrapper class.%0A '''%0A def __init__(self, inventory_fil... | |
761a0afb8576f8bcdf9c50e79f21e55bf0f2243c | Correct path to doxyxml (#182) and break long line | doc/build.py | doc/build.py | #!/usr/bin/env python
# Build the documentation.
from __future__ import print_function
import os, shutil, tempfile
from subprocess import check_call, CalledProcessError, Popen, PIPE
def pip_install(package, commit=None):
"Install package using pip."
if commit:
cmd = ['pip', 'show', package.split('/')[1]]
... | Python | 0 | @@ -1166,16 +1166,30 @@
reathe',
+%0A
'511b08
@@ -2201,16 +2201,30 @@
', '-D',
+%0A
'breath
@@ -2245,16 +2245,47 @@
mat=
+' + os.path.join(os.getcwd(), '
doxyxml'
,%0A
@@ -2280,16 +2280,17 @@
doxyxml'
+)
,%0A
@@ -2366,16 +2366,30 @@
an-css',
+%0A
'--incl
@@ -... |
672b6b3b3936b262e3cf9232693ddbf26a1629d4 | Remove RoundRobin from _strategy_utils | axelrod/_strategy_utils.py | axelrod/_strategy_utils.py | """Utilities used by various strategies"""
import functools
import collections
import itertools
from axelrod import RoundRobin, update_history
from axelrod import Actions
from axelrod.strategies.cycler import Cycler
C, D = Actions.C, Actions.D
def detect_cycle(history, min_size=1, offset=0):
"""Detects cycles ... | Python | 0.00001 | @@ -113,20 +113,8 @@
port
- RoundRobin,
upd
@@ -1746,24 +1746,289 @@
strategy)%0A%0A%0A
+def calculate_scores(p1, p2, game):%0A %22%22%22Calculates the score for two players based their history%22%22%22%0A s1, s2 = 0, 0%0A for pair in zip(p1.history, p2.history):%0A score = game.score(pair)%0A ... |
8090098d90141ebe6f340cb5917d385f280d2d86 | version 1.9.6. also, reset seed_version in version.py | lib/version.py | lib/version.py | ELECTRUM_VERSION = "1.9.5" # version of the client package
PROTOCOL_VERSION = '0.6' # protocol version requested
SEED_VERSION = 6 # bump this every time the seed generation is modified
SEED_PREFIX = '01' # the hash of the mnemonic seed must begin with this
| Python | 0.000007 | @@ -21,9 +21,9 @@
1.9.
-5
+6
%22 #
@@ -129,17 +129,17 @@
N =
-6
+4
|
77eecb7a809a7b4f56d70e6d7e09deb2c7e0188b | add template engine | template-engine/code/templite.py | template-engine/code/templite.py | Python | 0 | @@ -0,0 +1,1402 @@
+#!/usr/bin/env python%0A# coding: utf-8%0A%0A%0Aclass CodeBuilder(object):%0A INDENT_STEP = 4%0A%0A def __init__(self, indent=0):%0A self.code = %5B%5D%0A self.indent_level = indent%0A%0A def add_line(self, line):%0A self.code.extend(%5B%22 %22 * self.indent_level, line... | |
c8f504c52f9e981b3974f4be1581da890021473a | add new collector for cassandra cfstats | src/collectors/mmcassandra/mmcassandra.py | src/collectors/mmcassandra/mmcassandra.py | Python | 0 | @@ -0,0 +1,2548 @@
+import subprocess, socket, math%0A%0Aimport diamond.collector%0A%0A%0Adef parse_line(line):%0A metric_name, rhs = line.strip().split(':', 1)%0A rhs = rhs.strip()%0A if ' ' in rhs:%0A str_value, units = rhs.split(' ', 1)%0A if units not in ('ms', 'ms.'):%0A raise Val... | |
ebd15d9bcf5a46417af7f3d46769716c4d12b793 | rename pre_push hook | pre_push.py | pre_push.py | Python | 0.000001 | @@ -0,0 +1,2722 @@
+#!/usr/bin/env python%0Aimport atexit%0Aimport glob%0Aimport os%0Aimport re%0Aimport subprocess%0Aimport sys%0A%0Astable_branch_re = re.compile(r'master%7Cstable%7Cprod%7Cproduction')%0A%0Adef chain_cmds(cmds, stdin=None):%0A for cmd in cmds:%0A p = subprocess.Popen(cmd, stdin=stdin, stdou... | |
a123b42eb3aed078aea26109056cf786aec2664a | add link_flair.py for interacting with link flair on submissions | bin/link_flair.py | bin/link_flair.py | Python | 0 | @@ -0,0 +1,819 @@
+import argparse%0Aimport praw%0A%0A%0Adef main():%0A parser = argparse.ArgumentParser(description='Get or set link flair')%0A parser.add_argument('action', choices=%5B'get', 'set'%5D, help='get or set')%0A parser.add_argument('id', help='id of the submission')%0A parser.add_argument('--te... | |
f9d1c81055ee4479b2c69229cf72f27fb33cdc48 | Remove unused imports. Add missing imports. | blues/application/tasks.py | blues/application/tasks.py | import os
from fabric.context_managers import settings
from fabric.decorators import task
from fabric.state import env
from fabric.utils import indent, abort
from blues.application.deploy import maybe_install_requirements
from refabric.utils import info
from refabric.contrib import blueprints
from .. import git
fro... | Python | 0 | @@ -1490,30 +1490,8 @@
urce
-, install_requirements
%0A
@@ -1515,47 +1515,8 @@
port
- git_repository_path, requirements_txt,
use
@@ -2063,16 +2063,56 @@
irements
+%0A from .project import use_virtualenv
%0A%0A if
|
495e9680ae7c1b9c1071c9f840df7881f5d4934b | add a Spider to KFC#15 | locations/spiders/kfc.py | locations/spiders/kfc.py | Python | 0.000004 | @@ -0,0 +1,1629 @@
+import json%0Aimport re%0Aimport scrapy%0Afrom locations.items import GeojsonPointItem%0A%0Aclass KFCSpider(scrapy.Spider):%0A name = %22kfc%22%0A allowed_domains = %5B%22www.kfc.com%22%5D%0A%0A def start_requests(self):%0A url = 'https://services.kfc.com/services/query/locations'%0A... | |
a67a4e15ce25e9e9a795534b4e629d6680fb491b | Implement player choosing a random pawn to move | ludo/playermoverandom.py | ludo/playermoverandom.py | Python | 0.000002 | @@ -0,0 +1,368 @@
+# Player%0A%0Afrom playerbase import PlayerBase, Players%0Afrom random import randint%0A%0A%0Aclass PlayerMoveRandom(PlayerBase):%0A%0A def get_desc(self):%0A %22%22%22%22Return description string%22%22%22%22%22%0A return %22Chooses a random pawn to move%22%0A%0A def _choose_move_... | |
c7e7430d76337ef5cfd6779d9a32c2c9d948eb86 | Add guess phred encoding script | carbon/guess-encoding.py | carbon/guess-encoding.py | Python | 0.000005 | @@ -0,0 +1,2046 @@
+%22%22%22%0A awk 'NR %25 4 == 0' your.fastq %7C python %25prog %5Boptions%5D%0A%0Aguess the encoding of a stream of qual lines.%0A%22%22%22%0Aimport sys%0Aimport optparse%0A%0ARANGES = %7B%0A 'Sanger': (33, 93),%0A 'Solexa': (59, 104),%0A 'Illumina-1.3': (64, 104),%0A 'Illumina-1.5': (... | |
06092ce552c78de4efdc5845d94146fd5cf6fd38 | add plot tool | plot_csv.py | plot_csv.py | Python | 0.000001 | @@ -0,0 +1,1429 @@
+import pandas as pd%0Aimport numpy as np%0Aimport plotly.plotly as py%0Aimport plotly.graph_objs as go%0Aimport argparse%0A%0Aclean_text = lambda s: %22%22.join(%5Bc for c in s if c.isalpha() or c.isdigit() or c==' '%5D).rstrip()%0A%0Adef make_hbar_plot(options_table, symbol, parameter):%0A data ... | |
dbe71d02a95e65b644a1ac811712a31059975457 | test update | tests/api/v1/test_jobs_update.py | tests/api/v1/test_jobs_update.py | Python | 0.000002 | @@ -0,0 +1,1750 @@
+# -*- coding: utf-8 -*-%0A#%0A# Copyright (C) 2015-2016 Red Hat, Inc%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/LIC... | |
fdada5e48a13ef5b1c55710a584d281d36a32375 | Add stub for testing `generic_decorators`. | tests/test_generic_decorators.py | tests/test_generic_decorators.py | Python | 0 | @@ -0,0 +1,99 @@
+__author__ = %22John Kirkham %3Ckirkhamj@janelia.hhmi.org%3E%22%0A__date__ = %22$Mar 25, 2015 13:30:52 EDT$%22%0A%0A%0A
| |
61e0c6e325a91564250a937c0b1769992f65a7f5 | Add initial unit tests for swarm module | tests/unit/modules/test_swarm.py | tests/unit/modules/test_swarm.py | Python | 0 | @@ -0,0 +1,1481 @@
+# -*- coding: utf-8 -*-%0A%0A# Import Python libs%0Afrom __future__ import absolute_import, print_function, unicode_literals%0A%0A# Import Salt Libs%0Aimport salt.modules.swarm%0A%0A# Import Salt Testing Libs%0Afrom tests.support.mixins import LoaderModuleMockMixin%0Afrom tests.support.mock import p... | |
a88959202e66d47f032797c2c5790461fe458392 | add tests boilerplates | api/v1/tests/test_api_tokens.py | api/v1/tests/test_api_tokens.py | Python | 0.000001 | @@ -0,0 +1,429 @@
+import unittest%0Aimport json%0A%0Aclass TestAuthentication(unittest.TestCase):%0A def setUp(self):%0A pass%0A%0A def tearDown(self):%0A pass%0A%0A def test_validates_user_inputs(self):%0A self.assertTrue(True)%0A%0A def test_user_can_register(self):%0A self.as... | |
16850052ced6975ab99c73c2c15497a3f91ccab9 | Add reader back in again.. will use for blender | edm/reader.py | edm/reader.py | Python | 0 | @@ -0,0 +1,2222 @@
+#!/usr/bin/env python3%0A%0Aimport struct%0Afrom collections import namedtuple%0A%0Afrom .typereader import get_type_reader%0A%0Aimport logging%0Alogger = logging.getLogger(__name__)%0A%0Aclass Reader(object):%0A def __init__(self, filename):%0A self.filename = filename%0A self.stream = open(... | |
8022d7361affddde110a289bc683201ea70af5fe | add weight conversion script | examples/yolo/darknet2npz.py | examples/yolo/darknet2npz.py | Python | 0.000001 | @@ -0,0 +1,1500 @@
+import argparse%0Aimport numpy as np%0A%0Aimport chainer%0Afrom chainer import serializers%0A%0Afrom chainercv.links import Conv2DBNActiv%0Afrom chainercv.links import YOLOv3%0A%0A%0Adef load(file, link):%0A if isinstance(link, Conv2DBNActiv):%0A for param in (%0A link.bn.be... | |
7bd4ecf4f0f16ed58f253ca16045c3dd86f0a28c | Test script. | runtests.py | runtests.py | Python | 0 | @@ -0,0 +1,1022 @@
+# -*- coding: utf-8 -*-%0A%0Aimport os%0A%0Afrom django.conf import settings%0A%0A%0Adef make_absolute_path(path):%0A return os.path.join(os.path.realpath(os.path.dirname(__file__)), path)%0A%0A%0Aif not settings.configured:%0A settings.configure(%0A DATABASES = %7B%0A 'defau... | |
a4d5e88973a25464be26488d17ecc663cce776d7 | Add map example with data generators | altair/examples/world_map.py | altair/examples/world_map.py | Python | 0 | @@ -0,0 +1,722 @@
+%22%22%22%0AWorld Map%0A---------%0A%0AThis example shows how to create a world map using data generators for%0Adifferent background layers.%0A%22%22%22%0A# category: maps%0A%0Aimport altair as alt%0Afrom vega_datasets import data%0A%0A# Data generators for the background%0Asphere = alt.sphere()%0Agr... | |
8cbe2878f5fdca899ec71bc08e7d2de4a3c3caf2 | add python solution to "project euler - problem3" | problem3.py | problem3.py | Python | 0 | @@ -0,0 +1,178 @@
+number = 600851475143%0A%0Afor divisor in xrange(2,number):%0A%09if (number %25 divisor == 0):%0A%09%09print divisor, %22 is a divisor%22%0A%09%09number = number / divisor%0A%09%09print %22new number is%22, number%0A
| |
f1976ef533d98ac6e423312435bb25692831bfd9 | Create bumper.py | cmp3103m-code-fragments/scripts/bumper.py | cmp3103m-code-fragments/scripts/bumper.py | Python | 0.000004 | @@ -0,0 +1,860 @@
+import rospy%0Afrom geometry_msgs.msg import Twist%0Afrom kobuki_msgs.msg import BumperEvent%0A%0A%0Aclass Chatter:%0A%0A def __init__(self):%0A rospy.init_node('chatter')%0A self.publisher = rospy.Publisher('/mobile_base/commands/velocity', Twist, queue_size=1)%0A self.scan_s... | |
d571af56293912042846047c88e4a7b2c2f40df9 | add archive command | alexBot/cogs/memework.py | alexBot/cogs/memework.py | Python | 0 | @@ -0,0 +1,2045 @@
+# -*- coding: utf-8 -*-%0Afrom ..tools import Cog%0Afrom discord.ext import commands%0Aimport discord%0Afrom datetime import datetime%0A%0A%0Aclass Memework(Cog):%0A def __init__(self, *args, **kwargs):%0A super().__init__(*args, **kwargs)%0A%0A self.archive_cat = self.bot.get_chann... | |
d3166947023283ae6aed9737703c852552cf17f8 | Update app/extensions/allows/allows.py | app/extensions/allows/allows.py | app/extensions/allows/allows.py | Python | 0 | @@ -0,0 +1,2007 @@
+from flask import current_app%0Afrom flask import request%0Afrom functools import wraps%0Afrom werkzeug import LocalProxy%0Afrom werkzeug.exceptions import Forbidden%0A%0A%0Aclass Allows(object):%0A%0A def __init__(self, app=None, identity_loader=None,%0A throws=Forbidden, on_fail... | |
37dc854c8af69c679f91163355b2a4314d66820b | Add a marker interface | usingnamespace/api/interfaces.py | usingnamespace/api/interfaces.py | Python | 0 | @@ -0,0 +1,95 @@
+from zope.interface import Interface%0A%0Aclass ISerializer(Interface):%0A %22%22%22Marker Interface%22%22%22%0A
| |
b4333af5737b1376452eb0490f4175a1554ba212 | Fix #116 | configure-aspen.py | configure-aspen.py | import os
import gittip
import gittip.wireup
import gittip.authentication
import gittip.csrf
gittip.wireup.canonical()
gittip.wireup.db()
gittip.wireup.billing()
website.github_client_id = os.environ['GITHUB_CLIENT_ID'].decode('ASCII')
website.github_client_secret = os.environ['GITHUB_CLIENT_SECRET'].decode('ASCII... | Python | 0.000001 | @@ -88,16 +88,51 @@
ip.csrf%0A
+from gittip.networks import github%0A
%0A%0Agittip
@@ -858,16 +858,55 @@
= None
+%0A request.context%5B'github'%5D = github
%0A%0Awebsit
|
f42d2264917f109b8cee1d641a475934a456aa61 | Add a BaseFrontend | mopidy/frontends/base.py | mopidy/frontends/base.py | Python | 0.000017 | @@ -0,0 +1,736 @@
+class BaseFrontend(object):%0A %22%22%22%0A Base class for frontends.%0A%0A :param core_queue: queue for messaging the core%0A :type core_queue: :class:%60multiprocessing.Queue%60%0A :param backend: the backend%0A :type backend: :class:%60mopidy.backends.base.BaseBackend%60%0A %2... | |
6b834e6a3353b62079fa1f2bb32425b9479d12ae | Fix loading of local settings when local settings is not present | mopidy/utils/settings.py | mopidy/utils/settings.py | # Absolute import needed to import ~/.mopidy/settings.py and not ourselves
from __future__ import absolute_import
from copy import copy
import logging
import os
import sys
from mopidy import SettingsError
from mopidy.utils import indent
logger = logging.getLogger('mopidy.utils.settings')
class SettingsProxy(object):... | Python | 0 | @@ -795,16 +795,20 @@
if
+not
os.path.
@@ -830,24 +830,42 @@
_file):%0A
+ return %7B%7D%0A
sys.
@@ -887,20 +887,16 @@
dotdir)%0A
-
|
5bba475443495bb61071ddf9f3ce54c98d1c41d5 | allow runtests.py to run only certain tests | mpmath/tests/runtests.py | mpmath/tests/runtests.py | #!/usr/bin/env python
"""
python runtests.py -py
Use py.test to run tests (more useful for debugging)
python runtests.py -psyco
Enable psyco to make tests run about 50% faster
python runtests.py -profile
Generate profile stats (this is much slower)
python runtests.py -nogmpy
Run tests without u... | Python | 0.000004 | @@ -504,24 +504,156 @@
l mpmath%0D%0A%0D%0A
+Additional arguments are used to filter the tests to run. Only files that have%0D%0Aone of the arguments in their name are executed.%0D%0A%0D%0A
%22%22%22%0D%0A%0D%0Aimpor
@@ -1387,16 +1387,45 @@
s = %5B%5D%0D%0A
+ args = sys.argv%5B1:%5D%0D%0A
@@ -1518,1... |
2d6ecb3b5b67539c6ad0f211d7b059ac44df2731 | Make gallery of examples for various bending angles up to 90 degrees | python/bending_examples.py | python/bending_examples.py | Python | 0 | @@ -0,0 +1,1242 @@
+# Make a gallery of images showing the RGZ consensus double sources, sorted by bending angle.%0A%0Afrom astropy.io import ascii%0A%0Apath = '/Users/willettk/Astronomy/Research/GalaxyZoo'%0Adata = ascii.read('%7B:%7D/rgz-analysis/csv/static_catalog3.csv'.format(path),delimiter=' ')%0A%0Aimport bendin... | |
93ba6ff584d84255f46ef11fb44e9ae863cd7aed | add demo about reversing arguments | python/src/reverse_args.py | python/src/reverse_args.py | Python | 0 | @@ -0,0 +1,1478 @@
+# Copyright (c) 2014 ASMlover. All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that the following conditions%0A# are met:%0A#%0A# * Redistributions of source code must retain the above copyright%0A# notice, ... | |
058eeefdef485595e48dcd0250bcf9dc9664287a | Add Launchpad (fixes #17) | services/launchpad.py | services/launchpad.py | Python | 0 | @@ -0,0 +1,2988 @@
+from oauthlib.oauth1.rfc5849 import SIGNATURE_PLAINTEXT, SIGNATURE_TYPE_BODY, SIGNATURE_TYPE_AUTH_HEADER%0Aimport requests%0A%0Aimport foauth.providers%0A%0Aclass Launchpad(foauth.providers.OAuth1):%0A # General info about the provider%0A provider_url = 'https://launchpad.net/'%0A docs_url ... | |
98232fea3f8847aad69ed6af0b37a5624c24488b | Add experiment script to run a dataset through all graph clustering method | experiment.py | experiment.py | Python | 0.000001 | @@ -0,0 +1,2004 @@
+import fnmatch%0Aimport os%0Afrom pygraphc.preprocess.PreprocessLog import PreprocessLog%0Afrom pygraphc.preprocess.CreateGraph import CreateGraph%0Afrom pygraphc.clustering.MajorClust import MajorClust, ImprovedMajorClust%0A%0A%0Adef get_dataset(dataset, dataset_path, file_extension):%0A # get a... | |
aee93802503a19b873299774e351ef883e81356b | Add functions.py to provide comment functions | functions.py | functions.py | Python | 0 | @@ -0,0 +1,413 @@
+#-*- coding: utf-8 -*-%0A%0Adef getClientIP( req ):%0A%09'''%0A%09Get the client ip address%0A%09'''%0A%09xForwardedFor=req.META.get('HTTP_X_FORWARDED_FOR')%0A%09if xForwardedFor:%0A%09%09ip=xForwardedFor.split(',')%5B0%5D%0A%09else:%0A%09%09ip=req.META.get('REMOTE_ADDR')%0A%09return ip%0A%0Adef getB... | |
f3a43d11f79766c43be6de359762bd37cde49b38 | Complete 3 pointer method | lc0611_valid_triangle_number.py | lc0611_valid_triangle_number.py | Python | 0.000036 | @@ -0,0 +1,1450 @@
+%22%22%22Leetcode 611. Valid Triangle Number%0AMedium%0A%0AURL: https://leetcode.com/problems/valid-triangle-number/%0A%0AGiven an array consists of non-negative integers, %0Ayour task is to count the number of triplets chosen from the array that can%0Amake triangles if we take them as side lengths ... | |
a68198514528773d2368e203491121b5c34f956d | Add tests of compile_ptx and compile_ptx_for_current_device | numba/cuda/tests/cudapy/test_compiler.py | numba/cuda/tests/cudapy/test_compiler.py | Python | 0.000001 | @@ -0,0 +1,2866 @@
+from math import sqrt%0Afrom numba import cuda, float32, void%0Afrom numba.cuda import compile_ptx, compile_ptx_for_current_device%0A%0Afrom numba.cuda.testing import skip_on_cudasim, unittest%0A%0A%0A@skip_on_cudasim('Compilation unsupported in the simulator')%0Aclass TestCompileToPTX(unittest.Test... | |
1c0230f7d0add83c36daadcf88bda72500e49015 | add new package (#22648) | var/spack/repos/builtin/packages/rnaquast/package.py | var/spack/repos/builtin/packages/rnaquast/package.py | Python | 0 | @@ -0,0 +1,1419 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Aimport os%0Afrom spack import *%0A%0A%0Aclass Rnaquast(Package):%0A %22%22%22Quality asse... | |
3c26db43490640e0a98f5c22bb65eecd2c1c5ba9 | Create sudoku_formatter.py | sudoku_formatter.py | sudoku_formatter.py | Python | 0.999775 | @@ -0,0 +1,2265 @@
+instructions = %22%22%22INSTRUCTIONS:%0ACopy a sudoku puzzle from http://www.menneske.no/sudoku/ to a text file, %0Aand provide this file as the first command line argument and the file for %0Aoutput as the second command line argument%0A%0ARemember that box height and width must be added manually (... | |
710fe77b1d03de83cfefa3173b17d2adf5f220fe | Add systemd watchdog | systemd_watchdog.py | systemd_watchdog.py | Python | 0.000003 | @@ -0,0 +1,673 @@
+# RES Service Package%0A# Copyright %C2%A9 2015 InvestGroup, LLC%0A%0A%0Aimport asyncio%0Aimport logging%0A%0A%0Adef install_watchdog(interval, loop=None):%0A assert isinstance(interval, (int, float)) and interval %3E 0%0A logger = logging.getLogger(%22systemd-watchdog%22)%0A try:%0A ... | |
78ef287355d670877ed2dd82386ee5ce51944fcb | switch logging to DEBUG | crate_project/settings/production/base.py | crate_project/settings/production/base.py | from ..base import *
LOGGING = {
"version": 1,
"disable_existing_loggers": True,
"filters": {
"require_debug_false": {
"()": "django.utils.log.RequireDebugFalse",
},
},
"formatters": {
"simple": {
"format": "%(levelname)s %(message)s"
},
}... | Python | 0.000003 | @@ -919,12 +919,13 @@
%22: %22
-INFO
+DEBUG
%22,%0A
|
5f0feca62055dafd9931bf68abe3286bda9f41e0 | Create __init__.py | frappe/desk/doctype/communication_reconciliation/__init__.py | frappe/desk/doctype/communication_reconciliation/__init__.py | Python | 0.000429 | @@ -0,0 +1,426 @@
+import frappe%0A@frappe.whitelist(allow_guest=True)%0Adef relink(self,name,reference_doctype,reference_name):%0A%09dt = reference_doctype%0A%09dn = reference_name%0A%0A%09if dt==%22%22 or dt==None or dn == %22%22 or dn == None:%0A%09%09return # is blank maybe try flash missing required%0A%09frappe.db... | |
c07609fa140c54572832f4f8f4787d0991495e60 | check in some migrations | planetstack/core/migrations/0002_omf_friendly_default_false.py | planetstack/core/migrations/0002_omf_friendly_default_false.py | Python | 0 | @@ -0,0 +1,396 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('core', '0001_initial'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%0A ... | |
45c20be4027ccb7aa6a1c3e643ca164413bd353f | add management command for commenting on outstanding apps about tos changes. | TWLight/applications/management/commands/notify_applicants_tou_changes.py | TWLight/applications/management/commands/notify_applicants_tou_changes.py | Python | 0 | @@ -0,0 +1,1553 @@
+import logging%0Afrom django.conf import settings%0Afrom django.core.management.base import BaseCommand, CommandError%0Afrom django.utils.translation import ugettext as _%0Afrom TWLight.applications.models import Application%0Afrom TWLight.resources.models import Partner%0Afrom django_comments.model... | |
378e89fd74cfd383c3e1b21fc342194728f66bb7 | Add DogStatsd metrics backend. (#5230) | src/sentry/metrics/dogstatsd.py | src/sentry/metrics/dogstatsd.py | Python | 0 | @@ -0,0 +1,1401 @@
+from __future__ import absolute_import%0A%0A__all__ = %5B'DogStatsdMetricsBackend'%5D%0A%0Afrom datadog import initialize, statsd%0A%0Afrom .base import MetricsBackend%0A%0A%0Aclass DogStatsdMetricsBackend(MetricsBackend):%0A def __init__(self, prefix=None, **kwargs):%0A # TODO(dcramer): i... | |
56f9ea1ba0026bc21eeb904afaf25606a6186125 | Test per veure que no permetem capçaleres multivaluades | test/test_regles.py | test/test_regles.py | Python | 0 | @@ -0,0 +1,1534 @@
+import unittest%0D%0Aimport mock%0D%0Aimport settings%0D%0Afrom soa.tiquets import GestioTiquets%0D%0Afrom soa.identitat import GestioIdentitat%0D%0Afrom filtres.nou import FiltreNou%0D%0Afrom mailticket import MailTicket%0D%0Afrom testhelper import llegir_mail%0D%0A%0D%0A%0D%0Aclass TestRegles(unit... | |
c6a9f1df850dca2aced2dd34aa5cde14445956b3 | use descriptive var name. | restclients/models/grad.py | restclients/models/grad.py | from django.db import models
def get_datetime_str(dt):
if dt is None:
return None
return dt.strftime("%Y-%m-%d %H:%M:%S")
class GradTerm(models.Model):
SPRING = 'spring'
SUMMER = 'summer'
AUTUMN = 'autumn'
WINTER = 'winter'
QUARTERNAME_CHOICES = (
(SPRING, 'Spring'),
... | Python | 0.000002 | @@ -50,21 +50,41 @@
tr(d
-t):%0A if dt
+atetime_obj):%0A if datetime_obj
is
@@ -121,17 +121,27 @@
return d
-t
+atetime_obj
.strftim
@@ -161,11 +161,8 @@
H:%25M
-:%25S
%22)%0A%0A
|
ae7f22b5fc606a8415e286ffabd43d3fbb71977c | Add Euler angle conversion tests. | tests/test_euler.py | tests/test_euler.py | Python | 0 | @@ -0,0 +1,812 @@
+import unittest%0A%0Afrom QGL import *%0Afrom QGL.Euler import *%0Afrom QGL.Cliffords import C1%0Aimport QGL.config%0Atry:%0A from helpers import setup_test_lib%0Aexcept:%0A from .helpers import setup_test_lib%0A%0Aclass EulerDecompositions(unittest.TestCase):%0A%0A%09N_test = 1000%0A%0A%09def setU... | |
329c1d9cd515414fe754385ee302197b93eadd20 | implement 15 (15) ツイッターのユーザー名(例えば@xxxxxxx)を,そのユーザーのページへのリンク(<a href="https://twitter.com/#!/xxxxxxx">@xxxxxxx</a>で囲まれたHTML断片)に置換せよ. | set02/15.py | set02/15.py | Python | 0 | @@ -0,0 +1,440 @@
+# -*- coding: utf-8 -*-%0A# (15) %E3%83%84%E3%82%A4%E3%83%83%E3%82%BF%E3%83%BC%E3%81%AE%E3%83%A6%E3%83%BC%E3%82%B6%E3%83%BC%E5%90%8D%EF%BC%88%E4%BE%8B%E3%81%88%E3%81%B0@xxxxxxx%EF%BC%89%E3%82%92%EF%BC%8C%E3%81%9D%E3%81%AE%E3%83%A6%E3%83%BC%E3%82%B6%E3%83%BC%E3%81%AE%E3%83%9A%E3%83%BC%E3%82%B8%E3%81%B... | |
89ade49695c8961f23879050dda8aa684603c04b | Fix serializer | CTFd/utils/exports/serializers.py | CTFd/utils/exports/serializers.py | import json
import six
from collections import OrderedDict
from CTFd.utils.exports.encoders import JSONEncoder
class JSONSerializer(object):
def __init__(self, query, fileobj):
self.query = query
self.fileobj = fileobj
self.buckets = []
def serialize(self):
for row in self.qu... | Python | 0.000039 | @@ -39,16 +39,29 @@
s import
+ defaultdict,
Ordered
@@ -65,16 +65,16 @@
redDict%0A
-
%0Afrom CT
@@ -275,10 +275,25 @@
s =
-%5B%5D
+defaultdict(list)
%0A%0A
@@ -461,16 +461,22 @@
kets
+%5Bpath%5D
.append(
%5Bres
@@ -475,16 +475,14 @@
end(
-%5B
result
-%5D
)%0A%0A
@@ -667,16 +667,22 @@
for
+ path,
... |
933d364981f2b05cbca3325ee92f0696da5de44e | Create settings.py | settings.py | settings.py | Python | 0.000001 | @@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-%0A
| |
7b6b1426015a83b96395f0c7c112dc53d373647f | Add init file for remediation module. | fairness_indicators/remediation/__init__.py | fairness_indicators/remediation/__init__.py | Python | 0 | @@ -0,0 +1,596 @@
+# Copyright 2019 Google LLC. All Rights Reserved.%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#... | |
205362c2f068ca22fe40cb6399b071849727ee55 | Test cases for style attribute parsing | tests/test_parse.py | tests/test_parse.py | Python | 0 | @@ -0,0 +1,2512 @@
+%0Aimport pytest%0A%0Afrom rinoh.dimension import DimensionBase, PT, PICA, INCH, MM, CM, PERCENT%0Afrom rinoh.style import OptionSet, Bool, Integer%0A%0A%0Adef test_optionset_from_string():%0A ONE = 'one'%0A TWO = 'two'%0A THREE = 'three'%0A%0A class TestSet1(OptionSet):%0A values... | |
9118f73f02723bcf62c82934f3ea36328777da25 | add tests to make sure other queryset methods work | django_object_actions/tests/test_utils.py | django_object_actions/tests/test_utils.py | from django.db.models.query import QuerySet
from django.test import TestCase
from example_project.polls.models import Poll
from ..utils import (
BaseDjangoObjectActions,
QuerySetIsh,
takes_instance_or_queryset,
)
class BaseDjangoObjectActionsTest(TestCase):
def setUp(self):
self.instance = B... | Python | 0 | @@ -3074,16 +3074,385 @@
f.obj)%0A%0A
+ def test_queryset_supports_delete(self):%0A qs = QuerySetIsh(self.obj)%0A qs.delete()%0A with self.assertRaises(Poll.DoesNotExist):%0A Poll.objects.get(pk=1)%0A%0A def test_queryset_supports_update(self):%0A qs = QuerySetIsh(self.obj)... |
9112bfe1a4f9253b78c6145f74b12c712cee136b | Create spacewar.py | spacewar.py | spacewar.py | Python | 0.002719 | @@ -0,0 +1,215 @@
+%22%22%22%0Aspacewar.py%0AAuthor: %3Cyour name here%3E%0ACredit: %3Clist sources used, if any%3E%0A%0AAssignment:%0AWrite and submit a program that implements the sandbox platformer game:%0Ahttps://github.com/HHS-IntroProgramming/Spacewar%0A%22%22%22%0A
| |
c8989ff640eb9fb1e9fddad4ac303ed417b54c79 | Adding grumpy.py | axelrod/strategies/grumpy.py | axelrod/strategies/grumpy.py | Python | 0.999739 | @@ -0,0 +1,1545 @@
+from axelrod import Player%0A%0Aclass Grumpy(Player):%0A %22%22%22%0A A player that defects after a ceratin level of grumpiness. Grumpiness increases when the opponent defects and decreases when the opponent co-operates.%0A %22%22%22%0A%0A def __init__(self, starting_state = 'Nice', grum... | |
ed793b470e55a0fe1c7a0a4b0cc3d8a2774e4628 | verify that the files are actually images | scripts/verifyImageType.py | scripts/verifyImageType.py | Python | 0 | @@ -0,0 +1,1304 @@
+from resnet50 import ResNet50%0Afrom keras.preprocessing import image%0Afrom imagenet_utils import preprocess_input, decode_predictions%0Aimport numpy as np%0Aimport json%0Aimport time%0Aimport sys%0Afrom multiprocessing import Pool%0Aimport functools%0A%0Adef readTasking(filename):%0A%0A tasking... | |
12c950c09839ad887d76de9a062e36015534c054 | Create activate-devices.py | cron/activate-devices.py | cron/activate-devices.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
4628adc38789f52e8e2ef0cdf600b9fbed7b30ab | Test events (really event __repr__) | test/test_events.py | test/test_events.py | Python | 0.000003 | @@ -0,0 +1,2085 @@
+import pytest%0A%0Afrom h11 import Request%0A%0Afrom wsproto.events import (%0A ConnectionClosed,%0A ConnectionEstablished,%0A ConnectionRequested,%0A)%0Afrom wsproto.frame_protocol import CloseReason%0A%0A%0Adef test_connection_requested_repr_no_subprotocol():%0A method = b'GET'%0A t... | |
e6df90237fa3a42f40cf39aa0df7675de6dd9c9f | 859. Buddy Strings | LeetCode/BuddyStrings.py | LeetCode/BuddyStrings.py | Python | 0.999776 | @@ -0,0 +1,1038 @@
+class Solution:%0A def buddyStrings(self, A: str, B: str) -%3E bool:%0A if len(A) != len(B):%0A return False%0A mismatches = %5B-1, -1%5D%0A for i in range(len(A)):%0A if A%5Bi%5D != B%5Bi%5D:%0A if mismatches%5B0%5D %3C 0:%0A ... | |
60075ecdc73097c39895193a593688cb3cf103dd | add glucose example | examples/plotting/file/glucose.py | examples/plotting/file/glucose.py | Python | 0.00231 | @@ -0,0 +1,563 @@
+%0Afrom bokeh.sampledata import glucose%0Afrom bokeh.plotting import *%0A%0Aday = glucose.data.ix%5B'2010-10-06'%5D%0Ahighs = day%5Bday%5B'glucose'%5D %3E 180%5D%0Alows = day%5Bday%5B'glucose'%5D %3C 80%5D%0A%0A%0Aoutput_file(%22glucose.html%22, title=%22glucose.py example%22)%0A%0Ahold()%0A%0Aline(d... | |
6f0fdb4d7b1202c7ab07d01cf34954ee725df6fe | add basic-calculator | vol5/basic-calculator/basic-calculator.py | vol5/basic-calculator/basic-calculator.py | Python | 0.998627 | @@ -0,0 +1,1965 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# @Author: Zeyuan Shang%0A# @Date: 2015-11-18 17:21:42%0A# @Last Modified by: Zeyuan Shang%0A# @Last Modified time: 2015-11-18 17:21:51%0Aclass Solution:%0A operators = %5B'+', '-', '*', '/'%5D%0A %0A def getPriority(self, operator):%0A ... | |
54c1028157447233014890419ab869a8c1ca0c3a | Add linux installer | installation/server-linux.py | installation/server-linux.py | Python | 0.000001 | @@ -0,0 +1,1189 @@
+#!/usr/bin/env python%0A#-*- encoding:utf-8 -*-%0A%0Aimport os%0Aimport sys%0Aimport urllib2%0Aimport subprocess%0A%0AinstallationPath = os.path.expanduser('~') + '/.config/ydlss'%0AserverLocalLocation = installationPath + '/youtube-dl-simple-server'%0AserverWebLocation = 'https://github.com/r4mos/y... | |
46d6b7451bb8e295751d771228782cfbbcb8ecc7 | Add dask_client_from_ipclient function | dask/distributed/ipython_utils.py | dask/distributed/ipython_utils.py | Python | 0 | @@ -0,0 +1,434 @@
+from .scheduler import Scheduler%0Afrom .worker import Worker%0Afrom .client import Client%0A%0A%0Adef dask_client_from_ipclient(client):%0A %22%22%22%0A Construct a scheduler from an ipython client.%0A %22%22%22%0A zmq_context = client._context%0A scheduler = Scheduler(context=zmq_con... | |
93e19ab50567e045daf0e35d856033303be70192 | Implement first test cases | test_esp8266uart.py | test_esp8266uart.py | Python | 0.006485 | @@ -0,0 +1,1442 @@
+import esp8266uart%0A%0Aesp = esp8266uart.ESP8266(1, 115200)%0A%0Aprint('Testing generic methods')%0Aprint('=======================')%0A%0Aprint('AT startup...')%0Aif esp.test():%0A print('Success!')%0Aelse:%0A print('Failed!')%0A%0A#print('Soft-Reset...')%0A#if esp.reset():%0A# print('Succ... | |
8ec7492658bab8d6b0fba5d6b49a58b6408f5fa2 | Add framework for graphing temporal time | src/graph_run_algo.py | src/graph_run_algo.py | Python | 0.000001 | @@ -0,0 +1,2416 @@
+import dateutil.parser%0Aimport time%0Aimport matplotlib.pyplot as plt%0Afrom operator import add%0Afrom datetime import datetime%0Afrom gensim import corpora, models, similarities%0A%0A%0Aminute = 60%0Ahour = 3600%0Acdict = %22%25scorpus.dict%22%0Accorpus = %22%25scorpus.mm%22%0Acorpus_model = %22%... | |
b80fbf3f841a950cbcf7751fee7173910fbd19fa | Fix ipynb to actuall render the output | nikola/plugins/compile/ipynb.py | nikola/plugins/compile/ipynb.py | # -*- coding: utf-8 -*-
# Copyright © 2013-2016 Damián Avila, Chris Warrick and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
#... | Python | 0 | @@ -3784,16 +3784,22 @@
e.write(
+output
)%0A%0A d
|
87fe0b7ff745e4057e4b60a1a9a75fe57581b2d5 | add exp4 script | num_exper/exp4.py | num_exper/exp4.py | Python | 0 | @@ -0,0 +1,877 @@
+import os%0Aimport numpy as np%0A%0Anp = 4%0Afmin = 1.0%0Afmax = 9.0%0Adf = 0.5%0A%0Afor i in np.arange(fmin+df, fmax, df): %0A %0A %0A str1 = 'python3 elast_wedge.py --ndims=2 --dx=100.0 --dy=100.0 --dz=100.0 --df=0.1 --degree=1 --damping=0.5 --maxit=300 %5C%0A ... | |
2fa721b24891fcd8170d87328334c05faec9cb9a | add hamming char dist function | cryptography/hamming_distance/python/hamming_char_dist.py | cryptography/hamming_distance/python/hamming_char_dist.py | Python | 0.000038 | @@ -0,0 +1,319 @@
+%22%22%22%0ADetermine the hamming distance, at the character level, between two equal length strings a and b.%0A%22%22%22%0Adef hamming_char_dist(a,b):%0A if len(a) != len(b):%0A raise ValueError(%22a and b are unequal lengths%22)%0A dist = 0%0A for i in range(len(a)):%0A if(a%... | |
c679b614b638123d846940718bb3fd27ed3078ce | Add test for fftpack. | numpy/fft/tests/test_fftpack.py | numpy/fft/tests/test_fftpack.py | Python | 0.000027 | @@ -0,0 +1,267 @@
+import sys%0Afrom numpy.testing import *%0Aset_package_path()%0Afrom numpy.fft import *%0Arestore_path()%0A%0Aclass test_fftshift(NumpyTestCase):%0A def check_fft_n(self):%0A self.failUnlessRaises(ValueError,fft,%5B1,2,3%5D,0)%0A%0Aif __name__ == %22__main__%22:%0A NumpyTest().run()%0A
| |
9436af51e8b823fa83358b40f94dcd07970aea6b | test test | src/test_deque.py | src/test_deque.py | Python | 0.000037 | @@ -0,0 +1,1418 @@
+%22%22%22Test functions for deque module.%22%22%22%0Aimport pytest%0A%0A%0Adef test_queue_is_instance_of_queue_object():%0A %22%22%22Test stack is instance of Stack().%22%22%22%0A from deque import Deque%0A d = Deque()%0A assert isinstance(d, Deque)%0A%0A%0Adef test_queue_is_instance_of_... | |
7a3a7a8d5a397c886086cc87fff3f058921d06d2 | add IntegerListField for keeping major selections | application/fields.py | application/fields.py | Python | 0 | @@ -0,0 +1,734 @@
+from django.db import models%0A%0Aclass IntegerListField(models.Field):%0A %22%22%22%0A IntegerListField keeps a list of int as a comma-separated string.%0A%0A %3E%3E%3E g = IntegerListField()%0A %3E%3E%3E g.get_db_prep_value(%5B1,2,-1,20,30,40,-100%5D)%0A '1,2,-1,20,30,40,-100'%0A%0A ... | |
1ee05e6a5a80fadf2c0d01c3d85668171edf2caa | fix conf.py to use correct version of mpmath | doc/source/conf.py | doc/source/conf.py | # -*- coding: utf-8 -*-
#
# mpmath documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 13 00:14:30 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't ... | Python | 0 | @@ -579,17 +579,16 @@
here.%0D%0A
-#
sys.path
@@ -592,30 +592,24 @@
ath.
-append('some/directory
+insert(0, '../..
')%0D%0A
@@ -1147,17 +1147,17 @@
t = '200
-8
+9
, Fredri
|
4cb6b3a3e1b74dd83812469c472accfc22e4d699 | Update consecutive-numbers-sum.py | Python/consecutive-numbers-sum.py | Python/consecutive-numbers-sum.py | # Time: O(sqrt(n))
# Space: O(1)
# Given a positive integer N,
# how many ways can we write it as a sum of
# consecutive positive integers?
#
# Example 1:
#
# Input: 5
# Output: 2
# Explanation: 5 = 5 = 2 + 3
# Example 2:
#
# Input: 9
# Output: 3
# Explanation: 9 = 9 = 4 + 5 = 2 + 3 + 4
# Example 3:
#
# Input: 15
# O... | Python | 0.003216 | @@ -593,16 +593,32 @@
2%5Ek * M
+, where M is odd
%0A
|
3dc8fde56be2438dae03e5d9d310fa2d19cd1ce2 | Add multi-result testing | tests/test_multi.py | tests/test_multi.py | Python | 0.000002 | @@ -0,0 +1,1550 @@
+# Copyright 2011 OpenStack LLC.%0A# 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/license... | |
362c35a1753c908fa7496c0e050b9325420e405e | add missing migrations | corehq/apps/linked_domain/migrations/0012_auto_20200929_0809.py | corehq/apps/linked_domain/migrations/0012_auto_20200929_0809.py | Python | 0.000012 | @@ -0,0 +1,828 @@
+# Generated by Django 2.2.16 on 2020-09-29 08:09%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('linked_domain', '0011_auto_20200728_2316'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%0A ... | |
fcdbd563a2823f4950ccf2fd164637096d55987f | Add HavocInc | dosagelib/plugins/h.py | dosagelib/plugins/h.py | # -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2016 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
from re import compile, escape
from ..scraper import _BasicScraper, _Pars... | Python | 0.999232 | @@ -2257,16 +2257,180 @@
name)%0A%0A%0A
+class HavocInc(_WordPressScraper):%0A url = 'http://www.radiocomix.com/havoc-inc/'%0A stripUrl = url + 'comic/%25s/'%0A firstStripUrl = stripUrl %25 'havoc-cover'%0A%0A%0A
class Hi
|
b43aef2a3ebd54a72791ae635dca4d7544c0ad23 | Add Flask test server | test_server.py | test_server.py | Python | 0.000001 | @@ -0,0 +1,166 @@
+from flask import Flask%0Aapp = Flask(__name__, static_folder=%22.%22, static_url_path=%22%22)%0A%0Aif __name__ == %22__main__%22:%0A app.run(debug=True, host=%22127.0.0.1%22, port=8765)%0A
| |
3352cb3f38db4f68decf6de60528ad6ff07ce613 | Create mssql_import.py | database/mssql_import.py | database/mssql_import.py | Python | 0.000002 | @@ -0,0 +1,1134 @@
+# -*-coding:cp949-*-%0A# vim: set et:ts=4:sw=4%0Aimport pyodbc%0A%0Adef import_table(file, table):%0A connection = pyodbc.connect(%0A r'DRIVER=%7BSQL Server%7D;'%0A r'SERVER=127.0.0.1%5Cinstance;'%0A r'DATABASE=database;'%0A r'UID=id;'%0A r'PWD=passwd')%0A%0A ... | |
d67b685340cf2db7cd31b50a4484c29625b8fea5 | Remove pixel test fail expectation | content/test/gpu/gpu_tests/pixel_expectations.py | content/test/gpu/gpu_tests/pixel_expectations.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import test_expectations
# Valid expectation conditions are:
#
# Operating systems:
# win, xp, vista, win7, mac, leopard, snowleopar... | Python | 0.000003 | @@ -859,161 +859,8 @@
3)%0A%0A
- self.Fail('Pixel.Canvas2DRedBox', bug=384551)%0A self.Fail('Pixel.CSS3DBlueBox', bug=384551)%0A self.Fail('Pixel.WebGLGreenTriangle', bug=384551)%0A%0A
|
b0116fb3b52e9c9f0cc156bc49f1400261ed879c | ADD mechanism table | packages/syft/src/syft/core/node/common/node_table/mechanism.py | packages/syft/src/syft/core/node/common/node_table/mechanism.py | Python | 0.000001 | @@ -0,0 +1,726 @@
+# stdlib%0Afrom typing import Any%0A%0A# third party%0Afrom sqlalchemy import Column%0Afrom sqlalchemy import LargeBinary%0Afrom sqlalchemy import String%0Afrom sqlalchemy import Integer%0A%0A# syft absolute%0Afrom syft import deserialize%0Afrom syft import serialize%0A%0A# relative%0Afrom . import B... | |
05e90660ab0072a50dd17a2afa1e08c93cf694e8 | Create reverse_k.py | python/linked_list/reverse_k.py | python/linked_list/reverse_k.py | Python | 0.011909 | @@ -0,0 +1,846 @@
+public ListNode reverseKGroup(ListNode head, int k) %7B%0A ListNode curr = head;%0A int count = 0;%0A while (curr != null && count != k) %7B // find the k+1 node%0A curr = curr.next;%0A count++;%0A %7D%0A if (count == k) %7B // if k+1 node is found%0A curr = revers... | |
5f67d1fe99817dc19e9b670532e3667f8fa9479e | rewrite IMAGE_PATH, too | python/qidoc/doxygen_project.py | python/qidoc/doxygen_project.py | import os
import qisys.command
import qidoc.doxygen
import qidoc.project
class DoxygenProject(qidoc.project.DocProject):
""" A doc projet using doxygen """
def __init__(self, doc_worktree, project, name,
depends=None, dest=None):
self.doc_type = "doxygen"
super(DoxygenProject... | Python | 0.000026 | @@ -876,20 +876,17 @@
te INPUT
- and
+,
EXAMPLE
@@ -890,16 +890,31 @@
PLE_PATH
+ and IMAGE_PATH
%0A
@@ -2405,16 +2405,30 @@
LE_PATH%22
+, %22IMAGE_PATH%22
%5D:%0A
|
85c452782722c3f58db305b5af5bd3286b0450b0 | Fix some docstrings | axelrod/tournament.py | axelrod/tournament.py | """
Recreate Axelrod's tournament
"""
import inspect
import itertools
class Axelrod:
"""
A class for an iterated prisoner's dilemma.
Take a list of players (see the Player class):
>>> P1 = Defector()
>>> P2 = Cooperator()
>>> axelrod = Axelrod(P1, P2)
>>> axelrod.round... | Python | 0.998602 | @@ -1,12 +1,11 @@
%22%22%22
-%0A
Recreate
@@ -25,19 +25,17 @@
urnament
-%0A%0A%0A
+.
%22%22%22%0A%0Aimp
@@ -87,21 +87,16 @@
%0A %22%22%22
-%0A
A class
@@ -526,33 +526,24 @@
%0A %22%22%22
-%0A
Initiate a t
@@ -562,25 +562,17 @@
players
-%0A
+.
%22%22%22%0A
@@ -689,25 +689,16... |
f18d70ce9c9e86ca184da939f9ffb193b32d981d | add 135 | vol3/135.py | vol3/135.py | Python | 0.999991 | @@ -0,0 +1,425 @@
+if __name__ == %22__main__%22:%0A L = 10 ** 6%0A sol = %5B0%5D * (L + 1)%0A for u in xrange(1, L + 1):%0A for v in xrange(1, L + 1):%0A if u * v %3E L:%0A break%0A if 3 * v %3C= u:%0A continue%0A if (u + v) %25 4 == 0 and ... | |
64b2435b77044c1a258433f8794d9bd0a431b61a | Add accept header | travis-ping.py | travis-ping.py | #Based on https://github.com/FiloSottile/travis-cron
import urllib2
import json
import sys
def api_call(url, token=None, data=None):
print url
if data:
data = json.dumps(data)
req = urllib2.Request(url, data)
if data:
req.add_header('Content-Type', 'application/json; charset=UTF-8')
... | Python | 0.000001 | @@ -382,16 +382,86 @@
token)%0A
+ req.add_header(%22Accept%22 , 'application/vnd.travis-ci.2+json')%0A
p =
|
b7d219a5afbf349385dbe9b2712f34f5e756e3e6 | add flask app | zalando/app.py | zalando/app.py | Python | 0.000003 | @@ -0,0 +1,196 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Afrom flask import Flask%0Aapp = Flask(__name__)%0A%0A@app.route('/')%0Adef hello_world():%0A return 'Hello World!'%0A%0Aif __name__ == '__main__':%0A app.run()
| |
90b92a1977c32dd660533567c0d5034b93d5c9c7 | Add smarts to cope with slug clashes with other places with the same names. | pombola/core/management/commands/core_create_places_from_mapit_entries.py | pombola/core/management/commands/core_create_places_from_mapit_entries.py | # This script will copy areas from mapit to core.places, including creating the
# place kind if required.
# import re
# import sys
from django.core.management.base import LabelCommand
from mapit.models import Type
from pombola.core.models import Place, PlaceKind
from django.template.defaultfilters import slugify
cl... | Python | 0 | @@ -938,16 +938,17 @@
.all():%0A
+%0A
@@ -955,23 +955,509 @@
-print area.name
+# There may be a slug clash as several areas have the same name but%0A # are different placekinds. Create the slug and then check to see%0A # if the slug is already in use for a placekind other than our... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.