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 |
|---|---|---|---|---|---|---|---|
53cbc714d9e7d498443356c370e5e77d24118764 | add clear names_txt script | tmp_tools/cleanup_names.txt.py | tmp_tools/cleanup_names.txt.py | Python | 0.000001 | @@ -0,0 +1,1464 @@
+#!/usr/bin/python3%0A%0A%22%22%22%0ARemove entries from names.txt that already present in ini files.%0A%22%22%22%0A%0Aimport os%0Aimport re%0Afrom enviroment import BASE_PATH, MP_PATH%0Afrom ini_file import IniFile%0A%0Aname_reg = re.compile('%5E(%5B%5Cw-%5D+)%5B %5Ct%5D+(.*)')%0A%0Adef clean(module... | |
ea51e276d17169c0ec62d694b513cea4fea167a4 | Add file for dealing with search queries | search.py | search.py | Python | 0 | @@ -0,0 +1,92 @@
+import click%0Aimport requests%0A%0A%0Adef anime_search():%0A%0A pass%0A%0A%0Adef manga_search():%0A pass%0A
| |
f75bc25d3aed7bce65a8274fcf539db0eafc9900 | Add adversarial module | artificial/searches/adversarial.py | artificial/searches/adversarial.py | Python | 0.000002 | @@ -0,0 +1,2106 @@
+import time%0Aimport numpy as np%0A%0Afrom . import base%0A%0A%0Aclass MinMax(base.Search):%0A %22%22%22Min Max Adversarial Search.%0A %0A Parameters%0A ----------%0A time_limit : float (default=np.inf)%0A Time limit (in seconds) for a performance.%0A By default, search ... | |
e37b855bf50afefafb190c6c2346c13cbc3f14b4 | Create quiz5.py | laboratorios/quiz5.py | laboratorios/quiz5.py | Python | 0.000002 | @@ -0,0 +1,1155 @@
+#quiz5%0A%0Aclass Hola(object):%0A%0A%09mensaje = %22Hola mundo%22%0A%09__contador = 0%0A%0A%09def ingresar(self,texto):%09%0A%0A%09%09texto = input(%22Ingrese mensaje%22)%0A%09%09self.texto = texto%0A%0A%09def comparar(object):%0A%09%09if texto == mensaje:%0A%09%09%09return(+str%22mensaje%22+)%0A%0... | |
1b4bf232b9fd348a94b8bc4e9c851ed5b6d8e801 | Add tests for config generation | tests/config/test_room_directory.py | tests/config/test_room_directory.py | Python | 0.000001 | @@ -0,0 +1,2128 @@
+# -*- coding: utf-8 -*-%0A# Copyright 2018 New Vector Ltd%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.... | |
b7b01cc092cd8ea62ac5f8cb64d4dfe1dafd877f | Create client.py | client.py | client.py | Python | 0.000001 | @@ -0,0 +1,764 @@
+import ntplib%0Aimport sys, os, subprocess%0Afrom time import ctime%0A%0AHostIP = '127.0.0.1'%0A%0A# Essential shell functionality%0Adef run_command(cmd):%0A proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,%0A stderr=subprocess.PIPE, stdin=subprocess.PIPE)%0A stdoutput = proc.std... | |
db61502f493871a1355d0d23c50ada89b8696bff | Add white_balance tests module | tests/plantcv/test_white_balance.py | tests/plantcv/test_white_balance.py | Python | 0.000001 | @@ -0,0 +1,1380 @@
+import pytest%0Aimport cv2%0Afrom plantcv.plantcv import white_balance%0A%0A%0Adef test_white_balance_gray_16bit(test_data):%0A # Read in test data%0A img = cv2.imread(test_data.fmax, -1)%0A # Test with mode %22hist%22%0A white_balanced = white_balance(img=img, mode='hist', roi=(5, 5, 80... | |
3f10c701d5b7c778a2f82a047ef3bb940d684fa7 | rename camelcase fields in slice | planetstack/core/migrations/0004_slice_field_case.py | planetstack/core/migrations/0004_slice_field_case.py | Python | 0.000001 | @@ -0,0 +1,579 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0Aimport timezones.fields%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('core', '0003_network_field_case'),%0A %5D%0A%0A operations = %5B%0A ... | |
948200f4cf10449a40e75e539f58cab409ce3461 | Update sites -> migrations | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/contrib/sites/migrations/0001_initial.py | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/contrib/sites/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.sites.models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Site',
fields=[
... | Python | 0 | @@ -359,16 +359,34 @@
me='ID',
+ primary_key=True,
seriali
@@ -412,34 +412,16 @@
ted=True
-, primary_key=True
)),%0A
@@ -464,24 +464,8 @@
eld(
-max_length=100,
verb
@@ -487,16 +487,32 @@
n name',
+ max_length=100,
validat
@@ -624,23 +624,8 @@
eld(
-max_length=50,
verb
@@ -647,16 +647,31 @@
ay name'
+... |
3cd759c4794f8688866970d68c39023c6bef1a3d | Add tests for representations | test_classy/test_representations.py | test_classy/test_representations.py | Python | 0 | @@ -0,0 +1,2736 @@
+from flask import Flask, make_response%0Afrom flask_classy import FlaskView%0Aimport json%0Afrom nose.tools import *%0A%0A%0Aclass JsonResource(object):%0A content_type = 'application/json'%0A%0A def output(self, data, code, headers=None):%0A dumped = json.dumps(data)%0A response... | |
958a8bb4de0f11688b02a3501fe1e0b9cac28178 | add gnomad | pynnotator/helpers/gnomad.py | pynnotator/helpers/gnomad.py | Python | 0.000171 | @@ -0,0 +1,2088 @@
+#Gemini wrapper%0Aimport argparse%0Afrom subprocess import run%0Afrom pynnotator import settings%0Aimport os%0A%0Aclass GnomAD:%0A def __init__(self, vcf, cores):%0A self.data = %5B%5D%0A%0A def install():%0A print('Install gnomAD')%0A%0A os.chdir(settings.data_dir)%0A%0A ... | |
83c17fe4afe87db3d1445a4a4ce06ce2f46a2221 | Remove unnecessary importing | vint/linting/formatter/formatter.py | vint/linting/formatter/formatter.py | from pathlib import Path
from ansicolor import Colors, colorize
from operator import attrgetter
DEFAULT_FORMAT = '{file_path}:{line_number}:{column_number}: {description} (see {reference})'
FORMAT_COLOR_MAP = {
'file_path': Colors.Red,
'file_name': Colors.Red,
'line_number': Colors.White,
'column_num... | Python | 0.000014 | @@ -61,40 +61,8 @@
ize%0A
-from operator import attrgetter%0A
%0A%0ADE
|
fefcc9ab57b5dc818690c4febc4250fffb0f9543 | Add a new sub example regarding custom ACL modification | subs/modify_acl.py | subs/modify_acl.py | Python | 0 | @@ -0,0 +1,2477 @@
+# Copyright 2016 Netfishers%0A# %0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A# %0A# http://www.apache.org/licenses/LICENSE-2.0%0A# %0A# Unless required b... | |
8cc020949f1d7eb9c66121a7d3a762738cb44c2c | Add dictionary mapping abbreviations to station names | src/station_map.py | src/station_map.py | Python | 0.000003 | @@ -0,0 +1,1387 @@
+station_map = %7B%0A '12th': '12th St. Oakland City Center',%0A '16th': '16th St. Mission (SF)',%0A '19th': '19th St. Oakland',%0A '24th': '24th St. Mission (SF)',%0A 'ashb': 'Ashby (Berkeley)',%0A 'balb': 'Balboa Park (SF)',%0A 'bayf': 'Bay Fair (San Leandro)',%0A 'cast': 'C... | |
eeee6f03131fe20bb3374cbd6c8f80b3894083da | Create main.py | main.py | main.py | Python | 0 | @@ -0,0 +1,1924 @@
+#!/usr/bin/env python%0A%22%22%22%0Aqr - Convert stdin (or the first argument) to a QR Code.%0A%0AWhen stdout is a tty the QR Code is printed to the terminal and when stdout is%0Aa pipe to a file an image is written. The default image format is PNG.%0A%22%22%22%0Aimport sys, os%0Aimport optparse%0Ai... | |
af492e64e4da81a5e65c3d2f2a9cdc6c6b34e786 | add main | main.py | main.py | Python | 0.000378 | @@ -0,0 +1,802 @@
+import argparse%0A%0A%0Adef main():%0A %22%22%22Main method.%22%22%22%0A parser = argparse.ArgumentParser(description='Look for an author in the Web of Science.')%0A parser.add_argument('author', help='Surname and name of the author')%0A parser.add_argument('-v', '--verbose', action='stor... | |
cb1d6f417a5349df485b99bf8a41744b7692cf07 | Create main.py | main.py | main.py | Python | 0.000001 | @@ -0,0 +1,1420 @@
+import sys%0Afrom Tkinter import *%0Afrom winsound import *%0Afrom PIL import ImageTk, Image%0Aimport tkFont%0A%0Awindow = Tk()%0A%0A%0Aim0 = Image.open('image%5C%5Cbackground.jpg')%0Atkimage = ImageTk.PhotoImage(im0)%0ALabel(window,image = tkimage).pack()%0A%0Awindow.iconbitmap('image%5C%5Cicon.ico... | |
184c33d7528e61010116599f1ca3fbb68f1dc4a7 | add tkinter template | main.py | main.py | Python | 0 | @@ -0,0 +1,414 @@
+#!/usr/local/bin/python3.4%0A#coding: utf-8%0A%0Aimport tkinter as tk%0A%0Aclass MainApplication(tk.Frame):%0A def __init__(self, parent, *args, **kwargs):%0A tk.Frame.__init__(self, parent, *args, **kwargs)%0A self.parent = parent%0A # %3Ccreate the rest of your GUI here%3E%0... | |
46a130d1a28025cc5060560d734deed11b4346c9 | Introduce node.py. | node.py | node.py | Python | 0 | @@ -0,0 +1,2071 @@
+#!/usr/bin/env python%0A# -*- coding: UTF-8%0A%0Aimport os%0Aimport sys%0Aimport socks%0A%0Aclass Node(object):%0A def __init__(self, address, port):%0A self.address = address%0A self.port = port%0A%0A%22%22%22%0A%5B%5D: node = NetworkNode(%22192.168.0.112%22, 5555, %22SOCKS5%22)%0A... | |
7ff3d55691d89eb8a00f273af18bade8602f34d0 | insert to db outbox | insert.py | insert.py | Python | 0 | @@ -0,0 +1,373 @@
+#!/usr/bin/env python%0A%22%22%22%0Ainsert.py - Program to :%0A1. insert to outbox collection, %0A2. check if main is running? if not run then run%0A%22%22%22%0Aprint %22Content-Type: text-html%22%0Aprint%0Aimport cgitb%0Acgitb.enable()%0Aimport cgi%0Aimport smsweb%0A%0Aform = cgi.FieldStorage()%0A%... | |
cded6c2f088736ace88c0771a08cd9c8ef6dccef | Test for NullConfigStorage | server/lib/python/cartodb_services/test/refactor/storage/test_null_config.py | server/lib/python/cartodb_services/test/refactor/storage/test_null_config.py | Python | 0 | @@ -0,0 +1,517 @@
+from unittest import TestCase%0Afrom cartodb_services.refactor.storage.null_config import NullConfigStorage%0Afrom cartodb_services.refactor.core.interfaces import ConfigBackendInterface%0A%0A%0Aclass TestNullConfigStorage(TestCase):%0A%0A def test_is_a_config_backend(self):%0A null_config ... | |
4c5a2540ea665d763e7a66fcae108dd1a2656a00 | fix file extension issue | you_get/downloader/mixcloud.py | you_get/downloader/mixcloud.py | #!/usr/bin/env python
__all__ = ['mixcloud_download']
from ..common import *
def mixcloud_download(url, output_dir = '.', merge = True, info_only = False):
html = get_html(url)
title = r1(r'<meta property="og:title" content="([^"]*)"', html)
url = r1("data-preview-url=\"([^\"]+)\"", html)
url = ... | Python | 0 | @@ -678,28 +678,27 @@
rl%5D, title,
-type
+ext
, size, outp
|
8951477a3b6f9e07e2f81e18b698cd0afda69d60 | add terms tests | bluebottle/terms/tests/test_api.py | bluebottle/terms/tests/test_api.py | Python | 0.00022 | @@ -0,0 +1,1288 @@
+from django.core.urlresolvers import reverse%0A%0Afrom rest_framework import status%0A%0Afrom bluebottle.test.utils import BluebottleTestCase%0Afrom bluebottle.test.factory_models.accounts import BlueBottleUserFactory%0Afrom bluebottle.test.factory_models.terms import TermsFactory%0A%0A%0Aclass Term... | |
6632f374d0d9979fd94f462e861dfb21ae146a48 | Move utilities out of FilePlayer into sound.Util | code/python/echomesh/sound/Util.py | code/python/echomesh/sound/Util.py | Python | 0.000001 | @@ -0,0 +1,1316 @@
+from __future__ import absolute_import, division, print_function, unicode_literals%0A%0Aimport aifc%0Aimport math%0Aimport numpy%0Aimport sunau%0Aimport wave%0A%0Afrom echomesh.util import Subprocess%0A%0ALOGGER = Log.logger(__name__)%0A%0ADEFAULT_AUDIO_DIRECTORY = DefaultFile.DefaultFile('assets/au... | |
1036f365fa2d2152f5da8a449aa2005ddb780e04 | Refactor generate csv test to expect a stream (generator) | tests/app/test_utils.py | tests/app/test_utils.py | from pathlib import Path
from io import StringIO
from csv import DictReader
import pytest
from freezegun import freeze_time
from app.utils import email_safe, generate_notifications_csv, generate_previous_dict, generate_next_dict, Spreadsheet
@pytest.mark.parametrize('service_name, safe_email', [
('name with spa... | Python | 0.000001 | @@ -1941,17 +1941,16 @@
)%0A
-%0A
for
@@ -1976,16 +1976,21 @@
tringIO(
+next(
csv_cont
@@ -1994,16 +1994,17 @@
ontent))
+)
:%0A
|
45dc85ded5a766191cd58d76a16470fc063d6e70 | Add error formatting tests for httperror | tests/test_httperror.py | tests/test_httperror.py | Python | 0 | @@ -0,0 +1,644 @@
+import unittest%0A%0Afrom fleece import httperror%0A%0A%0Aclass HTTPErrorTests(unittest.TestCase):%0A %22%22%22Tests for :class:%60fleece.httperror.HTTPError%60.%22%22%22%0A%0A def test_error_msg_format(self):%0A with self.assertRaises(httperror.HTTPError) as err:%0A raise htt... | |
cad79ac342ffe685062c5c90f05e6f573fb7b5b5 | Add missing test file. See #1416. (#1417) | tests/test_streamset.py | tests/test_streamset.py | Python | 0.000001 | @@ -0,0 +1,1750 @@
+from pytest import mark%0A%0Afrom tests import factories%0Afrom tests import common_tools%0Afrom tests.common_tools import (%0A make_user,%0A create_talk_for_user,%0A get_default_conference,%0A template_used)%0Afrom conference import user_panel%0Afrom conference import models%0A%0ASTERAM... | |
a627fa4c681bdd9de323750c3ab3f2cb0d5fca86 | Add basic infrastructure for rest API | server/hoot/app.py | server/hoot/app.py | Python | 0.000001 | @@ -0,0 +1,238 @@
+#!../env/bin/python%0Afrom flask import Flask, jsonify%0A%0Aapp = Flask(__name__)%0A%0A@app.route('/hoot/api/v1.0/', methods=%5B'GET'%5D)%0Adef index():%0A return jsonify(%7B'hello': 'Hello World!'%7D)%0A%0A%0Aif __name__ == '__main__':%0A app.run(debug=True)%0A%0A%0A
| |
f983f78262accdca35982ea3c6088b85bb836a8a | Create phasing_success.py | phasing_success.py | phasing_success.py | Python | 0.000011 | @@ -0,0 +1,1592 @@
+from os import listdir%0Aimport sqlite3%0A%0Aconn = sqlite3.connect('metrix_db.sqlite')%0Acur = conn.cursor()%0A%0A%0Apath = '/dls/mx-scratch/melanie/for_METRIX/data_base_proc/simple_MR'%0Adir_list = listdir(path)%0Apdb_list = %5B%5D%0Adata_list = %5B%5D%0Afor item in dir_list:%0A if len(item) == 4... | |
acfb7c902a2cf5c7a8a59218dc36dc371da01922 | Add compliance with rule E261 to bots/define/define.py. | contrib_bots/bots/define/define.py | contrib_bots/bots/define/define.py | # See readme.md for instructions on running this code.
import logging
import json
import requests
import html2text
class DefineHandler(object):
'''
This plugin define a word that the user inputs. It
looks for messages starting with '@mention-bot'.
'''
DEFINITION_API_URL = 'https://owlbot.info/api/... | Python | 0 | @@ -2334,16 +2334,17 @@
else:
+
# Defin
|
3c31c9541cab4e452074b7c2ab08f28e48f47e4c | add admin site for DomainLink | corehq/apps/linked_domain/admin.py | corehq/apps/linked_domain/admin.py | Python | 0 | @@ -0,0 +1,497 @@
+from __future__ import absolute_import%0Afrom django.contrib import admin%0Afrom .models import DomainLink%0A%0A%0Aclass DomainLinkAdmin(admin.ModelAdmin):%0A model = DomainLink%0A list_display = %5B%0A 'linked_domain',%0A 'master_domain',%0A 'remote_base_url',%0A 'l... | |
93d66d085a618b104d67a5fc1d1cf7507c31fff6 | fix NameError | crosscat/utils/experiment_utils.py | crosscat/utils/experiment_utils.py | import os
import collections
#
import crosscat.utils.file_utils as file_utils
import crosscat.utils.geweke_utils as geweke_utils
import crosscat.utils.general_utils as general_utils
result_filename = geweke_utils.summary_filename
def find_configs(dirname, filename=result_filename):
root_has_filename = lambda (r... | Python | 0.000014 | @@ -451,16 +451,21 @@
filter(
+root_
has_file
|
bf5f63ce8c6bd4fbef48c848cc8ed9eb5874b326 | Create test.py | test.py | test.py | Python | 0.000005 | @@ -0,0 +1,1506 @@
+import random%0Afrom sort_and_search import *%0A%0A# Bubble Sort%0A%0Aarray = %5Brandom.randint(0, 100) for n in range(40)%5D%0Aprint('Bubble Sort:%5Cn')%0Aprint('Before:%5Cn', array)%0Abubble_sort(array)%0Aprint('After:%5Cn', array)%0Aprint('%5Cn')%0A%0A# Selection Sort%0A%0Aarray = %5Brandom.randi... | |
3c065b1c1633c0fccebfa1efe76fe59aa8fed3f4 | Add XKCDPlugin class with basic xkcd command. | xkcd.py | xkcd.py | Python | 0 | @@ -0,0 +1,2191 @@
+%22%22%22%0AXKCD brutal plugins.%0A%0AProvides basic commands for showing xkcd info in IRC.%0A%22%22%22%0A%0Afrom brutal.core.plugin import BotPlugin, cmd%0Aimport json%0Aimport urllib%0A%0A%0ASLEEP_TIME = 3600%0A%0A%0Adef get_xkcd_metadata(num=None):%0A %22%22%22Returns data about xkcd number 'n... | |
b10db4316af4f044cbde96076064beae33101d6d | Add misc parser | misc.py | misc.py | Python | 0.000001 | @@ -0,0 +1,1843 @@
+# vim:fileencoding=utf-8:ts=8:et:sw=4:sts=4:tw=79%0A%0Afrom datetime import datetime%0Afrom json import loads%0Afrom urllib import urlencode%0A%0Afrom twisted.internet.defer import Deferred%0Afrom twisted.python import log%0Afrom twisted.web.client import getPage%0A%0AUBERNET_NEWS_URL = %22http://ub... | |
1ef26b03bfda67e12af557944417b59357a5c324 | Create __init__.py | apriori/__init__.py | apriori/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
f82730bfab4a65efa6cd1e7ecb767514bbb481a4 | add function to find local IP addresses | src/wormhole/ipaddrs.py | src/wormhole/ipaddrs.py | Python | 0 | @@ -0,0 +1,2460 @@
+%0A# Find all of our ip addresses. From tahoe's src/allmydata/util/iputil.py%0A%0Aimport os, re, subprocess, errno%0Afrom sys import platform%0A%0A# Wow, I'm really amazed at home much mileage we've gotten out of calling%0A# the external route.exe program on windows... It appears to work on all%0A#... | |
6e63032cee81bfa8125c7eecd4d1697ddf4ff159 | Create procrastination.py | procrastination.py | procrastination.py | Python | 0 | @@ -0,0 +1,32 @@
+def procrastination():%0A pass%0A
| |
c336d907482958da06417c36723574b67d8ef2a5 | Add SQLite support | sqlite_importer.py | sqlite_importer.py | Python | 0.000001 | @@ -0,0 +1,2160 @@
+import logging%0Aimport parsers%0Aimport collections%0Aimport itertools%0Aimport json%0Afrom datetime import datetime%0Aimport sqlite3%0A%0Adef lines():%0A for contact in messages:%0A for line in messages%5Bcontact%5D:%0A yield (contact, line%5B'contact'%5D,line%5B'timestamp'%5... | |
9dd8fa91749d4be7037b08fcb89e5a2f22ff5dc3 | 263. Ugly Number | p263.py | p263.py | Python | 0.999995 | @@ -0,0 +1,999 @@
+import unittest%0A%0A%0Aclass Solution(object):%0A def isUgly(self, num):%0A %22%22%22%0A :type num: int%0A :rtype: bool%0A %22%22%22%0A if num %3C= 0:%0A return False%0A%0A for factor in %5B5, 3, 2%5D:%0A while True:%0A ... | |
500df3f340d7782c759634529ae40ce56f7bec3e | Add first file Only read a .docx until now | plag.py | plag.py | Python | 0 | @@ -0,0 +1,753 @@
+from docx import Document%0A%0Aif __name__ == %22__main__%22:%0A if sys.args%5B0%5D == 0:%0A print(%22Must specify file!%22)%0A return%0A #open the docx (and docx only)%0A document = Document(sys.args%5B0%5D)%0A #for each paragraph on the docx%0A for parag in document.par... | |
94794e61298e6b1763f571d5e48c3549a538ac51 | add tests | test_sequential.py | test_sequential.py | Python | 0 | @@ -0,0 +1,1414 @@
+%22%22%22Tests the decorators.%22%22%22%0A%0Atry:%0A import unittest2 as unittest%0Aexcept ImportError:%0A import unittest%0A%0Afrom sequential import before, after, during%0A%0A%0A__all__ = %5B'TestSequential'%5D%0A%0A%0Aclass TestSequential(unittest.TestCase):%0A def test_before_chain(sel... | |
8b70516830e0226c96a274c484ec1681c6e248a4 | test for resources, still needs bytesio and stringio test... | tests/test_util.py | tests/test_util.py | Python | 0 | @@ -0,0 +1,771 @@
+# This module is part of Hypatia and is released under the%0A# MIT license: http://opensource.org/licenses/MIT%0A%0A%22%22%22py.test unit testing for hypatia/util.py%0A%0ARun py.test on this module to assert hypatia.util%0Ais completely functional.%0A%0A%22%22%22%0A%0Aimport os%0A%0Atry:%0A import... | |
89f837997b6ed84b14d01cadbe8bfeeb4e0dcf36 | add base keyword file | libs/base_keywords.py | libs/base_keywords.py | Python | 0.000001 | @@ -0,0 +1,29 @@
+# @Time : 2016/11/18 16:32
| |
52b2e617ab8fcbb268d1d75c90b3f92470737f41 | Create __init__.py | logserver/__init__.py | logserver/__init__.py | Python | 0.000001 | @@ -0,0 +1,450 @@
+import hug%0Atry:%0A%09from . import runserver%0A%09##to run windowslogonofflogger%0A%09##https://github.com/bengjerstad/windowslogonofflogger%0A%09hug.API(__name__).extend(runserver, '')%0A%09print('Running windowslogonofflogger Server')%0Aexcept:%0A%09%09pass%0A%09%09%0Atry:%0A%09from . import logs... | |
882de02df3131cf19eed5750428bcb79ce7f30c1 | Add DB migration for netdev bindings | netprofile_access/migrations/f2d2359b923a_link_bindings_to_access_entities.py | netprofile_access/migrations/f2d2359b923a_link_bindings_to_access_entities.py | Python | 0 | @@ -0,0 +1,1875 @@
+%22%22%22link bindings to access entities%0A%0ARevision ID: f2d2359b923a%0ARevises: b32a4bf96447%0ACreate Date: 2018-01-09 16:59:13.885801%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = 'f2d2359b923a'%0Adown_revision = 'b32a4bf96447'%0Abranch_labels = None%0Adepends_on = N... | |
16489e1c7486e90f2e36b1c3c2c5625077e42345 | Create ssap.py | ssap.py | ssap.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
1eecfc0f2fd63ed9885bae65a6d64fead4d44fce | add test.py | test.py | test.py | Python | 0.000012 | @@ -0,0 +1,1637 @@
+#coding=utf-8%0D%0Aimport splinter%0D%0Aimport time%0D%0Aimport random%0D%0Aimport requests%0D%0Aimport re%0D%0Afrom bs4 import BeautifulSoup%0D%0Afrom splinter import Browser%0D%0Afrom selenium import webdriver%0D%0Aimport time%0D%0A%0D%0Aclass Duobao:%0D%0A%09baseurl = %22http://1.163.com/user/win... | |
5c269bfeb517b70cfcb8fd730bf3eb983a5515dc | Create a quick script to train a COBE brain from a folder of formatted IRC logs | markov_batch_learn.py | markov_batch_learn.py | Python | 0 | @@ -0,0 +1,1446 @@
+from __future__ import unicode_literals%0Aimport argparse%0Aimport os%0Afrom cobe.brain import Brain%0A%0Aif __name__ == %22__main__%22:%0A%0A bots = %5B%22ames%22, %22bojii%22, %22diderobot%22, %22ekimbot%22, %22harbot%22, %22hubbot%22, %22nopebot%22, %22memebot%22,%0A %22pyheufybot%2... | |
5c60b11839370460209e98f18867bce338d13fba | add migration | adhocracy4/projects/migrations/0012_help_texts.py | adhocracy4/projects/migrations/0012_help_texts.py | Python | 0.000001 | @@ -0,0 +1,1015 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.4 on 2017-09-27 12:06%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('a4projects', '0011_fix_copyright_field_desc'),%0A ... | |
021408f6374494babc750055a88d871de78da780 | Fix a circular method call that caused customs_twist to eat over 60% RAM. | mysite/customs/bugimporters/base.py | mysite/customs/bugimporters/base.py | # This file is part of OpenHatch.
# Copyright (C) 2011 Jack Grigg
# Copyright (C) 2011 OpenHatch, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, o... | Python | 0.000007 | @@ -6941,31 +6941,29 @@
#
-Now that
+For
the
-se
Bugs
-all
+that now
hav
@@ -6992,16 +6992,46 @@
e them.%0A
+ if bugs_to_retry:%0A
|
be2f0851f36dc0c74767459f5d11bd545b4a2f6a | Add perftests for sync | tests/test_sync.py | tests/test_sync.py | # -*- coding: utf-8 -*-
'''
tests.test_sync
~~~~~~~~~~~~~~~
:copyright: (c) 2014 Markus Unterwaditzer
:license: MIT, see LICENSE for more details.
'''
import pytest
from vdirsyncer.storage.base import Item
from vdirsyncer.storage.memory import MemoryStorage
from vdirsyncer.sync import sync
from . impo... | Python | 0 | @@ -4161,8 +4161,676 @@
tag_b)%7D%0A
+%0Adef test_uses_get_multi(monkeypatch):%0A def breakdown(*a, **kw):%0A raise AssertionError('Expected use of get_multi')%0A%0A get_multi_calls = %5B%5D%0A%0A old_get = MemoryStorage.get%0A%0A def get_multi(self, hrefs):%0A get_multi_calls.append(hrefs)%0... |
ddc3e45f5f84e5574090ee79875039e401864a49 | Add test for extension loading and unloading | IPython/core/tests/test_extension.py | IPython/core/tests/test_extension.py | Python | 0 | @@ -0,0 +1,2303 @@
+import os.path%0A%0Aimport nose.tools as nt%0A%0Aimport IPython.testing.tools as tt%0Afrom IPython.utils.syspathcontext import prepended_to_syspath%0Afrom IPython.utils.tempdir import TemporaryDirectory%0A%0Aext1_content = %22%22%22%0Adef load_ipython_extension(ip):%0A print(%22Running ext1 load%... | |
b16e18a636f8484ea9478522c8ecba58b79adf6e | add ability to delete tasks selectively, useful for testing penta import | volunteers/management/commands/delete_tasks.py | volunteers/management/commands/delete_tasks.py | Python | 0 | @@ -0,0 +1,759 @@
+from django.core.management.base import BaseCommand%0Afrom volunteers.models import Task, TaskTemplate%0A%0A%0Aclass Command(BaseCommand):%0A%0A def handle(self, *args, **options):%0A if len(args) %3C= 0:%0A valid_choices = ', '.join(%5Btt.name for tt in TaskTemplate.objects.all(... | |
a5b43e23008eaca8da9d7d740c3ce976b698b615 | Add Daniel Berlin's draft of a 'blame' script. | tools/examples/blame.py | tools/examples/blame.py | Python | 0 | @@ -0,0 +1,2336 @@
+#!/usr/bin/env python2%0A#%0A# USAGE: annotate.py %5B-r REV%5D %5B-h DBHOME%5D repos-path%0A#%0A%0Aimport sys%0Aimport os%0Aimport getopt%0Aimport difflib%0Afrom svn import fs, util%0A%0ACHUNK_SIZE = 100000%0A%0Adef getfile(pool, path, rev=None, home='.'):%0A%0A db_path = os.path.join(home, 'db')%0... | |
8a2d86cb5d78d0865d5b0ed2e99fe79e4c739759 | Add calc_size tool | tools/calc_size.py | tools/calc_size.py | Python | 0.000002 | @@ -0,0 +1,714 @@
+#! /usr/bin/env python%0A%0Aimport os%0Aimport os.path%0Aimport sys%0A%0Adef _sumSize(path):%0A size = os.path.getsize(path)%0A print path, %22=%22, size, %22bytes%22%0A return size%0A%0Adef sumSize(path):%0A sizeTotal = 0;%0A if os.path.isdir(path):%0A for p in os.listdir(path)... | |
7a7ce392539c724d0ee8bc2d7a82dda9194a9aae | Switch to the same default key we use for tests in our bindings | monospace/settings.py | monospace/settings.py | import os
# Stripe keys
STRIPE_PUBLISHABLE = 'pk_dHA9lrZx2If0QQyGU3aHUf8K8J5PW'
STRIPE_SECRET = '82H5Cfy1n0Iw2ot4BVblgc8zN8aPl7mh'
# customized settings
PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__))
SITE_ROOT = os.path.dirname(PROJECT_ROOT)
TIME_ZONE = 'America/Los_Angeles'
DATABASES = {
'default': {... | Python | 0 | @@ -47,88 +47,88 @@
'pk_
-dHA9lrZx2If0QQyGU3aHUf8K8J5PW'%0ASTRIPE_SECRET = '82H5Cfy1n0Iw2ot4BVblgc8zN8aPl7mh
+YT1CEhhujd0bklb2KGQZiaL3iTzj3'%0ASTRIPE_SECRET = 'tGN0bIwXnHdwOa85VABjPdSn8nWY7G7I
'%0A%0A#
|
b0b6afff93391bda296ed5ef87d122054f91eef5 | add testdb | dbtest.py | dbtest.py | Python | 0 | @@ -0,0 +1,153 @@
+%0ADB = MySQLDatabase('codatadb',%0A user='heteroskedastic1',%0A host='heteroskedastic1.mysql.pythonanywhere-services.com')
| |
27eb90e40f1f3fe4a17e0228e4de9d427382ac44 | Create calendar_api.py | calendar_api.py | calendar_api.py | Python | 0.00001 | @@ -0,0 +1,2653 @@
+import httplib2%0Aimport os%0A%0Aimport apiclient%0Aimport oauth2client%0Afrom oauth2client import client, tools%0A%0Afrom datetime import datetime, timedelta%0A%0Aalarm_time = datetime.utcnow() + timedelta(minutes = 1)%0A%0Atry:%0A import argparse%0A flags = argparse.ArgumentParser(parents=%5... | |
fc97a838d54417cb063a7757040ff279f298d0bb | Add snip code for http.cookies | cookie_skel.py | cookie_skel.py | Python | 0 | @@ -0,0 +1,934 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Wed Sep 14 20:49:34 2016%0A%0A@author: troon%0A%22%22%22%0A%0Aimport BaseHTTPServer, SimpleHTTPServer%0Afrom http.cookies import SimpleCookie as cookie%0A%0Aclass ApplicationRequestHandler(SimpleHTTPServer.BaseHTTPRequestHandler):%0A %0A sessioncookies... | |
63586b03111d2c2aac3b4ffe5266468d3bd666fd | solve 1 problem | solutions/add-two-numbers.py | solutions/add-two-numbers.py | Python | 0.000027 | @@ -0,0 +1,1486 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0A%0A%22%22%22%0Aadd-two-numbers.py%0A%0ACreated by Shuailong on 2016-04-23.%0A%0Ahttps://leetcode.com/problems/add-two-numbers/.%0A%0A%22%22%22%0A%0A%0A# Definition for singly-linked list.%0Aclass ListNode(object):%0A def __init__(self, x):%0A sel... | |
61750d22d44e4d2caa99703c1fd8d61e1e829e07 | Create test.py | ProjectMidway/Data/test.py | ProjectMidway/Data/test.py | Python | 0.000005 | @@ -0,0 +1 @@
+%0A
| |
0cde44fb3fade24bc0e1aed5ee4820aa2172806a | Add 2nd example. | doc/src/examples/periodogram_2.py | doc/src/examples/periodogram_2.py | Python | 0 | @@ -0,0 +1,569 @@
+import numpy as np%0Aimport matplotlib.pyplot as plt%0Afrom scikits.talkbox.spectral.basic import periodogram%0Afrom scipy.signal import hamming, hanning%0Afs = 1000%0Ax = np.sin(2 * np.pi * 0.15 * fs * np.linspace(0., 0.3, 0.3 * fs))%0Ax += 0.1 * np.random.randn(x.size)%0Apx1, fx1 = periodogram(x, n... | |
08636c9740b3103fd05c81791f43faeb29920305 | Add tests for some util functions. | test/test_utils.py | test/test_utils.py | Python | 0.000537 | @@ -0,0 +1,2613 @@
+# -*- coding: utf-8 -*-%0A# Licensed to the Apache Software Foundation (ASF) under one or more%C2%A7%0A# contributor license agreements. See the NOTICE file distributed with%0A# this work for additional information regarding copyright ownership.%0A# The ASF licenses this file to You under the Apach... | |
0574900ba42deda7ee61a809ffc64abc643b58b1 | add hibernation test | testHibernation.py | testHibernation.py | Python | 0.000001 | @@ -0,0 +1,1284 @@
+from novaclient.v1_1 import Client as NovaClient%0Aimport unittest%0A%0Adef hibernate(username, password, tenant_name, auth_url, serverID):%0A nova = NovaClient(username = username,%0A api_key = password,%0A project_id = tenant_name,%0A auth_url = auth_url)%0A ... | |
7771baf7b4806c15cb85df6c34e344345538df4a | Add background thread example | background-thread.py | background-thread.py | Python | 0 | @@ -0,0 +1,339 @@
+import time%0Aimport requests%0A%0Afrom tomorrow import threads%0A%0A@threads(5)%0Adef download(url):%0A return requests.get(url)%0A%0Aif __name__ == %22__main__%22:%0A start = time.time()%0A responses = %5Bdownload(url) for url in urls%5D%0A html = %5Bresponse.text for response in respon... | |
3bb75969a9fc068a05bf81f096d0e58e3440a09f | Create nltk10.py | nltk10.py | nltk10.py | Python | 0.000002 | @@ -0,0 +1,3119 @@
+import time%0Aimport urllib2%0Afrom urllib2 import urlopen%0Aimport re%0Aimport cookielib%0Afrom cookielib import CookieJar%0Aimport datetime%0Aimport sqlite3%0Aimport nltk%0A%0A%0Acj = CookieJar()%0Aopener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))%0Aopener.addheaders = %5B('User-agent... | |
ea4acac26fbedef3a9a5395860334c9bb95bcacb | add a new class GenericKeyComposerAddressAccess | AlphaTwirl/Counter/GenericKeyComposerAddressAccess.py | AlphaTwirl/Counter/GenericKeyComposerAddressAccess.py | Python | 0 | @@ -0,0 +1,1890 @@
+# Tai Sakuma %3Ctai.sakuma@cern.ch%3E%0A%0A##____________________________________________________________________________%7C%7C%0Aclass GenericKeyComposerAddressAccess(object):%0A def __init__(self, varNames, binnings, indices = None):%0A self._varNames = varNames%0A self._binnings ... | |
57d731d6fb958c165cdeb5a9194669b07f8d54c1 | Create central_tendency.py | central_tendency.py | central_tendency.py | Python | 0.000013 | @@ -0,0 +1,1896 @@
+%0A# computes measures of geo central tendancy from a csv table%0A# table must be set up as 3 columns: x, y, weight%0A%0Aimport csv%0A%0Acsv_path = 'x_y_w.csv'%0A%0A# calculating the mean centre%0Awith open(csv_path, 'rb') as f:%0A reader = csv.reader(f)%0A x_sum = 0%0A y_sum = 0%0A n = ... | |
624eff1e010c7b36f43e2580346b5ae74cc20128 | Create does_my_number_look_big_in_this.py | does_my_number_look_big_in_this.py | does_my_number_look_big_in_this.py | Python | 0.000008 | @@ -0,0 +1,208 @@
+#Kunal Gautam%0A#Codewars : @Kunalpod%0A#Problem name: Does my number look big in this?%0A#Problem level: 6 kyu%0A%0Adef narcissistic( value ):%0A return value==int(sum(%5Bint(x)**len(str(value)) for x in str(value)%5D))%0A
| |
ebde18f5958463d622805b1a09244d07c81ec8ae | Bump development version | cms/__init__.py | cms/__init__.py | # -*- coding: utf-8 -*-
__version__ = '3.0.16'
default_app_config = 'cms.apps.CMSConfig'
| Python | 0 | @@ -41,9 +41,14 @@
.0.1
-6
+7.dev1
'%0A%0Ad
|
9831d82463b556c70d64dc17ceeadb2d54c6141d | add unittest for Kutil. | tests/kutiltest.py | tests/kutiltest.py | Python | 0 | @@ -0,0 +1,1802 @@
+import unittest%0Afrom pypeerassets.kutil import Kutil%0A%0Aclass KutilTestCase(unittest.TestCase):%0A%0A def test_network_parameter_load(self):%0A '''tests if loading of network parameteres is accurate'''%0A%0A mykey = Kutil(network=%22ppc%22)%0A%0A self.assertEqual(mykey.de... | |
6958b09e08662e2a13b1f161cdd22f4f929d56c6 | add sample program | codeiq/yatta.py | codeiq/yatta.py | Python | 0.000001 | @@ -0,0 +1,803 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A%22%22%22 script for generate process template directories%0A%0AThis is xxx%0A%22%22%22%0A%0Afrom __future__ import print_function%0A%0Adef yatta(n):%0A if n %25 2 == 0:%0A print(%22invalid%22)%0A return%0A%0A m = int(n / 2) + 1... | |
04740a33ab8b4d43cda71668ff7027ac7e5982d5 | Add test. This continues to need pytz and tzlocal. | tests/test_cdav.py | tests/test_cdav.py | Python | 0 | @@ -0,0 +1,1352 @@
+import datetime%0A%0Aimport pytz%0Aimport tzlocal%0A%0Afrom caldav.elements.cdav import _to_utc_date_string%0A%0ASOMEWHERE_REMOTE = pytz.timezone('Brazil/DeNoronha') # UTC-2 and no DST%0A%0A%0Adef test_to_utc_date_string_date():%0A input = datetime.date(2019, 5, 14)%0A res = _to_utc_date_stri... | |
7a70d230d3ceb3c37d718f138e80b132b9a05fae | Add migration for multiple repos per team. | edwin/teams/migrations/0005_auto_20150811_2236.py | edwin/teams/migrations/0005_auto_20150811_2236.py | Python | 0 | @@ -0,0 +1,497 @@
+# -*- 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 ('teams', '0004_auto_20150516_0009'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterFiel... | |
432ba7d3f923f6a22aef7bb45c7f658422968aa0 | add python script to plot p/r curve | bin/plot-pr-curve.py | bin/plot-pr-curve.py | Python | 0.000001 | @@ -0,0 +1,1176 @@
+import numpy as np%0Aimport matplotlib.pyplot as plt%0Aimport matplotlib.ticker as ticker%0Aimport matplotlib.colors%0Aimport sys%0A%0A# change font family to match math%0A#plt.rc('font', family='serif')%0A%0Afontsize = 18%0Afont = %7B'family' : 'sans-serif',%0A# 'serif' : 'Times Regular',%0A... | |
2d7782508e6bfe1be88da3409ae67371dab7379d | Add files via upload | openquake/hazardlib/tests/gsim/skarlatoudis_2013_test.py | openquake/hazardlib/tests/gsim/skarlatoudis_2013_test.py | Python | 0.000001 | @@ -0,0 +1,1825 @@
+# -*- coding: utf-8 -*-%0A# vim: tabstop=4 shiftwidth=4 softtabstop=4%0A#%0A# Copyright (C) 2015-2019 GEM Foundation%0A#%0A# OpenQuake is free software: you can redistribute it and/or modify it%0A# under the terms of the GNU Affero General Public License as published%0A# by the Free Software Foundat... | |
f5237b61a50b66d6ac3123318af94db8ec95173b | Test tasks.get_email_addresses handles subentites. | entity_emailer/tests/test_tasks.py | entity_emailer/tests/test_tasks.py | Python | 0 | @@ -0,0 +1,1467 @@
+from entity.models import Entity, EntityRelationship%0Afrom django.contrib.contenttypes.models import ContentType%0Afrom django.test import TestCase%0Afrom django_dynamic_fixture import G, N%0A%0Afrom entity_emailer import tasks%0Afrom entity_emailer.models import Email%0A%0A%0Aclass Test_get_email_... | |
4ec9406a19b5f42b0b05f37c12b99dd91853514f | Add all the data necessary for generations | tests/generator_test.py | tests/generator_test.py | from datetime import date, time, datetime
from google.appengine.ext import testbed, ndb
from gaend.main import app
import unittest
import webtest
# References
# cloud.google.com/appengine/docs/python/ndb/db_to_ndb
# cloud.google.com/appengine/docs/python/ndb/entity-property-reference
# cloud.google.com/appengine/docs/... | Python | 0.000291 | @@ -356,16 +356,122 @@
xpando%0A%0A
+SERIALIZE = %5B%7B'key1': True, 'key2': %5B%5D%7D, %5B1, 2.0, %7B%7D, 'json'%5D%5D%0A%0ACOMPUTED = lambda x: %22COMPUTED_PROPERTY%22%0A%0A
PROPERTI
@@ -475,17 +475,17 @@
RTIES =
-%5B
+%7B
%0A ndb
@@ -500,19 +500,17 @@
Property
-, #
+:
%5Bint%5D,%0A
@@ -530,19 +530,17 @@
... |
64e2946081adc3991a55d9871f69c9d41e42d6bf | Improve offer fixture generator | oscar/test/helpers.py | oscar/test/helpers.py | from decimal import Decimal as D
import random
import datetime
from oscar.core.loading import get_class, get_classes
Basket = get_class('basket.models', 'Basket')
Free = get_class('shipping.methods', 'Free')
Voucher = get_class('voucher.models', 'Voucher')
OrderCreator = get_class('order.utils', 'OrderCreator')
Order... | Python | 0 | @@ -3643,16 +3643,152 @@
e_offer(
+name=%22Dummy offer%22, offer_type=%22Site%22,%0A max_applications=None, range=None, condition=None,%0A benefit=None
):%0A %22
@@ -3834,24 +3834,50 @@
fer%0A %22%22%22%0A
+ if range is None:%0A
range =
@@ -3957,16 +3957,19 @@
... |
4c4891f24c0e5b093d3a9fcb0de86609b01a69c3 | Add migration for replace location with country and city | fellowms/migrations/0053_auto_20160804_1447.py | fellowms/migrations/0053_auto_20160804_1447.py | Python | 0.000172 | @@ -0,0 +1,967 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.5 on 2016-08-04 14:47%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0Aimport django_countries.fields%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('fellowms', '0052_merge'),%0... | |
d6c5e3c40e2106b7ef4ddc800a1c00493d4f469f | Add customized Pool class. | tests/test_pool.py | tests/test_pool.py | Python | 0 | @@ -0,0 +1,1905 @@
+import gevent.pool%0Aimport gevent.queue%0Aimport gevent.event%0Aimport time%0Aimport traceback%0A%0A%0Adef timeit(func):%0A def wrap(*args, **kwargs):%0A begin_time = time.time()%0A try:%0A return func(*args, **kwargs)%0A except:%0A traceback.print_exc(... | |
077e581326e0791e1bf5816baba6c6a6cba17d9d | Test for setting CHOICES_SEPARATOR | survey/tests/test_default_settings.py | survey/tests/test_default_settings.py | Python | 0.000003 | @@ -0,0 +1,602 @@
+from survey.tests import BaseTest%0Afrom django.test import override_settings%0Afrom django.conf import settings%0Afrom django.test import tag%0Afrom survey import set_default_settings%0A%0A%0A@tag(%22set%22)%0A@override_settings()%0Aclass TestDefaultSettings(BaseTest):%0A def test_set_choices_sep... | |
813f42aee6b38031c4993d322e12053c91d10c8a | add failing test to recreate logrotate bug [#461] | tests/test_tail.py | tests/test_tail.py | Python | 0 | @@ -0,0 +1,2000 @@
+import logging%0Aimport subprocess%0Aimport tempfile%0Aimport unittest%0A%0A%0Aclass TestTail(unittest.TestCase):%0A def setUp(self):%0A self.log_file = tempfile.NamedTemporaryFile()%0A self.logrotate_config = tempfile.NamedTemporaryFile()%0A self.logrotate_config.write(%22%2... | |
60774ca1a336fac5c0d9fb92ab6de509cd92dd43 | Add tests for topsort. | tests/test_util.py | tests/test_util.py | Python | 0 | @@ -0,0 +1,706 @@
+import unittest2%0Aimport util%0A%0Aclass TopSortTest(unittest2.TestCase):%0A def test_error(self):%0A a,b = range(2)%0A deps = %5B(a,b), (b,a)%5D%0A with self.assertRaises(ValueError):%0A util.topological_sort(%5B%5D, deps)%0A%0A def test_multi_deps(self):%0A ... | |
13917ab0aba2951bd10b64b53cdd358b169a432f | Create Bender_un_robot_dépressif.py | Medium/Bender_un_robot_dépressif.py | Medium/Bender_un_robot_dépressif.py | Python | 0.000001 | @@ -0,0 +1,2132 @@
+import sys%0Aimport math%0A%0A# Auto-generated code below aims at helping you parse%0A# the standard input according to the problem statement.%0A%0Al, c = %5Bint(i) for i in input().split()%5D%0AMap=%5B%5D%0AT=%5B%5D%0Afor i in range(l):%0A Map.append(input())%0A if %22@%22 in Map%5Bi%5D:%0A ... | |
797eded64257e6a116b5c6f013a80ff62fe9978e | Soln. to largest number at least twice of others | Python/largest_atleast_twice.py | Python/largest_atleast_twice.py | Python | 0.999999 | @@ -0,0 +1,1252 @@
+# https://leetcode.com/problems/largest-number-at-least-twice-of-others/%0A# You are given an integer array nums where the largest integer is unique.%0A# Determine whether the largest element in the array is at least twice as much as every other number in the array.%0A# If it is, return the index of... | |
b4eebd858e07d33a3e7de8f9fda3ae009a0036c2 | Add a node | scripts/buzzer1.py | scripts/buzzer1.py | Python | 0.000043 | @@ -0,0 +1,75 @@
+#!/usr/bin/env python%0Aimport rospy%0Arospy.init_node('buzzer')%0Arospy.spin()%0A%0A
| |
fe226ce33f116480bfea8f258fdffa1fd96e379c | read temp from gotemp | gotemp.py | gotemp.py | Python | 0.000001 | @@ -0,0 +1,338 @@
+#!/usr/bin/python%0Aimport time%0Aimport struct%0A%0Aldusb = file(%22/dev/hidraw1%22)%0A%0Atime.sleep(0.5)%0A%0Apkt = ldusb.read(8)%0Aparsed_pkt = list(struct.unpack(%22%3CBBHHH%22, pkt))%0Anum_samples = parsed_pkt.pop(0)%0Aseqno = parsed_pkt.pop(0)%0Afor sample in range(num_samples):%0A cel = par... | |
9abecda7f3c981b1cde193be038171c63bf69020 | Add root init | otherdave/__init__.py | otherdave/__init__.py | Python | 0.000009 | @@ -0,0 +1,33 @@
+# OtherDave/otherdave/__init__.py
| |
79d550cd96862bc4a4c0db60a2db60d3efa5cd6d | add vcrpy test helper module | tests/vcrhelper.py | tests/vcrhelper.py | Python | 0 | @@ -0,0 +1,1367 @@
+%22%22%22vcrpy integration helpers.%22%22%22%0A%0Aimport os%0Aimport unittest%0A%0Aimport vcr%0A%0A%0ACASSETTE_LIB = os.path.join(%0A os.path.dirname(os.path.realpath(__file__)), 'cassettes')%0Aassert os.path.isdir(CASSETTE_LIB), %22Cassette library not found.%22%0A%0ARECORD_MODE = 'none'%0A%0A%0... | |
30d9dff89a56229ff1f7cf73181cf8fe10f31b6d | Test scanner | tests/test_full_scan.py | tests/test_full_scan.py | Python | 0.000001 | @@ -0,0 +1,192 @@
+import sys%0Aprint sys.path%0Afrom muzicast.collection import CollectionScanner%0A%0Ascanner = CollectionScanner(%5B'/shared/music-test'%5D)%0A%0Aassert type(scanner.directories) is list%0A%0Ascanner.full_scan()%0A
| |
d1b7ed5f705c8e0935778636ade00a7452e2ea7f | Add management command for importing Holvi Invoices and Orders | project/holviapp/management/commands/import_holvidata.py | project/holviapp/management/commands/import_holvidata.py | Python | 0 | @@ -0,0 +1,1706 @@
+# -*- coding: utf-8 -*-%0Aimport datetime%0Aimport itertools%0A%0Aimport dateutil.parser%0Afrom django.core.management.base import BaseCommand, CommandError%0Afrom holviapp.importer import HolviImporter%0Afrom holviapp.utils import list_invoices, list_orders%0A%0A%0Adef yesterday_proxy():%0A now_... | |
cc25e521a99049bb1333c4a36df776c3303dda7b | add test for new functionality | tests/test_generator.py | tests/test_generator.py | Python | 0 | @@ -0,0 +1,597 @@
+from unittest import TestCase%0Aimport rectpack.packer%0Aimport random%0A%0A%0Aclass TestGenerator(TestCase):%0A %0A def setUp(self):%0A self.rectangles = %5B(w, h) for w in range(8,50, 8) for h in range(8,50, 8)%5D%0A%0A def test_factory(self):%0A p = rectpack.packer.newPacker... | |
8ca6dd9d1089b5976d54e06f452a45306dbfb55e | Add generator test | tests/test_generator.py | tests/test_generator.py | Python | 0 | @@ -0,0 +1,521 @@
+import unittest%0Afrom echolalia.generator import Generator%0A%0Aclass GeneratorTestCase(unittest.TestCase):%0A%0A def setUp(self):%0A self.items = %5B'pystr', 'pyint'%5D%0A%0A def test_generate(self):%0A generator = Generator(items=self.items)%0A docs = generator.generate(3)%0A self.as... | |
ad0ed0b60db6b527b0c210d2e1a23d529d36889d | Create test_gutenberg.py | tests/test_gutenberg.py | tests/test_gutenberg.py | Python | 0.000002 | @@ -0,0 +1,223 @@
+%0Aimport pytest%0A%0Afrom dasem.gutenberg import Word2Vec%0A%0A%0A@pytest.fixture%0Adef w2v():%0A return Word2Vec()%0A%0A%0Adef test_w2v(w2v):%0A word_and_similarities = w2v.most_similar('dreng')%0A assert len(word_and_similarities) == 10%0A
| |
6cad13197f7d2e399ef3e91a63a34637814c2ad1 | fix import command | utils/test_mesh.py | utils/test_mesh.py | import unittest
import numpy as np
from finmag.util.oommf import mesh
class TestIterCoordsInt(unittest.TestCase):
def test_zyx_ordering(self):
m = mesh.Mesh((3, 1, 1), cellsize=(1, 1, 1))
indices = [r for r in m.iter_coords_int()]
expected = [[0, 0, 0], [1, 0, 0], [2, 0, 0]]
asser... | Python | 0.00001 | @@ -32,31 +32,8 @@
np%0A
-from finmag.util.oommf
impo
|
2427afc967169f1e9d942bb7d955454b7ad0a44e | add open/close/cancel position example | examples/py/phemex-open-cancel-close-positions.py | examples/py/phemex-open-cancel-close-positions.py | Python | 0.000001 | @@ -0,0 +1,1367 @@
+# -*- coding: utf-8 -*-%0A%0Aimport os%0Aimport sys%0Afrom pprint import pprint%0A%0Aroot = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))%0Asys.path.append(root + '/python')%0A%0Aimport ccxt # noqa: E402%0A%0A%0Aprint('CCXT Version:', ccxt.__version__)%0A%0Aexchange =... | |
ad97be23fe9e267ed9d64b08fdf64631e234d43a | Add wierd migration | projects/migrations/0002_auto_20151208_1553.py | projects/migrations/0002_auto_20151208_1553.py | Python | 0.000001 | @@ -0,0 +1,573 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('projects', '0001_squashed_0010_task'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterF... | |
b5da9dcf973a9a780c729f2855fb3784bfe9328a | Create heatdb.py | heatdb.py | heatdb.py | Python | 0 | @@ -0,0 +1,1492 @@
+import webapp2%0Aimport logging%0Aimport re%0Aimport cgi%0Aimport jinja2%0Aimport os%0Aimport random%0Aimport string%0Aimport hashlib%0Aimport hmac%0Aimport Cookie %0Aimport urllib2%0Aimport time%0Afrom datetime import datetime, timedelta%0Afrom google.appengine.api import memcache%0Afrom google.app... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.