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 |
|---|---|---|---|---|---|---|---|
8422fc90b804e250c3e918f028271cdb0b95d076 | test case for operation access | pyopenapi/tests/v2_0/test_op_access.py | pyopenapi/tests/v2_0/test_op_access.py | Python | 0 | @@ -0,0 +1,906 @@
+from pyopenapi import SwaggerApp, utils%0Afrom ..utils import get_test_data_folder%0Aimport unittest%0A%0Adef _check(u, op):%0A u.assertEqual(op.operationId, 'addPet')%0A%0Aclass OperationAccessTestCase(unittest.TestCase):%0A %22%22%22 test for methods to access Operation %22%22%22%0A%0A @cl... | |
fb2a8c9b30360f185f3d56504222efc43c6cc1a0 | Add constants.py module | Lib/ufo2ft/constants.py | Lib/ufo2ft/constants.py | Python | 0 | @@ -0,0 +1,289 @@
+from __future__ import absolute_import, unicode_literals%0A%0A%0AUFO2FT_PREFIX = 'com.github.googlei18n.ufo2ft.'%0AGLYPHS_PREFIX = 'com.schriftgestaltung.'%0A%0AUSE_PRODUCTION_NAMES = UFO2FT_PREFIX + %22useProductionNames%22%0AGLYPHS_DONT_USE_PRODUCTION_NAMES = GLYPHS_PREFIX + %22Don't use Production... | |
63f6b3e8b9febd298a8c8b3b0db467c47b7ec5d1 | Create valid_phone_number.py | valid_phone_number.py | valid_phone_number.py | Python | 0.998914 | @@ -0,0 +1,264 @@
+#Kunal Gautam%0A#Codewars : @Kunalpod%0A#Problem name: Valid Phone Number%0A#Problem level: 6 kyu%0A%0Aimport re%0Adef validPhoneNumber(phoneNumber):%0A return bool(re.match('%5B(%5D%5B0-9%5D%5B0-9%5D%5B0-9%5D%5B)%5D %5B0-9%5D%5B0-9%5D%5B0-9%5D-%5B0-9%5D%5B0-9%5D%5B0-9%5D%5B0-9%5D', phoneNumber)) ... | |
37b5531e2cc969e1ee73a46bf372d89871f922a7 | Add array of prime number generator code | tools/gen_prime.py | tools/gen_prime.py | Python | 0.000366 | @@ -0,0 +1,2129 @@
+import argparse%0Aimport sys%0A%0A# Sieve of Eratosthenes%0A# Code by David Eppstein, UC Irvine, 28 Feb 2002%0A# http://code.activestate.com/recipes/117119/%0A%0Adef gen_primes():%0A %22%22%22 Generate an infinite sequence of prime numbers.%0A %22%22%22%0A # Maps composites to primes witnes... | |
55483cf93585ced605b9123091c8b069863586dd | Update __init__.py | tendrl/commons/flows/__init__.py | tendrl/commons/flows/__init__.py | import abc
import logging
import six
from tendrl.commons.flows.exceptions import FlowExecutionFailedError
from tendrl.commons.objects import AtomExecutionFailedError
LOG = logging.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta)
class BaseFlow(object):
internal = True
def __new__(cls, *args, **kwargs):
... | Python | 0.000072 | @@ -258,28 +258,8 @@
t):%0A
- internal = True%0A
|
fbe270c39a355a62630244aa19c16c74368275f1 | add BackupJSON, a BaseJSONMonitor to read the output of a backup script | BackupJSON.py | BackupJSON.py | Python | 0 | @@ -0,0 +1,1310 @@
+#! /usr/bin/env python%0A# This is a Server Density plugin which reports what it founds in a JSON file created by a backup script.%0A# Author: yaniv.aknin@audish.com%0A%0Aimport sys%0Aassert sys.version_info%5B0%5D == 2 and sys.version_info%5B1%5D %3E= 6 or sys.version_info%5B0%5D %3E 2, 'needs Pyth... | |
27a1632a768028477f54450ccf7aaa7fba8bc428 | Initialize P09_countdown | books/AutomateTheBoringStuffWithPython/Chapter15/P09_countdown.py | books/AutomateTheBoringStuffWithPython/Chapter15/P09_countdown.py | Python | 0.000412 | @@ -0,0 +1,366 @@
+#! python3%0A# P09_countdown.py - A simple countdown script.%0A#%0A# Note:%0A# - sound file can be downloaded from http://nostarch.com/automatestuff/%0A%0Aimport time, subprocess%0A%0AtimeLeft = 60%0Awhile timeLeft %3E 0:%0A print(timeLeft, end='')%0A time.sleep(1)%0A timeLeft = timeLeft - 1... | |
47775471e2e8f0d88cb79d362114b5f49128a492 | Add example of factory usage | factory/main.py | factory/main.py | Python | 0.000001 | @@ -0,0 +1,588 @@
+import random%0A%0A%0Adef get_digit():%0A return random.randint(1, 9)%0A%0A%0Afrom zope.component.factory import Factory%0Afactory = Factory(get_digit, 'random_digit', 'Gives a random digit')%0A%0A%0Afrom zope.component import getGlobalSiteManager%0Afrom zope.component.interfaces import IFactory%0... | |
49da38f9c3514c8d886e1b6f6b42a29fccaf9e7d | Add split_mdf.py, used for exploring | tools/split_mdf.py | tools/split_mdf.py | Python | 0 | @@ -0,0 +1,1670 @@
+#!/bin/env python3%0A# vim: set fileencoding=latin-1%0A%0Aimport%09sys%0Aimport%09binascii%0Aimport%09getopt%0Aimport%09struct%0Aimport%09zlib%0A%0A%0Adef%09write_mdf_section(filename, data):%0A%0A%09# Write out the raw MDF section%0A%09open(filename, 'wb').write(data)%0A%0A%0Adef%09split_mdf_file(f... | |
091c82579d52cba080c0e2f4d5852884815551a1 | Create RechercheTD1.py | RechercheTexte/RechercheTD1.py | RechercheTexte/RechercheTD1.py | Python | 0.000001 | @@ -0,0 +1,1593 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Adef naif(motif,texte):%0A%09reponse=%5B%5D%0A%09for i in range (len(texte)):%0A%09%09if (motif==texte%5Bi:len(motif)+i%5D):%0A%09%09%09reponse.append(i)%0A%09%0A%0A%0Adef RK(motif,texte):%0A%09Lmotif=len(motif)%0A%09Ltexte=len(texte)%0A%0A%09motif... | |
b9d167cf1eba2d55ab7710e78f38c3fa010d21ef | Change init to add inverse strategy | axelrod/strategies/__init__.py | axelrod/strategies/__init__.py | from cooperator import *
from defector import *
from grudger import *
from rand import *
from titfortat import *
from gobymajority import *
from alternator import *
from averagecopier import *
from grumpy import *
strategies = [
Defector,
Cooperator,
TitForTat,
Grudger,
GoByMaj... | Python | 0.000012 | @@ -207,16 +207,38 @@
mport *%0A
+from inverse import *%0A
%0A%0Astrate
@@ -417,16 +417,32 @@
Grumpy,%0A
+ Inverse%0A
|
a15eb286e3235ff627bf9d18a4b4b64845ba00c1 | Create Days_Alive.py | Days_Alive.py | Days_Alive.py | Python | 0 | @@ -0,0 +1,1042 @@
+#-------------------------------------------------------------------------------%0A# Name: Days_Alive%0A# Purpose:%0A#%0A# Author: KKKKKBruce%0A#%0A# Created: 13/02/2013%0A# Copyright: (c) Kevin 2013%0A# Licence: The MIT License (MIT)%0A#----------------------------------------... | |
00f0ddced329724ce1b6bf49e86520ce47eaa10a | Add migration for Registry | src/ansible/migrations/0004_registry.py | src/ansible/migrations/0004_registry.py | Python | 0 | @@ -0,0 +1,652 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.5 on 2017-05-15 15:28%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 ('ansible', '0003_... | |
61c3b4f6a0afb1743faa6b3174f0e15ef8d8c043 | add unit tests for the relocate_urls function | tests/c2c_recipe_cssmin_tests.py | tests/c2c_recipe_cssmin_tests.py | Python | 0 | @@ -0,0 +1,777 @@
+import unittest%0Afrom c2c.recipe.cssmin.buildout import relocate_urls%0A%0Aclass TestCssminRecipe(unittest.TestCase):%0A def test_relocate_urls(self):%0A # Same directory:%0A self.assertEqual(relocate_urls(%22url( 'foo.png')%22, %22/a/b/src.css%22, %22/a/b/dest.css%22), %22url('foo.... | |
de5cce3d06f20d21fde766bcb85d128d89df7bf7 | add new example for traffic matrix | Controller/exp_calculateTrafficMatrix.py | Controller/exp_calculateTrafficMatrix.py | Python | 0.000001 | @@ -0,0 +1,625 @@
+# Copyright (c) 2011-2013 Peng Sun. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the COPYRIGHT file.%0A%0A# HONE application%0A# calculate traffic matrix%0A%0Afrom hone_lib import *%0A%0Aimport time%0A%0Adef TrafficMatrixQuery():%0A r... | |
3c5b1d439748363e755c257d75d25e40585410ca | Create process_reads.py | process_reads.py | process_reads.py | Python | 0 | @@ -0,0 +1,1845 @@
+import os%0Afrom subprocess import call%0A%0A%0Adef tophat_and_cuff(path, out= './'):%0A annotation_file = 'path to gtf annotation file'%0A index_gen_loc = 'path to index genome'%0A pathlist = %5B%5D%0A for root, dirs, files in os.walk(path):%0A if 'fastq' in root:%0A pathlist.append(%5B... | |
054941e5251a6ce9477f2ce5cf0c458a5b7faa34 | add tests for zpm.create_project | zpmlib/tests/test_zpm.py | zpmlib/tests/test_zpm.py | Python | 0.000001 | @@ -0,0 +1,2944 @@
+# Copyright 2014 Rackspace, Inc.%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 re... | |
dcbc9ca37406c1d2f25656e11c8a5ad170acd827 | Create Observable feature | Observable.py | Observable.py | Python | 0 | @@ -0,0 +1,652 @@
+-__author__= 'Dan and Pat'%0A-#Describes an Observable object. %0A-#includes methods to notify all observers%0A-#and to add/delete them%0A-%0A-#abstract class for Observable%0A-class Observable(object):%0A-%0A- #list of all observers%0A- observer_list = %5B%5D%0A-%0A- #notify all observers%0... | |
6fb3e783c25b973f7b49cd3f53274a2c11981192 | Add js integration tests. | pocketlint/tests/test_javascript.py | pocketlint/tests/test_javascript.py | Python | 0 | @@ -0,0 +1,1214 @@
+# Copyright (C) 2011 - Curtis Hovey %3Csinzui.is at verizon.net%3E%0A# This software is licensed under the MIT license (see the file COPYING).%0A%0Afrom pocketlint.formatcheck import(%0A JavascriptChecker,%0A JS,%0A )%0Afrom pocketlint.tests import CheckerTestCase%0Afrom pocketlint.tests.... | |
7bc5d0eda2c8cbc2b89b71c2510fe9f0d60dce4f | Add forgotten module 'exceptions' | website/exceptions.py | website/exceptions.py | Python | 0.000003 | @@ -0,0 +1,109 @@
+class ValidationError(Exception):%0A pass%0A%0A @property%0A def message(self):%0A return self.args%5B0%5D%0A
| |
725ddbb207f2b1f93be4f8c38504cb41c7515009 | add logentries integration to diamond handler | src/diamond/handler/logentries_diamond.py | src/diamond/handler/logentries_diamond.py | Python | 0 | @@ -0,0 +1,1964 @@
+# coding=utf-8%0A%22%22%22%0A%5BLogentries: Log Management & Analytics Made Easy %5D(https://logentries.com/).%0ASend Diamond stats to your Logentries Account where you can monitor and alert%0Abased on data in real time.%0A%0A#### Dependencies%0A%0A%0A#### Configuration%0A%0AEnable this handler%0A%0... | |
118f412777a2c65763cfa4bd0d45ca197f9865ff | Create andropy.py | andropy.py | andropy.py | Python | 0.000001 | @@ -0,0 +1,1417 @@
+import argparser%0Aimport sys%0Aimport ConfigClass%0Aimport createfiles%0Aimport OnlineNotifierClass%0Aimport machineClass%0Aimport apkparse%0Aimport subprocess%0Aimport time%0Aimport thread%0Aimport threading%0Aimport adbcommands%0A%0Adef create_and_config(a, b, c ,d, e, isrunning):%09%0A%09config ... | |
f86fe6b9d1014c8115d776f7e03353e273142607 | Create SubwayFeed.py | SubwayFeed.py | SubwayFeed.py | Python | 0.00062 | @@ -0,0 +1,2223 @@
+from google.transit import gtfs_realtime_pb2%0Aimport urllib%0Aimport datetime%0A%0A# http://datamine.mta.info/sites/all/files/pdfs/GTFS-Realtime-NYC-Subway%2520version%25201%2520dated%25207%2520Sep.pdf%0A# http://datamine.mta.info/list-of-feeds%0A%0Aclass SubwayFeed:%0A endpoint_url = 'http://da... | |
973405a852779f443c8c967a5e23ac40f5a0e4a2 | Add 217-contains-duplicate.py | 217-contains-duplicate.py | 217-contains-duplicate.py | Python | 0.999994 | @@ -0,0 +1,790 @@
+%22%22%22%0AQuestion:%0A Contains Duplicate%0A%0A Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.%0A%0APerformance:%0A 1. Total A... | |
426f90ba500aa5d213a8b130e1841806e2dae388 | Implement roulette wheel selection algorithm | solver/operators.py | solver/operators.py | Python | 0.000019 | @@ -0,0 +1,768 @@
+import random%0Aimport bisect%0A%0Adef select(population):%0A %22%22%22Roulette wheel selection.%0A%0A Each individual is selected to reproduce, with probability directly%0A proportional to its fitness score.%0A%0A :params population: Collection of the individuals for selecting.%0A%0A ... | |
435f55e8e25f51b9622ece010fa132383bfdfd31 | Add Support for /r/wasletztepreis | channels/wasletztepreis/app.py | channels/wasletztepreis/app.py | Python | 0 | @@ -0,0 +1,1910 @@
+#encoding:utf-8%0A%0Afrom utils import get_url, weighted_random_subreddit%0Afrom utils import SupplyResult%0A%0A%0A# Subreddit that will be a source of content%0Asubreddit = weighted_random_subreddit(%7B%0A 'wasletztepreis': 1.0,%0A # If we want get content from several subreddits%0A # plea... | |
bd9641ae4f96fd15e3fe02b969d157e69962308c | Create solution2.py | leetcode/easy/remove_duplicates_from_sorted_array/py/solution2.py | leetcode/easy/remove_duplicates_from_sorted_array/py/solution2.py | Python | 0.000045 | @@ -0,0 +1,887 @@
+#%0A# The lazybones' approach. In order to eliminate duplicates, conver the array%0A# to a set. Sort the values in the set and assign the sorted array back to %22nums%22.%0A# The %5B:%5D subscript operator is important in emulating assignment by reference.%0A# In reality, given no arguments as it is ... | |
f09b51df190bcf0d22349de7a09560cb3069f402 | Add merge migration | osf/migrations/0107_merge_20180604_1232.py | osf/migrations/0107_merge_20180604_1232.py | Python | 0.000001 | @@ -0,0 +1,346 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.11 on 2018-06-04 17:32%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('osf', '0105_merge_20180525_1529'),%0A ('osf', '0106... | |
08878d3747a50c502dafe66a06da755e42afe793 | Add doc link for ceph perf counters | src/collectors/ceph/ceph.py | src/collectors/ceph/ceph.py | # coding=utf-8
"""
The CephCollector collects utilization info from the Ceph storage system
#### Dependencies
* ceph [http://ceph.com/]
"""
import glob
import json
import logging
import os
import subprocess
import diamond.collector
LOG = logging.getLogger('diamond.' + __name__)
def flatten_dictionary(input, ... | Python | 0 | @@ -85,16 +85,103 @@
e system
+.%0A%0ADocumentation for ceph perf counters: http://ceph.com/docs/master/dev/perf_counters/
%0A%0A#### D
|
31fe72931d29d81088f23c7609aa612d4735814b | Add new sample files for Python3-py grammar | python3-py/examples/new_features.py | python3-py/examples/new_features.py | Python | 0.000001 | @@ -0,0 +1,487 @@
+def ls(self, msg, match):%0A %22%22%22%0A A sample function to test the parsing of ** resolution%0A %22%22%22%0A langs = list(map(lambda x: x.lower(), match.group(1).split()))%0A%0A bears = client.list.bears.get().json()%0A bears = %5B%7B**%7B'name': bear%7D, **content%7D%0A ... | |
95769dcf378dd81d0ccf14cf1f1f380efcb602cd | Create PedidoDeletar.py | backend/Models/Matricula/PedidoDeletar.py | backend/Models/Matricula/PedidoDeletar.py | Python | 0 | @@ -0,0 +1,328 @@
+from Framework.Pedido import Pedido%0Afrom Framework.ErroNoHTTP import ErroNoHTTP%0A%0Aclass PedidoDeletar(Pedido):%0A%0A%09def __init__(self,variaveis_do_ambiente):%0A%09%09super(PedidoDeletar, self).__init__(variaveis_do_ambiente)%0A%09%09try:%0A%09%09%09self.id = self.corpo%5B'id'%5D%09%09%09%0A%0... | |
1b3ce4ba84961c77fdabba6bcce5f47ba02402ce | fix to add the root widget to window before fire on_start event | kivy/app.py | kivy/app.py | '''
Application
===========
The :class:`App` class is the base for creating Kivy applications.
Think of it as your main entry point into the Kivy run loop. In most cases, you
subclass this class and make your own app. You create an instance of your
specific app class and then, when you are ready to start the applicat... | Python | 0.000001 | @@ -4468,79 +4468,99 @@
+if
self.
-dispatch('on_start')%0A if self.root:%0A runTouchApp
+root:%0A from kivy.core.window import Window%0A Window.add_widget
(sel
@@ -4579,18 +4579,34 @@
+s
el
-se:%0A
+f.dispatch('on_start')%0A
|
2ed7b7b6a1bda9028b93120d410d3c4de850d6fe | Support unicode. | zerver/webhooks/slack/view.py | zerver/webhooks/slack/view.py | from __future__ import absolute_import
from django.utils.translation import ugettext as _
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.lib.actions import check_send_message, create_stream_if_needed
from zerver.lib.response import json_success, json_err... | Python | 0 | @@ -520,16 +520,17 @@
PLATE =
+u
%22**%7Bmess
|
2244885111fe505a757abf9bb528b8fd8ad346f6 | add rosenbrock task | robo/task/synthetic_functions/rosenbrock.py | robo/task/synthetic_functions/rosenbrock.py | Python | 0.999984 | @@ -0,0 +1,632 @@
+import numpy as np%0A%0Afrom robo.task.base_task import BaseTask%0A%0A%0Aclass Rosenbrock(BaseTask):%0A%0A def __init__(self, d=3):%0A self.d = d%0A X_lower = np.ones(%5Bd%5D) * -5%0A X_upper = np.ones(%5Bd%5D) * 10%0A opt = np.ones(%5B1, d%5D)%0A fopt = 0.0%0A ... | |
aa8a0d3ce614a02233d31e97ce91eedc03727394 | add determine_endpoint_type helper | src/globus_cli/helpers/endpoint_type.py | src/globus_cli/helpers/endpoint_type.py | Python | 0.000006 | @@ -0,0 +1,1084 @@
+from enum import Enum, auto%0A%0A%0Aclass EndpointType(Enum):%0A # endpoint / collection types%0A GCP = auto()%0A GCSV5_ENDPOINT = auto()%0A GUEST_COLLECTION = auto()%0A MAPPED_COLLECTION = auto()%0A SHARE = auto()%0A NON_GCSV5_ENDPOINT = auto() # most likely GCSv4, but not nec... | |
c9266bd5cb11fd8f46b6f237f30d698048f88460 | Write test for dump_graph | tests/chainer_tests/training_tests/extensions_tests/test_computational_graph.py | tests/chainer_tests/training_tests/extensions_tests/test_computational_graph.py | Python | 0.000013 | @@ -0,0 +1,2750 @@
+import tempfile%0Aimport os%0Aimport shutil%0Aimport unittest%0A%0Aimport numpy%0A%0Aimport chainer%0Afrom chainer import configuration%0Afrom chainer import functions%0Afrom chainer import links%0Afrom chainer import testing%0Afrom chainer import training%0Afrom chainer.training.extensions import c... | |
2b74b894333557ab0aa9054c3d8af6b321d8e85e | Add background extractor | background_extractor.py | background_extractor.py | Python | 0 | @@ -0,0 +1,644 @@
+import cv2%0Aimport cv2.cv as cv%0Aimport numpy as np%0Aimport os%0A%0Adef bg_extract(video):%0A cap = cv2.VideoCapture(video)%0A fcount = int(cap.get(cv.CV_CAP_PROP_FRAME_COUNT))%0A _, img = cap.read()%0A avgImg = np.float32(img)%0A for fr in range(1, fcount):%0A _, img = cap.r... | |
8149048a78ebbcdb46719eab5209e51bdeb3f86d | add new package (#25747) | var/spack/repos/builtin/packages/py-colorclass/package.py | var/spack/repos/builtin/packages/py-colorclass/package.py | Python | 0 | @@ -0,0 +1,676 @@
+# 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%0Afrom spack import *%0A%0A%0Aclass PyColorclass(PythonPackage):%0A %22%22%22Colorful worry-... | |
3aab9ef96c7b8b0c4c48be4cca2d8f8813099110 | Make zsh/zpython also call .shutdown correctly | powerline/bindings/zsh/__init__.py | powerline/bindings/zsh/__init__.py | # vim:fileencoding=utf-8:noet
import zsh
from powerline.shell import ShellPowerline
from powerline.lib import parsedotval
def get_var_config(var):
try:
return [parsedotval(i) for i in zsh.getvalue(var).items()]
except:
return None
class Args(object):
ext = ['shell']
renderer_module = 'zsh_prompt'
@propert... | Python | 0.000015 | @@ -34,16 +34,30 @@
ort zsh%0A
+import atexit%0A
from pow
@@ -131,16 +131,124 @@
otval%0A%0A%0A
+used_powerlines = %5B%5D%0A%0A%0Adef shutdown():%0A%09for powerline in used_powerlines:%0A%09%09powerline.renderer.shutdown()%0A%0A%0A
def get_
@@ -1374,22 +1374,25 @@
s__ = ('
-render
+powerline
', 'side
@@ -1504,22 ... |
2d562c2642dc874d6734843a18073a1c7feaf066 | Add RandomTreesEmbedding for robust clustering | husc/cluster.py | husc/cluster.py | Python | 0 | @@ -0,0 +1,950 @@
+from sklearn.ensemble import RandomTreesEmbedding%0A%0Adef rt_embedding(X, n_estimators=100, max_depth=10, n_jobs=-1, **kwargs):%0A %22%22%22Embed data matrix X in a random forest.%0A%0A Parameters%0A ----------%0A X : array, shape (n_samples, n_features)%0A The data matrix.%0A ... | |
1c9dc57372d1c10830250f76754c826ed71e8025 | Is a string a rotation of an other one | algo/str_rotation.py | algo/str_rotation.py | Python | 0.999999 | @@ -0,0 +1,627 @@
+%22%22%22%0AProblem: Determine if a string s1 is a rotation of another string s2, by calling (only once) a function is_substring%0A%22%22%22%0A%0A%0Adef is_substring(str1, str2):%0A return str1 in str2%0A%0A%0Adef is_rotation(str1, str2):%0A if str1 is None or str2 is None:%0A return Fal... | |
af1262d175e2a3b2371df77685483c8e5074d90e | Create most-wanted-letter.py | CiO/most-wanted-letter.py | CiO/most-wanted-letter.py | Python | 0.017526 | @@ -0,0 +1,94 @@
+def checkio(l):%0A l = sorted(l.lower())%0A return max(filter(str.isalpha, l), key=l.count)%0A
| |
fac97130396057802f1ebf21928667a971395ba9 | Add a basic example of the Tabler API. | examples/ex_tabler.py | examples/ex_tabler.py | Python | 0 | @@ -0,0 +1,515 @@
+from tabler import Tabler%0A%0Atable = %22%22%22%3Ctable%3E%0A%3Cthead%3E%0A %3Ctr%3E%0A %3Cth%3ENumber%3C/th%3E%0A %3Cth%3EFirst Name%3C/th%3E%0A %3Cth%3ELast Name%3C/th%3E%0A %3Cth%3EPhone Number%3C/th%3E%0A %3C/tr%3E%0A %3Ctr%3E%0A %3Ctd%3E1%3C/td%3E%0A %3Ctd%3EBob%3C/td%3E%0A... | |
d9e0bd05075356ad310d2e196fa6d52a0ede5ae8 | robustify failure | examples/gcalctool.py | examples/gcalctool.py | import ldtp
from time import sleep
import unittest
class WidgetTestCase(unittest.TestCase):
def setUp(self):
ldtp.launchapp('gcalctool')
ldtp.waittillguiexist('frmCalculator*')
def tearDown(self):
ldtp.selectmenuitem('frmCalculator*', 'mnuQuit')
ldtp.waittillguinotexist('frmCal... | Python | 0.999998 | @@ -99,32 +99,49 @@
ef setUp(self):%0A
+ try:%0A
ldtp.lau
@@ -160,16 +160,20 @@
ctool')%0A
+
@@ -203,32 +203,94 @@
frmCalculator*')
+%0A except:%0A self.tearDown()%0A raise
%0A%0A def tearDo
|
e279f8a046d2d9b985df2b01abe23dbe154da188 | Add a simple test for version finder. | cinspect/tests/test_version.py | cinspect/tests/test_version.py | Python | 0 | @@ -0,0 +1,467 @@
+from __future__ import absolute_import, print_function%0A%0A# Standard library%0Aimport unittest%0A%0A# Local library%0Afrom cinspect.index.serialize import _get_most_similar%0A%0A%0Aclass TestVersions(unittest.TestCase):%0A%0A def test_most_similar(self):%0A # Given%0A names = %5B'i... | |
43d3d0351df4be3354519a6e5b7e1f630d5ede74 | Add testjars.py to tools - tests jars in plugins/ directory for CraftBukkit dependencies. Requires Solum (https://github.com/TkTech/Solum). | etc/tools/testjars.py | etc/tools/testjars.py | Python | 0 | @@ -0,0 +1,1375 @@
+# testjars.py%0A#%0A# Scans all .jar files in plugins/ directory of current%0A# WD for dependencies on CraftBukkit-only methods and%0A# classes (org.bukkit.craftbukkit and net.minecraft).%0A# Prints SAFE if no dependencies are found, or UNSAFE%0A# if the plugin requires CraftBukkit.%0A#%0A# Requires... | |
fcbfaded67747984899dbbabb2cdcdefe00002df | Add example script for 'simpleflow.download.with_binaries' decorator | examples/download1.py | examples/download1.py | Python | 0 | @@ -0,0 +1,410 @@
+import subprocess%0A%0Afrom simpleflow.download import with_binaries%0A%0A%0A@with_binaries(%7B%0A %22how-is-simpleflow%22: %22s3://botify-labs-simpleflow/binaries/latest/how_is_simpleflow%22,%0A%7D)%0Adef a_task():%0A print %22command: which how-is-simpleflow%22%0A print subprocess.check_ou... | |
1904e1987114d9c57602b5c1fdb41a8725cdb090 | Add LED dance example | examples/led_dance.py | examples/led_dance.py | Python | 0 | @@ -0,0 +1,692 @@
+# Light LEDs at random and make them fade over time%0A#%0A# Usage:%0A#%0A# led_dance(delay)%0A#%0A# 'delay' is the time between each new LED being turned on.%0A#%0A# TODO The random number generator is not great. Perhaps the accelerometer%0A# or compass could be used to add entropy.%0A%0Aimport mi... | |
7e90e76c0fed3abeb5c163b96ac203b251ab5b81 | Add functions to simplify graphs. | cgnet/simplify.py | cgnet/simplify.py | Python | 0 | @@ -0,0 +1,895 @@
+import networkx as nx%0A%0Adef is_simple_node( graph, node ):%0A %22%22%22A node is %22Simple%22 if none of the following is true%0A - it has multiple inputs (it joins chains together)%0A - it has no inputs (it's a root node)%0A - it has multiple outputs (it splits chains apart)%0A - i... | |
e840a73991cde9d291aa61989d8b59d07fe949f2 | add ressource tree entry point | Back/ns_portal/routes/__init__.py | Back/ns_portal/routes/__init__.py | Python | 0 | @@ -0,0 +1,353 @@
+from ns_portal.resources import root_factory%0A%0A%0Adef includeme(config):%0A '''%0A every resources or actions in this API will start by this object%0A be careful if you try to mix urlDispatch and traversal algorithm%0A keep it in mind%0A '''%0A config.set_root_factory(root_factor... | |
639143e3145682d776251f39f0a791f0c77e5169 | ADD Domain association_requests unit tests | apps/domain/tests/test_routes/test_association_requests.py | apps/domain/tests/test_routes/test_association_requests.py | Python | 0 | @@ -0,0 +1,1534 @@
+%0Adef test_send_association_request(client):%0A result = client.post(%22/association-requests/request%22, data=%7B%22id%22: %2254623156%22, %22address%22: %22159.15.223.162%22%7D)%0A assert result.status_code == 200%0A assert result.get_json() == %7B%22msg%22: %22Association request sent!%... | |
576d4090cb087a60c3a996430fef5b1550798e6c | Create mean_vol.py | mean_vol.py | mean_vol.py | Python | 0.999315 | @@ -0,0 +1,574 @@
+%22%22%22Compute mean volume%22%22%22%0A%0Aimport pandas as pd%0A%0Adef get_mean_volume(symbol):%0A %22%22%22Return the mean volume for stock indicated by symbol.%0A %0A Note: Data for a stock is stored in file: data/%3Csymbol%3E.csv%0A %22%22%22%0A df = pd.read_csv(%22data/%7B%7D.csv%... | |
1d7d86ba12fd00d388b939206abf305a6db569db | Add trainer for siamese models | reid/train_siamese.py | reid/train_siamese.py | Python | 0 | @@ -0,0 +1,1958 @@
+from __future__ import print_function%0Aimport time%0A%0Afrom torch.autograd import Variable%0A%0Afrom .evaluation import accuracy%0Afrom .utils.meters import AverageMeter%0A%0A%0Aclass Trainer(object):%0A def __init__(self, model, criterion, args):%0A super(Trainer, self).__init__()%0A ... | |
34be87320de5d5d10e55e8c91506dee230afb1b6 | Add cli menu | menu_cli.py | menu_cli.py | Python | 0.000002 | @@ -0,0 +1,2094 @@
+# -*- coding: utf-8 -*-%0A%0Aimport curses%0A%0A%0Adef init_curses():%0A stdsrc = curses.initscr()%0A curses.noecho()%0A curses.cbreak()%0A stdsrc.keypad(1)%0A return stdsrc%0A%0A%0Adef close_curses(stdsrc):%0A stdsrc.keypad(0)%0A curses.nocbreak()%0A curses.echo()%0A curs... | |
3f92a621c35d84c4d1dffd3333e015cb5ca8c0d8 | add osvReader.py | src/osvReader.py | src/osvReader.py | Python | 0.000001 | @@ -0,0 +1,763 @@
+from OCC.STEPControl import STEPControl_Reader%0Afrom OCC.IFSelect import IFSelect_RetDone, IFSelect_ItemsByEntity%0Afrom OCC.Display.SimpleGui import init_display%0A %0Astep_reader = STEPControl_Reader()%0Astatus = step_reader.ReadFile('./TABBY_EVO_step_asm.stp')%0A %0Aif status == IFSelect_RetDone:... | |
dec97d72f034826ec88de6de1609bb19bb2a410f | test file commit | just_for_git.py | just_for_git.py | Python | 0.000001 | @@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Fri Apr 21 11:25:45 2017%0A%0A@author: Katharine%0A%22%22%22%0A%0A
| |
e5106870e3e6375c309be9dc814b79968a3e1737 | Improve help for periodic message_reap_interval | cinder/message/api.py | cinder/message/api.py | # 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 writing, software
# d... | Python | 0.000753 | @@ -1040,14 +1040,21 @@
riod
+ic
task
+runs
to c
@@ -1066,23 +1066,57 @@
expired
-message
+'%0A 'messages in second
s.')%0A%5D%0A%0A
|
528afdc0f00b958f6920bd6e66c3bac841b3a8b8 | Add a test for mission. | server/kcaa/kcsapi/mission_test.py | server/kcaa/kcsapi/mission_test.py | Python | 0.000028 | @@ -0,0 +1,2134 @@
+#!/usr/bin/env python%0A%0Aimport pytest%0A%0Aimport mission%0A%0A%0Aclass TestMissionList(object):%0A%0A def pytest_funcarg__mission_list(self):%0A mission_list = mission.MissionList()%0A mission_list.missions.extend(%5B%0A mission.Mission(%0A id=1,%0A ... | |
cba6fbf305beb3cb1c90c071339822a9f7ee7179 | Create __init__.py | base_api/__init__.py | base_api/__init__.py | Python | 0.00241 | @@ -0,0 +1,2 @@
+ %0A
| |
38e294e7d8e8053ac604fdbcdcaeed59fecae1e9 | Test libewf-less calls in ewf module | tests/test_ewf.py | tests/test_ewf.py | Python | 0 | @@ -0,0 +1,1111 @@
+from os import path%0A%0Afrom digestive.ewf import EWFSource, format_supported, list_ewf_files%0A%0A%0Ahere = path.dirname(path.abspath(__file__))%0A%0A%0Adef test_format_supported():%0A supported = %5B'file.S01', 'file.E01', 'file.e01', 'file.L01', 'file.Ex01', 'file.Lx01', 'file.tar.E01'%5D%0A ... | |
270f2b28a463d5474e08adf574efd73309ba021a | Fix URLs for settings.py | cloudvalidation/settings.py | cloudvalidation/settings.py | # Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | Python | 0.000029 | @@ -3928,28 +3928,35 @@
CONF = '
-horizon.test
+openstack_dashboard
.urls'%0AT
|
3cd8f62a64c9fa42da6c3773c8e09644a931b215 | Fix docstring | src/sentry/options/types.py | src/sentry/options/types.py | """
sentry.options.types
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2015 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from sentry.utils.yaml import safe_load
from yaml.parser import ParserError
from yaml.scanne... | Python | 0.00003 | @@ -1473,27 +1473,27 @@
lue
-needs to be coerced
+is the correct type
or
|
fbc375a51aca560554f3dd28fa212d6d877449f2 | Add tests for observers and observable. | source/tests/core/test_observer.py | source/tests/core/test_observer.py | Python | 0 | @@ -0,0 +1,1120 @@
+from copy import copy%0Afrom pytest import fixture%0A%0Afrom vistas.core.observers.interface import *%0A%0A%0A@fixture(scope='session')%0Adef observer():%0A class TestObserver(Observer):%0A def __init__(self):%0A self.x = 5%0A%0A def update(self, observable):%0A ... | |
3c5116f3a26fb93ab85fd973462a582a0fa5d877 | Add script to validate web/db/handlerpresets.json file | bin/validate-presets.py | bin/validate-presets.py | Python | 0.016691 | @@ -0,0 +1,645 @@
+#!/usr/bin/python%0A%0Aimport json%0Aimport sys%0A%0A%0Adef validate_presets(presets_file):%0A with open(presets_file) as jsonfile:%0A presets_dict = json.load(jsonfile)%0A%0A for handler in presets_dict.iterkeys():%0A for entry in presets_dict.get(handler).get(%22presets%22):%0A ... | |
35bc8d1d262d658dc1d75d20cc46f853245c4d2f | Add test | celery_janitor/tests.py | celery_janitor/tests.py | Python | 0.000005 | @@ -0,0 +1,538 @@
+import unittest%0A%0Aimport mock%0A%0Afrom celery_janitor.utils import Config%0A%0A%0Aclass ConfigTest(unittest.TestCase):%0A%0A @mock.patch('celery_janitor.utils.conf.BROKER_URL', 'sqs://aws_access_key_id:aws_secret@')%0A def test_sqs_backend(self):%0A self.config = Config()%0A b... | |
61b91f6541457834f6442a44d7e3f97630be931b | Split the passwords off to a seperate file | password.py | password.py | Python | 0.007107 | @@ -0,0 +1,305 @@
+%0A#SET THESE%0Abclc_user = %22FSkyvM%22%0Abclc_pass = %22xndzEU%22%0Amtred_user = 'scarium'%0Amtred_pass = 'x'%0Aeligius_address = '1AofHmwVef5QkamCW6KqiD4cRqEcq5U7hZ'%0Abtcguild_user = 'c00w_test'%0Abtcguild_pass = '1234'%0Abitclockers_user = 'flargle'%0Abitclockers_pass = 'x'%0Amineco_user = 'c00... | |
a840ca18158d63e0359d7316354e9833e0608712 | Add __init__.py | Mapping/__init__.py | Mapping/__init__.py | Python | 0.006636 | @@ -0,0 +1,94 @@
+'''Initialization File so that modules in this directory are accessible to outside modules'''%0A
| |
b1a8c5d05fcc6bde19f7159d88f46da3fbadff6f | Add sub /r/arma | channels/arma/app.py | channels/arma/app.py | Python | 0 | @@ -0,0 +1,1898 @@
+#encoding:utf-8%0A%0Afrom utils import get_url, weighted_random_subreddit%0Afrom utils import SupplyResult%0A%0A%0A# Subreddit that will be a source of content%0Asubreddit = weighted_random_subreddit(%7B%0A 'arma': 1.0,%0A # If we want get content from several subreddits%0A # please provide... | |
9b060e0c7d1ed2a056bd7502a159688d6c416051 | Update max-stack.py | Python/max-stack.py | Python/max-stack.py | # Time: push: O(1)
# pop: O(n), there is no built-in SortedDict in python. If applied, it could be reduced to O(logn)
# popMax: O(n)
# top: O(1)
# peekMax: O(1)
# Space: O(n), n is the number of values in the current stack
class MaxStack(object):
def __init__(self):
... | Python | 0.000001 | @@ -1083,25 +1083,24 @@
return
-
self.__top%0A%0A
@@ -1186,17 +1186,16 @@
return
-
self.__m
|
3a5e1b80a2d2242bee4e0ba524fc91883e131088 | Add Closure pattern | closure.py | closure.py | Python | 0.000001 | @@ -0,0 +1,1250 @@
+%22%22%22Closure pattern%0A%0AA closure is a record storing a function together with an environment.%0A%22%22%22%0A%0A%0Adef outer(x):%0A def inner(y):%0A return x + y%0A return inner%0A%0A%0Adef outer2(x):%0A def inner2(y, x=x):%0A return x + y%0A return inner2%0A%0A%0Adef... | |
d3d813ca174924e2424bdafcb613aace8b7a5324 | Create publicip.py | publicip.py | publicip.py | Python | 0 | @@ -0,0 +1,839 @@
+#!/usr/bin/env python%0A# Author: Christopher Duffy%0A# Date: February 2, 2015%0A# Purpose: To grab your current public IP address%0A%0Aimport urllib2%0A%0Adef get_public_ip(request_target):%0A grabber = urllib2.build_opener()%0A grabber.addheaders = %5B('User-agent','Mozilla/5.0')%5D%0A try... | |
ee59095368f05d93eea1107da9c8aaeb3afe39f8 | Add custom TaskWikiException | taskwiki/util.py | taskwiki/util.py | # Various utility functions
from __future__ import print_function
import vim # pylint: disable=F0401
import regexp
import random
import sys
import os
# Detect if command AnsiEsc is available
ANSI_ESC_AVAILABLE = vim.eval('exists(":AnsiEsc")') == '2'
def tw_modstring_to_args(line):
output = []
escape_global_... | Python | 0 | @@ -247,16 +247,137 @@
= '2'%0A%0A%0A
+class TaskWikiException(Exception):%0A %22%22%22Used to interrupt a TaskWiki command/event and notify the user.%22%22%22%0A pass%0A%0A%0A
def tw_m
|
00a545e9ddc53ed99da59bdb99db728ff448fde4 | Add proof-of-concept implementation. | wr.py | wr.py | Python | 0 | @@ -0,0 +1,994 @@
+#!/usr/bin/env python%0A%0Aimport os%0Aimport sys%0Aimport time%0A%0A%0Asource = '/dev/zero'%0Adest = '/dev/sdg'%0A%0Amin_chunk_size = 4 * 1024%0Achunk_size = min_chunk_size%0Amax_chunk_size = min_chunk_size * 1024 * 4%0A%0Aadaptive = True%0Atotal = 4 * 10 * 1024 * 1024%0A%0A%0Awith open(source, 'rb'... | |
1c7e7be7132c3495802a066bc81fe63286b029cb | add 155 | 155.py | 155.py | Python | 0.999994 | @@ -0,0 +1,795 @@
+class MinStack:%0A%0A def __init__(self):%0A %22%22%22%0A initialize your data structure here.%0A %22%22%22%0A self.data = %5B%5D%0A self.minVals = %5B%5D%0A%0A def push(self, x):%0A %22%22%22%0A :type x: int%0A :rtype: void%0A %22%... | |
24b6126871a5378faa2e8f9848c279999e50cb96 | Check issue numbers to find out of order listings | ooo.py | ooo.py | Python | 0 | @@ -0,0 +1,778 @@
+#!/usr/bin/python%0A%0Aimport os%0Aimport sys%0Aimport re%0Afrom collections import defaultdict%0A%0ACOMIC_RE = re.compile(r'%5E%5Cd+ +(%5B%5E#%5D+)#(%5Cd+)')%0A%0Adef lines(todofile):%0A with open(todofile) as todolines:%0A for line in todolines:%0A title_match = COMIC_RE.match(line)%0A ... | |
aaa64ca93372c8b9d534636482a2c6349b11b757 | Add run.py | run.py | run.py | Python | 0.000009 | @@ -0,0 +1,475 @@
+import serial%0Aimport threading%0A%0Aprint('Starting server...')%0A%0Atemperature_usb = '/dev/ttyAMA0'%0ABAUD_RATE = 9600%0Atemperature_ser = ser.Serial(temperature_usb, BAUD_RATE)%0A%0Adef process_line(line):%0A%09print('Need to process line: %7B%7D'.format(line))%0A%0Adef temperature_loop():%0A%09... | |
c2cc91621535d121d2188f7e391f6c52728eeba1 | Create run.py for uwsgi setup | run.py | run.py | Python | 0 | @@ -0,0 +1,57 @@
+from index import app%0A%0Aif __name__ == %22name%22%0A app.run()%0A
| |
94d7a3b01b7360001817ef3ed3ad2003f0722b14 | Add complex parse scenario - environment variables and init | tests/script_parser/test_parsing_complex.py | tests/script_parser/test_parsing_complex.py | Python | 0 | @@ -0,0 +1,523 @@
+from script_parser import parser%0Aimport os%0A%0A%0Adef test_environ_init():%0A %22%22%22 Set up variables in environment and check parser uses them to init properly. %22%22%22%0A%0A os.environ%5B'client_id'%5D = 'x'%0A os.environ%5B'client_secret'%5D = 'y'%0A os.environ%5B'refresh_token... | |
76d781b83e1ab124cf1ae405a6cd5ad5274eef2d | add 3d conv benchmark | benchmarks/conv_3d.py | benchmarks/conv_3d.py | Python | 0.000006 | @@ -0,0 +1,588 @@
+import numpy as np%0Aimport theano%0Aimport theano.tensor as T%0Aimport treeano.nodes as tn%0AfX = theano.config.floatX%0A%0A# TODO change me%0Aconv3d_node = tn.Conv3DNode%0A# conv3d_node = tn.DnnConv3DNode%0A%0Anetwork = tn.SequentialNode(%0A %22s%22,%0A %5Btn.InputNode(%22i%22, shape=(1, 1, 3... | |
a68fb0a874a6f6a96d952d675242f63d48416091 | Make Junos timeout configurable | napalm/junos.py | napalm/junos.py | # Copyright 2015 Spotify AB. All rights reserved.
#
# The contents of this file are 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 requi... | Python | 0.000002 | @@ -1001,16 +1001,28 @@
password
+, timeout=60
):%0A
@@ -1115,16 +1115,47 @@
assword%0A
+ self.timeout = timeout%0A
@@ -1337,18 +1337,20 @@
t =
-60
+self.timeout
%0A
|
76cc1118940850aed26f1d098ae8e23c2e17956d | create obfuscateion command | cla_backend/apps/legalaid/management/commands/obfuscate.py | cla_backend/apps/legalaid/management/commands/obfuscate.py | Python | 0.000002 | @@ -0,0 +1,892 @@
+# -*- coding: utf-8 -*-%0Afrom django.core.management.base import NoArgsCommand%0A%0A%0Aclass Command(NoArgsCommand):%0A %22%22%22%0A Obfuscate all sensitive data in db%0A%0A%0A Personal details:%0A full_name%0A postcode%0A street%0A mobile_phone%0A home_ph... | |
0baf7e8863f7064dd0159c29616dd8b4751db15a | Test for issue #3. SQLite backend is not thread safe | tests/test_thread_safety.py | tests/test_thread_safety.py | Python | 0 | @@ -0,0 +1,955 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# Path hack%0Aimport os, sys%0Asys.path.insert(0, os.path.abspath('..'))%0A%0Afrom threading import Thread%0Aimport unittest%0A%0Aimport requests%0Aimport requests_cache%0A%0ACACHE_BACKEND = 'sqlite'%0ACACHE_NAME = 'requests_cache_test'%0A%0A%0Aclass ... | |
3c99116db12dce5fb5698c4ffa25d548cfbfc88d | Fix python 2.6 support, fixes #352 | flower/views/tasks.py | flower/views/tasks.py | from __future__ import absolute_import
import copy
try:
from itertools import imap
except ImportError:
imap = map
import celery
from tornado import web
from ..views import BaseHandler
from ..utils.tasks import iter_tasks, get_task_by_id
class TaskView(BaseHandler):
@web.authenticated
def get(self,... | Python | 0 | @@ -2021,26 +2021,34 @@
s =
-%7Bk:
+dict((k,
v%5B-1%5D
+)
for
+(
k, v
+)
in
@@ -2087,9 +2087,9 @@
ms()
-%7D
+)
%0A%0A
|
ceec6416f892a600adc41c0ee5bc75f7b340e200 | Deploy fabric task. | fabfile.py | fabfile.py | Python | 0 | @@ -0,0 +1,603 @@
+import os%0A%0Afrom fabric.api import run, cd%0Afrom fabric.contrib.console import confirm%0Afrom fabric.decorators import hosts%0A%0APROJECT_DIR = os.path.dirname(__file__)%0A%0A%0A@hosts('asimo@xchange.asimo.webfactional.com')%0Adef deploy_production():%0A if confirm('This action will deploy to ... | |
d9720f1fcc3013324c9ea58620df9c458a2e314e | Add (broken) AWc test for debugging purposes | test/test_awc.py | test/test_awc.py | Python | 0 | @@ -0,0 +1,878 @@
+import pytest%0Aimport FIAT%0Aimport finat%0Aimport numpy as np%0Afrom gem.interpreter import evaluate%0Afrom fiat_mapping import MyMapping%0A%0A%0Adef test_morley():%0A ref_cell = FIAT.ufc_simplex(2)%0A ref_element = finat.ArnoldWinther(ref_cell, 3)%0A ref_pts = finat.point_set.PointSet(ref... | |
e307dcd0a7e4ff6bdeeca65ae2fc09577fdecb1e | add anti hot-linking test | test/test_img.py | test/test_img.py | Python | 0.000016 | @@ -0,0 +1,715 @@
+#!/usr/bin/env python%0A# -*- coding:utf-8 -*-%0A%0A%22%22%22%E9%98%B2%E7%9B%97%E9%93%BE%E6%B5%8B%E8%AF%95%22%22%22%0A%0Afrom requests import get%0A%0A%0Aurl = 'http://read.html5.qq.com/image?src=forum&q=5&r=0&imgflag=7&imageUrl=http://mmbiz.qpic.cn/mmbiz/zYJiboYpSP4dxQ9bUDia7tXvc5xwAtibkff3wSPicGwdW... | |
a146670645eb5d225b82c56a580896fea3b6d32a | add pyfund1_sol | Code/Python/pract_fund1_sol.py | Code/Python/pract_fund1_sol.py | Python | 0.000002 | @@ -0,0 +1,2435 @@
+%22%22%22%0APractice problems, Python fundamentals 1 -- Solutions%0A%0A@authors: Balint Szoke, Daniel Csaba%0A@date: 06/02/2017%0A%22%22%22%0A%0A#------------------------------------------------------- %0A# 1) Solution%0Agood_string = %22Sarah's code%22%0A#or %0Agood_string = %22%22%22Sarah's code%... | |
8266673b2059a6cc583c5b5393d235d1a55b3ed7 | Update server.py | examples/asyncio/websocket/echo/server.py | examples/asyncio/websocket/echo/server.py | ###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# 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 with... | Python | 0.000001 | @@ -2362,17 +2362,15 @@
y, '
-127
+0
.0.0.
-1
+0
', 9
|
d5420bddc9d845a8b56d62cc798b9851f68e3713 | Add zimg test script | test/zimgtest.py | test/zimgtest.py | Python | 0 | @@ -0,0 +1,1622 @@
+import vapoursynth as vs%0Acore = vs.get_core()%0A%0Acolorfamilies = (vs.GRAY, vs.YUV, vs.RGB, vs.YCOCG)%0Aintbitdepths = (8, 9, 11, 11, 12, 13, 14, 15, 16)%0Afloatbitdepths = (16, 32)%0Ayuvss = (0, 1, 2)%0A%0Aformatids = %5B%5D%0A%0Afor cfs in colorfamilies:%0A for bps in intbitdepths:%0A ... | |
77b4624d5e0f5fb77edfca18be6ccf11d50fa862 | add Python/Visualisation/OrientedGlyphs | src/Python/Visualization/OrientedGlyphs.py | src/Python/Visualization/OrientedGlyphs.py | Python | 0 | @@ -0,0 +1,883 @@
+import vtk%0A%0AsphereSource = vtk.vtkSphereSource()%0AsphereSource.Update()%0A%0Ainput_data = vtk.vtkPolyData()%0Ainput_data.ShallowCopy(sphereSource.GetOutput())%0A%0AarrowSource = vtk.vtkArrowSource()%0A%0Aglyph3D = vtk.vtkGlyph3D()%0Aglyph3D.SetSourceConnection(arrowSource.GetOutputPort())%0Aglyp... | |
a865ea3a9557ac3238615db020e742f10a787044 | Add test_settings module | test_settings.py | test_settings.py | Python | 0.000001 | @@ -0,0 +1,483 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A%0AHELPER_SETTINGS = %7B%0A 'ALLOWED_HOSTS': %5B'localhost'%5D,%0A 'CMS_LANGUAGES': %7B1: %5B%7B'code': 'en', 'name': 'English'%7D%5D%7D,%0A 'CMS_TEMPLATES': ((%22whee.html%22, %22Whee Template%22),),%0A 'LANGUAGES': (('en', 'English'),... | |
a3a7e748c106e30b5b8cfeb50ef6722b6af5112c | Add initial test | tests/test_sr.py | tests/test_sr.py | Python | 0.000003 | @@ -0,0 +1,1039 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# module:%0A# author: Panagiotis Mavrogiorgos %3Cpmav99,gmail%3E%0A%0A%22%22%22%0A%0A%22%22%22%0A%0Aimport shlex%0Aimport subprocess%0A%0Aimport pytest%0A%0A%0A@pytest.fixture%0Adef temp_file(tmpdir):%0A sample_file = tmpdir.join(%22file.txt%22)%0... | |
1aceea20a05b5324ad20bcd3595667f64eedf973 | Add tests for `cms.views`. | cms/tests/test_views.py | cms/tests/test_views.py | Python | 0 | @@ -0,0 +1,443 @@
+from django.test import TestCase%0A%0Afrom ..views import TextTemplateView%0A%0A%0Aclass TestViews(TestCase):%0A%0A def test_texttemplateview_render_to_response(self):%0A view = TextTemplateView()%0A view.request = %7B%7D%0A view.template_name = 'templates/base.html'%0A%0A ... | |
c3ed60f1fc767e4444a4ee0abdf9a76cd21263d8 | Include example using noise reducer. | examples/preprocessing/plot_noise_reducer.py | examples/preprocessing/plot_noise_reducer.py | Python | 0 | @@ -0,0 +1,2546 @@
+#!/usr/bin/env python%0A'''%0AScript to show the application of noise reducer on jusample data.%0A'''%0A%0Aimport os%0Aimport os.path as op%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0Afrom jumeg.jumeg_noise_reducer import noise_reducer%0A%0Aimport mne%0A%0Aplt.ion()%0A%0A# load the jume... | |
3ce6009e80b728008bc4faa38e3bdc5eff954fc4 | reformat with script/pyauto.sh | dictutil/test/test_dictutil.py | dictutil/test/test_dictutil.py | #!/usr/bin/env python2
# coding: utf-8
import unittest
import dictutil
class TestDictIter(unittest.TestCase):
def test_depth_iter_default(self):
cases = (
({}, []),
({'k1': 'v1'}, [(['k1'], 'v1')]),
({'k1': 'v1', 'k2': 'v2'}, [(['k2'], 'v2'), (['k1'], 'v1')]),
... | Python | 0.000001 | @@ -898,33 +898,32 @@
idx = idx + 1%0A%0A
-%0A
def test_dep
@@ -1607,33 +1607,32 @@
idx = idx + 1%0A%0A
-%0A
def test_dep
@@ -2448,33 +2448,32 @@
idx = idx + 1%0A%0A
-%0A
def test_dep
@@ -2977,16 +2977,16 @@
rst)%0A%0A
+
@@ -3004,17 +3004,16 @@
dx + 1%0A%0A
-%0A
def
|
52f0cb0f06a7f7918cfbb2f8ead5e4e725f4072d | add script for correcting Bogotá data (when PDoCInteri is not null, it's the house number and PDoTexto is the unit, otherwise PDoTexto is the house number) | scripts/co/bogota.py | scripts/co/bogota.py | Python | 0 | @@ -0,0 +1,904 @@
+import json%0Aimport sys%0Aimport logging%0A%0Afrom esridump.dumper import EsriDumper%0A%0Alogging.basicConfig(level=logging.DEBUG)%0A%0Aoutfile_name = sys.argv%5B1%5D if len(sys.argv) %3E 1 else 'bogota.geojson'%0A%0Ad = EsriDumper('http://serviciosgis.catastrobogota.gov.co/arcgis/rest/services/Mapa... | |
e00a0430ceac9439cfc15f1d2c019e3da88f6cf7 | set up data generator | dataGenerator/dataGenerator.py | dataGenerator/dataGenerator.py | Python | 0.000001 | @@ -0,0 +1,465 @@
+import requests%0A%0ApostUrl = %22http://localhost:5000%22%0A%0Adef sendUserProfile(profile):%0A%09r = requests.post(postUrl+'/user/', data = profile)%0A%09if (!checkStatus(r)):%0A%09%09break%0A%0Adef sendScheduleProfile(profile):%0A%09r = requests.post(postUrl+'/schedule/', data = profile)%0A%0Adef ... | |
89c92a02062cf91c4e3e66fe86846e57bc3388b8 | Add new package:py-pytest-check-links (#16503) | var/spack/repos/builtin/packages/py-pytest-check-links/package.py | var/spack/repos/builtin/packages/py-pytest-check-links/package.py | Python | 0 | @@ -0,0 +1,693 @@
+# Copyright 2013-2020 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%0A%0Afrom spack import *%0A%0A%0Aclass PyPytestCheckLinks(PythonPackage):%0A %22%22%22pytest... | |
f98acc57f7ca18c21744d03cbad8f5239b4eceab | add script to create command list | bin/supported_cmds.py | bin/supported_cmds.py | Python | 0 | @@ -0,0 +1,1706 @@
+import sys%0A%0Afrom collections import OrderedDict, namedtuple%0A%0Afrom pyipmi.msgs.registry import DEFAULT_REGISTRY%0A%0A%0Adef make_table(grid):%0A col_length = map(list, zip(*%5B%5Blen(item) for item in row%5D for row in grid%5D))%0A max_cols = %5Bmax(out) for out in col_length%5D%0A r... | |
fda2eeb1b16ccd13b18d0badb5c3bcf93e08ea38 | Add initial code to obtain haplographs. | phasm/walker.py | phasm/walker.py | Python | 0 | @@ -0,0 +1,3570 @@
+%22%22%22%0AObtain graph representations for chromosomes from the total assembly graph.%0A%0AThis module contains functions to obtain %22fused%22 haplotype contigs. Or in other%0Awords: it helps in obtaining subgraphs from the assembly graph that represent%0Aa set of chromosome copies. This subgraph... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.