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
0f5716b10afff9ccbc17fb595cd7cc2f85b45f8f
Add name attribute to each Page in ServiceWorkerPageSet
tools/perf/page_sets/service_worker.py
tools/perf/page_sets/service_worker.py
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import page as page from telemetry.page import page_set as page_set archive_data_file_path = 'data/service_worker.json' class Service...
Python
0.000002
@@ -743,32 +743,51 @@ ', self,%0A + name='first_load', make_javascript @@ -805,24 +805,24 @@ tic=False))%0A - # 2st ti @@ -950,32 +950,52 @@ ', self,%0A + name='second_load', make_javascript @@ -1157,23 +1157,42 @@ , self,%0A - + name='third_load', make_ja
b071df5de1316807e955e9ec6b4463ec44203fdf
add libhessian.gyp
libhessian.gyp
libhessian.gyp
Python
0.000097
@@ -0,0 +1,545 @@ +# Copyright (c) 2017 Minqi Pan %3Cpmq2001@gmail.com%3E%0A# %0A# This file is part of libhessian, distributed under the MIT License%0A# For full terms see the included LICENSE file%0A%0A%7B%0A 'targets': %5B%0A %7B%0A 'target_name': 'libhessian',%0A 'type': 'static_library',%0A 'sou...
41d0716d9e8fc16df2c67bd0ec12be706d41c678
add an examples folder, has waterfall to start
examples/waterfall_plot.py
examples/waterfall_plot.py
Python
0
@@ -0,0 +1,2085 @@ +from abf_reader import *%0Aimport matplotlib.pyplot as plt%0Afrom abf_epoch import epoch, waterfall%0Aimport matplotlib.gridspec as gridspec%0Afrom scale_bars import *%0A%0Aif __name__=='__main__':%0A import os%0A labdir = os.environ.get(%22LABDIR%22)%0A %0A # change some legend plot stu...
b2a0247746756cc86074754bc993a757d6702b12
Add coin flip simulator (hw02)
hw02/exercise-02-01.py
hw02/exercise-02-01.py
Python
0
@@ -0,0 +1,1856 @@ +'''%0AFor Homework 02, Exercieses 01-02. EdX Learning From Data course.%0AJonathan Miller%0A'''%0A%0Aimport random%0A%0A# FUNCTIONS ###########################%0A%0Adef runTrial(numCoins, numFlips):%0A%0A def flipCoin():%0A if random.random() %3E 0.5:%0A return head%0A el...
c67dc16e73eea093befaa03790bd8d6f1b452c9a
Add simple test for FormDesignerPlugin
form_designer/tests/test_cms_plugin.py
form_designer/tests/test_cms_plugin.py
Python
0
@@ -0,0 +1,1185 @@ +import pytest%0Afrom cms import api%0Afrom cms.page_rendering import render_page%0Afrom django.contrib.auth.models import AnonymousUser%0Afrom django.utils.crypto import get_random_string%0A%0Afrom form_designer.contrib.cms_plugins.form_designer_form.cms_plugins import FormDesignerPlugin%0Afrom form...
a7220b46393bac832c9a922afaa125f0512bf53e
add handmappedtrack migration
trackmap/migrations/0003_handmappedtrack.py
trackmap/migrations/0003_handmappedtrack.py
Python
0
@@ -0,0 +1,932 @@ +# -*- 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 ('rphistory', '0001_initial'),%0A ('trackmap', '0002_trackavailability_score'),%0A %5D%0A%0A ...
f908dd5fda528b4ce6ebaed082050348bf6f23a5
Test the console scripts entry point
i8c/tests/test_entry_point.py
i8c/tests/test_entry_point.py
Python
0.000001
@@ -0,0 +1,724 @@ +from i8c.tests import TestCase%0Aimport i8c%0Aimport sys%0A%0Aclass TestEntryPoint(TestCase):%0A %22%22%22Test the console scripts entry point.%22%22%22%0A%0A def setUp(self):%0A self.saved_argv = sys.argv%0A self.saved_stderr = sys.stderr%0A%0A def tearDown(self):%0A sy...
f7b875bb3d4b313e9c1e22297918d33e67633104
Add test trek_dtail_pdf language none
geotrek/altimetry/tests/test_models.py
geotrek/altimetry/tests/test_models.py
Python
0.000031
@@ -0,0 +1,631 @@ +import os%0A%0Afrom django.test import TestCase%0Afrom django.conf import settings%0A%0Afrom geotrek.trekking.factories import TrekFactory%0Afrom geotrek.trekking.models import Trek%0A%0A%0Aclass AltimetryMixinTest(TestCase):%0A def test_get_elevation_chart_none(self):%0A trek = TrekFactory...
ce275a82f82dfb719292b619be7a2a76b7c528ef
Remove print statement.
python/helpers/pydev/pydevd_breakpoints.py
python/helpers/pydev/pydevd_breakpoints.py
from pydevd_constants import * import sys import pydev_log _original_excepthook = None _handle_exceptions = None NOTIFY_ALWAYS="NOTIFY_ALWAYS" NOTIFY_ON_TERMINATE="NOTIFY_ON_TERMINATE" import threading threadingCurrentThread = threading.currentThread from pydevd_comm import GetGlobalDebugger class ExceptionBreakp...
Python
0.000046
@@ -2176,35 +2176,8 @@ pe)%0A - print (%22Name %25s%22%25name)%0A
cea956d06e63e2f4c63a35e72a3eaf4861394671
Create RotateArray.py
RotateArray.py
RotateArray.py
Python
0.000002
@@ -0,0 +1,1414 @@ +%22%22%22%0ARotate Array%0ARotate an array of n elements to the right by k steps.%0AFor example, with n = 7 and k = 3, the array %5B1,2,3,4,5,6,7%5D is rotated to %5B5,6,7,1,2,3,4%5D.%0ANote:%0ATry to come up as many solutions as you can, there are at least 3 different ways to solve this problem. %0...
b3dc26a391fac6de26140c0ff6590a85820a8091
Update hyperparameters for sklearn model
examples/gdb7/gdb7_sklearn.py
examples/gdb7/gdb7_sklearn.py
""" Script that trains Sklearn singletask models on GDB7 dataset. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import os import deepchem as dc import numpy as np import shutil from sklearn.kernel_ridge import KernelRidge np.random.seed(123) base_di...
Python
0
@@ -1218,16 +1218,109 @@ ataset)%5D +%0A#transformers = %5Bdc.trans.NormalizationTransformer(transform_y=True, dataset=train_dataset)%5D %0A%0Afor tr @@ -1678,19 +1678,17 @@ lpha=0.0 -001 +5 , gamma= @@ -1693,11 +1693,8 @@ a=0. -000 1)%0A
8a0d40f9874119084f5f7a1471cb565bb85d6938
Add match to wd script.
match_to_wd.py
match_to_wd.py
Python
0
@@ -0,0 +1,1202 @@ +import csv%0Aimport pickle%0Aimport sys%0A%0A%0Adef load_index():%0A with open('data/wd_issn.pkl') as inf:%0A data = pickle.load(inf)%0A return data%0A%0Awd_idx = load_index()%0A%0Adef match(issn, eissn):%0A for isn in %5Bissn, eissn%5D:%0A if issn != %22%22:%0A wd ...
b6d829177391f59d32614c54670fa993b93a64ee
add simple menu for first iteration of program
menu_simple.py
menu_simple.py
Python
0
@@ -0,0 +1,428 @@ +#!/usr/bin/env%0A%0A%0Adef menu():%0A %22%22%22Menu prompt for user to select program option%22%22%22%0A while True:%0A print '1. Overwrite all sectors with zeros (Faster, less secure).'%0A print '2. Overwrite all sectors with random data (Slower, more secure).'%0A print '3...
c1a73d250ab5f6c55e97664f682a0de17479d6a8
Add link to component
homeassistant/components/sensor/zwave.py
homeassistant/components/sensor/zwave.py
""" homeassistant.components.sensor.zwave ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Interfaces with Z-Wave sensors. """ # pylint: disable=import-error from openzwave.network import ZWaveNetwork from pydispatch import dispatcher import homeassistant.components.zwave as zwave from homeassistant.helpers.entity import Entity ...
Python
0
@@ -104,16 +104,146 @@ sensors. +%0A%0AFor more details about the zwave component, please refer to the documentation%0Aat https://home-assistant.io/components/zwave.html %0A%22%22%22%0A# p
7716818beb0dba581cd3536e321676d756e282d9
Remove the lms_comerce_api_url field from partners object
course_discovery/apps/core/migrations/0011_remove_partner_lms_commerce_api_url.py
course_discovery/apps/core/migrations/0011_remove_partner_lms_commerce_api_url.py
Python
0
@@ -0,0 +1,418 @@ +# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.15 on 2019-04-12 17:31%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('core', '0010_partner_lms_coursemode_api_url'),%0A %5D%0...
bb1aafd72899d35bfcad5a84373281f732ad01ab
Add integration test for minerva-dump script
integration_tests/test_minerva_dump.py
integration_tests/test_minerva_dump.py
Python
0
@@ -0,0 +1,2192 @@ +from contextlib import closing%0Aimport subprocess%0Aimport unittest%0A%0Afrom nose.tools import eq_%0A%0Afrom minerva.test import connect%0A%0A%0Aclass MinervaDump(unittest.TestCase):%0A %22%22%22%0A Use standard Python unittest TestCase here because of the assertMultiLineEqual%0A function...
186b231b7149b52dc95837aabd5f44b1c02c8e41
Add PyQtGraph random walk without datetime
samples/sample_pyqtgraph_no_datetime.py
samples/sample_pyqtgraph_no_datetime.py
Python
0
@@ -0,0 +1,2039 @@ +#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22%0AThis example demonstrates a random walk with pyqtgraph.%0A%22%22%22%0A%0Aimport sys%0Aimport numpy as np%0Aimport pyqtgraph as pg%0Afrom pyqtgraph.Qt import QtGui, QtCore%0Afrom numpy_buffer import RingBuffer # https://github.com/scls19f...
fc5714951bac61f17509eacf8ec2413e14a79ddc
Add a snomask for OPER attempts
txircd/modules/core/sno_oper.py
txircd/modules/core/sno_oper.py
Python
0
@@ -0,0 +1,917 @@ +from twisted.plugin import IPlugin%0Afrom txircd.module_interface import IModuleData, ModuleData%0Afrom zope.interface import implements%0A%0Aclass SnoOper(ModuleData):%0A implements(IPlugin, IModuleData)%0A%0A name = %22ServerNoticeOper%22%0A core = True%0A%0A def hookIRCd(self, ircd):%0...
e02a633ef268a58a0054c0f9ab1a03dacdb3919f
Add preferences converter
plugins/VersionUpgrade/VersionUpgrade21to22/Preferences.py
plugins/VersionUpgrade/VersionUpgrade21to22/Preferences.py
Python
0
@@ -0,0 +1,3091 @@ +# Copyright (c) 2016 Ultimaker B.V.%0A# Cura is released under the terms of the AGPLv3 or higher.%0A%0Aimport configparser #To read config files.%0Aimport io #To output config files to string.%0A%0Aimport UM.VersionUpgrade #To indicate that a file is of the wrong format.%0A%0A## Creates a new prefe...
347bc0e601edb3bcc61f54b7065b712f35c65ba7
fix upload for leonardo
ino/commands/upload.py
ino/commands/upload.py
# -*- coding: utf-8; -*- from __future__ import absolute_import import os.path import subprocess import platform from time import sleep from serial import Serial from serial.serialutil import SerialException from ino.commands.base import Command from ino.exc import Abort class Upload(Command): """ Upload ...
Python
0
@@ -2449,16 +2449,1758 @@ TR(True) +%0A s.close()%0A%0A # need to do a little dance for Leonardo and derivatives:%0A # open then close the port at the magic baudrate (usually 1200 bps) first%0A # to signal to the sketch that it should reset into bootloader. after doing%0A # this wait...
5dde2f07399e09fd9e15467b5df78447ae6b2404
Create add.py
add2numbers/add.py
add2numbers/add.py
Python
0.000001
@@ -0,0 +1,248 @@ +# Python Program - Add Two Numbers%0Awhile True:%0A%09print(%22Enter '0' for exit.%22)%0A%09print(%22Enter two numbers: %22)%0A%09val1 = int(input())%0A%09val2 = int(input())%0A%09if val1 == 0:%0A%09%09break%0A%09else:%0A%09%09sum = val1 + val2%0A%09%09print(%22Sum of the given two number:%22,sum,%22...
af43e5009e6f21e75ee7244d13a2a80e88bf5288
add add_grid_config.py
add_grid_config.py
add_grid_config.py
Python
0.000004
@@ -0,0 +1,401 @@ +from gcloud import datastore%0A%0Akey = datastore.Key(%22GridConfig%22)%0Ac = datastore.Entity(key)%0Ac.update(%7B%0A %22num_server_instances%22: 3,%0A %22server_instance_types%22: %5B%22n1-standard-1%22%5D*3,%0A %22num_servers%22: 6,%0A %22server_versions%22: %5B%221.10.0%22%5D*6,%0A ...
9df2c8ad6208d89fc1865b36a94115731492f902
test code for resize_to_yolo
tests/converts/test_format_image_size.py
tests/converts/test_format_image_size.py
Python
0.000002
@@ -0,0 +1,534 @@ +import unittest%0Afrom clib.converts import resize_to_yolo%0Afrom skimage import data%0A%0A%0Aclass ResizeYoloTest(unittest.TestCase):%0A def setUp(self):%0A self.grayimg = data.coins()%0A self.rgbimg = data.astronaut()%0A%0A def test_resize_to_yolo(self):%0A self.assertEqu...
8f3c5dc924b0a8ad35d99d66eb809a51b49fc178
Add a management command to rename a stream.
zerver/management/commands/rename-stream.py
zerver/management/commands/rename-stream.py
Python
0.000001
@@ -0,0 +1,748 @@ +from __future__ import absolute_import%0A%0Afrom django.core.management.base import BaseCommand%0A%0Afrom zerver.lib.actions import do_rename_stream%0Afrom zerver.models import Realm, get_realm%0A%0Aclass Command(BaseCommand):%0A help = %22%22%22Change the stream name for a realm.%0A%0AUsage: pyth...
9f3b3f068bfb53b00a2ec8420816c6deb02729e3
Add a configuration to fetch "ios_internal" project.
fetch_configs/ios_internal.py
fetch_configs/ios_internal.py
Python
0.998331
@@ -0,0 +1,1291 @@ +# Copyright 2016 The Chromium Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0Aimport sys%0A%0Aimport config_util # pylint: disable=F0401%0A%0A%0A# This class doesn't need an __init__ method, so we disable t...
583155db6a85808c69fa25ba4959ebd370aa2fba
Add script to check if modules up
etc/config/check_modules.py
etc/config/check_modules.py
Python
0
@@ -0,0 +1,339 @@ +from subprocess import call%0Aimport os%0A%0Amodules = %5B%0A 'backend.unichat.eu',%0A 'realtime.unichat.eu',%0A 'presence.unichat.eu',%0A 'matchmaker.unichat.eu',%0A%5D%0A%0Afor m in modules:%0A with open(os.devnull, 'w') as devnull:%0A call(%0A %5B'curl', '-m', '1',...
c641456dc339169eb7bb4fb6ddc6e5e14cfba80e
add ROACH monitor
scripts/mc_monitor_roach_temps.py
scripts/mc_monitor_roach_temps.py
Python
0.000001
@@ -0,0 +1,1658 @@ +#! /usr/bin/env python%0A# -*- mode: python; coding: utf-8 -*-%0A# Copyright 2017 the HERA Collaboration%0A# Licensed under the 2-clause BSD license.%0A%0A%22%22%22Gather temperatures from the correlator ROACH devices and log them into M&C%0A%0AThe temperatures cycle out of the Redis store every min...
fbf6542af6001e385612d0e2e98dbae357a52e77
use setuptools to dynamic load freeze pyzmq egg
zmq/__init__.py
zmq/__init__.py
"""Python bindings for 0MQ.""" #----------------------------------------------------------------------------- # Copyright (C) 2010-2012 Brian Granger, Min Ragan-Kelley # # This file is part of pyzmq # # Distributed under the terms of the New BSD License. The full license is in # the file COPYING.BSD, distributed ...
Python
0
@@ -1113,16 +1113,51 @@ = None%0A + ext_type = 0%0A ext_path = ''%0A try: @@ -1198,23 +1198,8 @@ -ext = next(ext for @@ -1206,16 +1206,19 @@ ext, _, +ext _type in @@ -1236,20 +1236,36 @@ ffixes() +:%0A if +ext _type == @@ -1266,17 +1266,17 @@ ype == 3 -) +: %0A @@ -1280...
50db2fa37aab219c9273cf3f76269de11e2dc86b
Add a migration to allow Auditor role to see mappings defined in the Audit context.
src/ggrc_basic_permissions/migrations/versions/20131204014446_54b6efd65a93_add_mappings_to_audi.py
src/ggrc_basic_permissions/migrations/versions/20131204014446_54b6efd65a93_add_mappings_to_audi.py
Python
0
@@ -0,0 +1,1443 @@ +%0A%22%22%22Add mappings to Auditor role%0A%0ARevision ID: 54b6efd65a93%0ARevises: 13b49798db19%0ACreate Date: 2013-12-04 01:44:46.023974%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '54b6efd65a93'%0Adown_revision = '13b49798db19'%0A%0Aimport sqlalchemy as sa%0Afrom alem...
17ae440f509ada010ee3e3b84f0a2c50b196ff82
Add test for pickle
thinc/tests/integration/test_pickle.py
thinc/tests/integration/test_pickle.py
Python
0.000001
@@ -0,0 +1,554 @@ +from __future__ import unicode_literals%0Aimport pytest%0Aimport pickle%0A%0Afrom ...api import with_flatten%0Afrom ...v2v import Affine%0A%0A@pytest.fixture%0Adef affine():%0A return Affine(5, 3)%0A%0Adef test_pickle_with_flatten(affine):%0A Xs = %5Baffine.ops.allocate((2, 3)),%0A aff...
e04220b72a5d8ca3cd7909bcfbcf5d03db18486d
add in additional symposion apps
symposion_project/settings.py
symposion_project/settings.py
# -*- coding: utf-8 -*- # Django settings for account project import os.path import posixpath PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__)) DEBUG = True TEMPLATE_DEBUG = DEBUG # tells Pinax to serve media through the stat...
Python
0
@@ -5073,24 +5073,75 @@ ion.teams%22,%0A + %22symposion.reviews%22,%0A %22symposion.schedule%22,%0A %0A # p
6be2917b4f46c55eefcbfe57bdc517f9316fe897
Add the generated version file
jupyterlab/_version.py
jupyterlab/_version.py
Python
0.000001
@@ -0,0 +1,66 @@ +# This file is auto-generated, do not edit!%0A__version__ = %220.7.0%22%0A
c74ce3d4561a7367903863aaabe1af113d43aa0c
Add base model obect to project.
mgnemu/models/BaseModel.py
mgnemu/models/BaseModel.py
Python
0
@@ -0,0 +1,356 @@ +# -*- coding: utf-8 -*-%0A%0A%22%22%22%0ABase model of project.%0AContains to basic methods:%0A dumps(object_data) - writes object into json.%0A loads(json_data) - converts json into model object.%0A%0A%22%22%22%0A%0Aimport json%0A%0A%0Aclass BaseModel():%0A%0A def dumps(object_data):%0A ...
4bbdf36d7f001d9dc7f6e451bd733698895646b6
Create carpenter.py
carpenter.py
carpenter.py
Python
0.000001
@@ -0,0 +1,1179 @@ +# -*- coding: cp1252 -*-%0Aprint(%22Welcome to Harry Harrison's Carpentization IV: Beyond the Window%5Cn'Build a Window to Stand the Test of Time'%22)%0Araw_input(%22Press enter to start the program%22)%0ApriceOfWood = int( input(%22How expensive is the wood per metre? (in pounds): %22) * 100)%0Awin...
4f105f48b20e70415ede60c19cd7d6cdea07fc28
Add tests for monitors
test/util/monitors_test.py
test/util/monitors_test.py
Python
0
@@ -0,0 +1,1897 @@ +# Copyright 2016 Google Inc. All Rights Reserved.%0A%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A%0A# http://www.apache.org/licenses/LICENSE-2.0%0A%0A# U...
ffb69023f1399d345a4d389f6864bd25c9285c18
add if_for_while.py
src/python27/basic/if_for_while.py
src/python27/basic/if_for_while.py
Python
0.000113
@@ -0,0 +1,763 @@ +# -*- coding: utf-8 -*-%0Aage = 20%0Aif age %3E= 18:%0A print 'your age is', age%0A print 'adult'%0Aelse:%0A print 'your age is', age%0A print 'teenager'%0A%0Aage = 3%0Aif age %3E= 18:%0A print 'adult'%0Aelif age %3E= 6:%0A print 'teenage'%0Aelse:%0A print 'kid'%0A%0Aif 'non null...
cead4c6e8508f1504c57e3dfdc919ee88ee4cbbb
mark unuploaded
selfdrive/loggerd/tools/mark_unuploaded.py
selfdrive/loggerd/tools/mark_unuploaded.py
Python
0.000004
@@ -0,0 +1,218 @@ +#!/usr/bin/env python3%0Aimport sys%0Afrom common.xattr import removexattr%0Afrom selfdrive.loggerd.uploader import UPLOAD_ATTR_NAME%0A%0Afor fn in sys.argv%5B1:%5D:%0A print(%22unmarking %25s%22 %25 fn)%0A removexattr(fn, UPLOAD_ATTR_NAME)%0A%0A
9d667d2d194a9bb7a3c166e47b2c32cf33c7b19c
add code samples for recipe 1.19
code/ch_1-DATA_STRUCTURES_AND_ALGORITHMS/19-transforming_and_reducing_data_at_the_same_time/main.py
code/ch_1-DATA_STRUCTURES_AND_ALGORITHMS/19-transforming_and_reducing_data_at_the_same_time/main.py
Python
0
@@ -0,0 +1,1045 @@ +def example_1():%0A nums = %5B1, 2, 3, 4, 5%5D%0A s = sum(x * x for x in nums)%0A print(s)%0A%0A%0Adef example_2():%0A import os%0A files = os.listdir('./')%0A if any(name.endswith('.py') for name in files):%0A print('Ther be python!')%0A else:%0A print('Sorry, no ...
d5c96dbd94119d10bd8fcf506ba389d56b5e0fca
Add new package py-libensemble (#6525)
var/spack/repos/builtin/packages/py-libensemble/package.py
var/spack/repos/builtin/packages/py-libensemble/package.py
Python
0
@@ -0,0 +1,2029 @@ +##############################################################################%0A# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r...
17fe9d01b6771888a44d6a039b337a84c32e64e8
Add test case for interval_sum
tests/test_common_utils.py
tests/test_common_utils.py
Python
0
@@ -0,0 +1,850 @@ +from bart.common import Utils%0Aimport unittest%0Aimport pandas as pd%0A%0A%0Aclass TestCommonUtils(unittest.TestCase):%0A%0A def __init__(self, *args, **kwargs):%0A super(TestCommonUtils, self).__init__(*args, **kwargs)%0A%0A def test_interval_sum(self):%0A %22%22%22Test Utils Fu...
5ac6848633d9eb373cf44aed77645449a5a926cf
Create session class
session.py
session.py
Python
0
@@ -0,0 +1,1033 @@ +import hashlib%0Aimport binascii%0Aimport json%0Aimport os%0Afrom os import path, environ%0A%0Aclass Session:%0A%0A def __init__(self, directory):%0A self.directory = directory%0A self.options = %7B%7D%0A h = hashlib.new(%22SHA1%22)%0A h.update(self.directory)%0A ...
91347ba6d18706cb791ea3d9063392671c9f653f
add tests for load utils
tests/load/test_load_utils.py
tests/load/test_load_utils.py
Python
0
@@ -0,0 +1,578 @@ +# -*- coding: utf-8 -*-%0Afrom chanjo.load.utils import exon, _exon_kwargs%0A%0A%0ADATA = %7B'chrom': 'chr1', 'chromStart': 100, 'chromEnd': 220, 'name': 'exon1',%0A 'score': 0, 'strand': '+', 'sampleName': 'sample1', 'readCount': 10,%0A 'meanCoverage': 6.341, 'thresholds': %7B10: 95.42...
8b0a2abaf9c942f2fd49827e898700de54fdb8af
Add failing 2.6 test
tests/logging_handler_test.py
tests/logging_handler_test.py
Python
0.000268
@@ -0,0 +1,958 @@ +import __builtin__%0Aimport mock%0Aimport pytest%0A%0Afrom pre_commit import color%0Afrom pre_commit.logging_handler import LoggingHandler%0A%0A%0A@pytest.yield_fixture%0Adef print_mock():%0A with mock.patch.object(__builtin__, 'print', autospec=True) as print_mock:%0A yield print_mock%0A%0...
5c282b901986e689c68f0a43dbf2cf37b977d1b7
fix tests
tests/test_user_statistics.py
tests/test_user_statistics.py
from quora import User expected_user_stat_keys = ['answers', 'edits', 'followers', 'following', 'questions', 'name', 'username' ...
Python
0.000001
@@ -523,24 +523,26 @@ stats())%0A + # test_stats.
a26a133d9d4b32668ae04b0121fd8f38dffd920a
use the lazy version of gettext for translating models
avatar/models.py
avatar/models.py
import binascii import datetime import os import hashlib from PIL import Image from django.db import models from django.core.files import File from django.core.files.base import ContentFile from django.core.files.storage import get_storage_class from django.utils.module_loading import import_string from django.utils.t...
Python
0
@@ -339,16 +339,21 @@ ugettext +_lazy as _%0Afr
1f0e023e972954a2f654705f2c7b596fc56e90b8
Add missing __init__.py file for proper PyPi inclusion of task.
starthinker/task/drive/__init__.py
starthinker/task/drive/__init__.py
Python
0.999963
@@ -0,0 +1,741 @@ +###########################################################################%0A#%0A# Copyright 2020 Google LLC%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License a...
6e083bce7328dba9e84f16e9c12e0e129658176a
Create config618.py
config618.py
config618.py
Python
0.000001
@@ -0,0 +1,146 @@ +provider %22aws%22 %7B%0A access_key = %22AKIAIDPZGSRRD6Q6XFLA%22%0A secret_key = %22iLKy9DdmZ1vymeIkEynkoQ4nuQUkT/OthHXQ7vEP%22%0A region = %22$%7Bvar.region%7D%22%0A%7D%0A
689083a97625dd99633c3116565cdb498d63abd2
Add functions to crosswalk file to select checkboxes
crosswalk.py
crosswalk.py
Python
0
@@ -0,0 +1,2369 @@ +#!/usr/bin/python%0A%0Afrom sys import argv%0Afrom selenium import webdriver%0Afrom bs4 import BeautifulSoup%0Aimport requests, time, time%0A%0Aclass Crosswalk(object):%0A def getEmail(self):%0A # Select email address to use%0A email = raw_input(%22Enter email address: %22)%0A return email...
2acaec94042d1a7db93d0ccc0ed06672174f73fc
add tf dataset examples
tensorflow_learning/tf2/dataset.py
tensorflow_learning/tf2/dataset.py
Python
0.000088
@@ -0,0 +1,463 @@ +# -*- coding: utf-8 -*-%0D%0A'''%0D%0A @author: jeffzhengye%0D%0A @contact: yezheng@scuec.edu.cn%0D%0A @file: dataset.py%0D%0A @time: 2021/1/7 14:20%0D%0A @desc:%0D%0A '''%0D%0A%0D%0Aimport tensorflow as tf%0D%0A%0D%0Adef test_cache_dataset():%0D%0A def map_fun(x):%0D%0A print(x, type(...
e6a3e2ac8267ae3a0f361138bd8cb25f82b12b9d
Create a tool-info module for AVR
benchexec/tools/avr.py
benchexec/tools/avr.py
Python
0.000001
@@ -0,0 +1,1200 @@ +# This file is part of BenchExec, a framework for reliable benchmarking:%0A# https://github.com/sosy-lab/benchexec%0A#%0A# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer %3Chttps://www.sosy-lab.org%3E%0A#%0A# SPDX-License-Identifier: Apache-2.0%0A%0Aimport benchexec.result as result%0Aimport benchexec...
e2994c09ecf0e5b18ad587cb656ce014e009d99f
fix library name on macos
tensorflow/python/platform/sysconfig.py
tensorflow/python/platform/sysconfig.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Python
0.000001
@@ -855,16 +855,45 @@ _os_path +%0Aimport platform as _platform %0A%0Afrom t @@ -2397,32 +2397,105 @@ nk flags.%0A %22%22%22%0A + is_mac = _platform.system() == 'Darwin'%0A ver = _VERSION.split('.')%5B0%5D%0A flags = %5B%5D%0A i @@ -2556,16 +2556,33 @@ _lib())%0A + if is_mac:%0A flag @@ -2622,39 +2...
61ee58ae699c83574538ffedc4b4965acdb27f0c
Add basic Markov Chain generator.
Markov.py
Markov.py
Python
0
@@ -0,0 +1,696 @@ +from collections import deque, defaultdict%0Afrom random import choice%0A%0Aclass SequenceGenerator:%0A def __init__(self, order):%0A self.order = order%0A self.table = defaultdict(list)%0A%0A def addSample(self, sequence):%0A st = deque(%5BNone%5D * self.order, self.order)%0A len = 0%0...
ed28fc4a33001416857c924e041c9265eb858644
Should review, not my answer
maxProfit.py
maxProfit.py
Python
0.999812
@@ -0,0 +1,336 @@ +class Solution:%0A # @param prices, a list of integer%0A # @return an integer%0A def maxProfit(self, prices):%0A result = 0%0A if not prices: return result%0A lowest = prices%5B0%5D%0A for each in prices%5B1:%5D:%0A result = max(result, each - lowest)%0...
3df411232c6dda6692118bc4348099778c4b681a
Create db.py
cloud/db/db.py
cloud/db/db.py
Python
0.000002
@@ -0,0 +1,932 @@ +#!/usr/bin/env python%0Aimport pymysql #Python3%0A %0Adb = pymysql.connect(%22localhost%22,%22sips%22,%22root%22,%22zaijian%22 )%0Acursor = db.cursor()%0Acursor.execute(%22SELECT VERSION()%22)%0Adata = cursor.fetchone()%0A %0Aprint (%22Database version : %25s %22 %25 data)%0Adb.close()%0A%0Adef crea...
b373eaab5918488292075c962f4374dc8815c395
Add script to generate partition ids.
test/integration/generate_partitions.py
test/integration/generate_partitions.py
Python
0
@@ -0,0 +1,707 @@ +import sys%0Aimport random%0A%0Aif len(sys.argv) != 3:%0A print %3E%3E sys.stderr, %22USAGE: python generate_partitions.py nodes partitions_per_node%22%0A sys.exit()%0A%0AFORMAT_WIDTH = 10%0A%0Anodes = int(sys.argv%5B1%5D)%0Apartitions = int(sys.argv%5B2%5D)%0A%0Aids = range(nodes * partitions)...
28897fa74e1883388712704233e85ab60fe4d823
Create Paddle.py
Paddle.py
Paddle.py
Python
0.000001
@@ -0,0 +1,624 @@ +import pygame%0A%0Aclass Paddle(pygame.sprite.Sprite):%0A def __init__(self, window):%0A pygame.sprite.Sprite.__init__(self)%0A self.limitLeft = 20%0A self.limitRight = window.get_width() - self.limitLeft%0A self.width = 75%0A self.height = 25%0A self.colo...
759dbe3f6b601be7d5560b610b6b429fdca4d8b8
add gevent echo
net/python/gevent/simple/echo/echo.py
net/python/gevent/simple/echo/echo.py
Python
0.000001
@@ -0,0 +1,537 @@ +import socket%0Aimport gevent%0A%0AHOST = 'localhost'%0APORT = 50009%0A%0A%0Adef handleReq(conn, addr):%0A print 'handleReq'%0A while 1:%0A data = conn.recv(1024)%0A if not data:%0A break%0A conn.sendall(data)%0A conn.close()%0A%0A%0Adef createSvr():%0A soc...
11b6764eb4acef700e81a07ba7d68327374c8f20
Test inactive_users job.
test/test_jobs/test_engage_old_users.py
test/test_jobs/test_engage_old_users.py
Python
0
@@ -0,0 +1,1828 @@ +# -*- coding: utf8 -*-%0A# This file is part of PyBossa.%0A#%0A# Copyright (C) 2014 SF Isle of Man Limited%0A#%0A# PyBossa is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as published by%0A# the Free Software Foundation, either ...
6d1ebdf2bc3eddee8a69783390f6d3f3c809f325
named tuple
nametuple.py
nametuple.py
Python
0.999904
@@ -0,0 +1,190 @@ +from collections import namedtuple%0A%0AXTYPE = namedtuple('XTYPE',%5B'name','age'%5D)%0A%0Ax1 = XTYPE('wong',30)%0A%0Aprint x1.name%0Aprint x1.age%0Aprint len(x1)%0Ax1=x1._replace(age=31)%0Aprint x1%5B0%5D%0Aprint x1%5B1%5D
5caf67f27d82689babf5dcf0a234dfe3c261ff9c
Implement a framework for data retention policies
zephyr/retention_policy.py
zephyr/retention_policy.py
Python
0.000003
@@ -0,0 +1,2510 @@ +%22%22%22%0AImplements the per-domain data retention policy.%0A%0AThe goal is to have a single place where the policy is defined. This is%0Acomplicated by needing to apply this policy both to the database and to log%0Afiles. Additionally, we want to use an efficient query for the database,%0Arathe...
b1bc68413efcf757dc6430f33820d5ff27e22269
Enhance testing for macro support
numba/cuda/tests/cudapy/test_macro.py
numba/cuda/tests/cudapy/test_macro.py
Python
0
@@ -0,0 +1,2439 @@ +from __future__ import print_function, division, absolute_import%0Aimport numpy as np%0Afrom timeit import default_timer as time%0Afrom numba import cuda, float32%0Afrom numba.cuda.testing import unittest%0A%0AGLOBAL_CONSTANT = 5%0AGLOBAL_CONSTANT_2 = 6%0AGLOBAL_CONSTANT_TUPLE = 5, 6%0A%0A%0Adef udt...
5ff659676f7c1164aeadba0ce7f7f41824bad5fd
update : minor changes
ptop/plugins/cpu_sensor.py
ptop/plugins/cpu_sensor.py
Python
0.000001
@@ -0,0 +1,1060 @@ +'''%0A CPU sensor plugin%0A%0A Generates the CPU usage stats%0A'''%0Afrom ptop.core import Plugin%0Aimport psutil%0A%0Aclass CPUSensor(Plugin):%0A def __init__(self,**kwargs):%0A super(CPUSensor,self).__init__(**kwargs)%0A%0A # overriding the update method%0A def update(self):%...
c7557de36799bfbe8318e05e370cee0ad09262e4
Add connection handler
devicehive/connection_handler.py
devicehive/connection_handler.py
Python
0.000001
@@ -0,0 +1,844 @@ +from devicehive.handlers.base_handler import BaseHandler%0Afrom devicehive.api import Token%0A%0A%0Aclass ConnectionHandler(BaseHandler):%0A %22%22%22Connection handler class.%22%22%22%0A%0A def __init__(self, transport, handler_class, handler_options,%0A authentication):%0A ...
c405f4afe48a6dfa0fa592c2b1a2ab6a621377ec
Add sample_crop()
nn/random.py
nn/random.py
Python
0
@@ -0,0 +1,139 @@ +import tensorflow as tf%0A%0Afrom .util import static_shape%0A%0A%0A%0Adef sample_crop(xs, n):%0A return tf.random_crop(xs, %5Bn, *static_shape(xs)%5B1:%5D%5D)%0A
27a7bf62ee2ef7b42a659261f36890eb922c9747
Create ex_read_log.py
Module_2/Lesson_1/ex_read_log.py
Module_2/Lesson_1/ex_read_log.py
Python
0.000002
@@ -0,0 +1,255 @@ +#!/usr/bin/env python%0A%0A# ex_read_log.py by mariuszha%0A#%0A# Purpose:%0A# Find all the logs in the /var/log/syslog which pertain to CMD%0A# and print them out selectively %0A#%0A%0A%0Awith open(%22/var/log/syslog%22) as f:%0A%09for line in f:%0A%09%09if %22CMD%22 in line:%0A%09%09%09print line%0A...
8953b336dfcb8bd6c69b2af8e960a215a47838f8
Add reverse a list of characters in place
Problems/reverseStringInPlace.py
Problems/reverseStringInPlace.py
Python
0.999994
@@ -0,0 +1,559 @@ +#!/Applications/anaconda/envs/Python3/bin%0A%0A%0Adef main():%0A # Test suite%0A tests = %5B None, %5B''%5D, %5B'f','o','o',' ','b','a','r'%5D%5D%0A for t in tests:%0A print('Testing: %7B%7D'.format(t))%0A print('Result: %7B%7D'.format(reverse_string_in_place(t)))%0A%0A retu...
1c6ea402b918ee23c13fc6dc5bef80b97f6f9d67
Add check_tar script.
check_tar.py
check_tar.py
Python
0
@@ -0,0 +1,2597 @@ +#!/usr/bin/env python3%0Afrom argparse import ArgumentParser%0Aimport logging%0Aimport os%0Aimport tarfile%0Aimport sys%0A%0A%0Aclass TarfileNotFound(Exception):%0A %22%22%22Raised when specified tarfile cannot be found.%22%22%22%0A%0A%0Aclass TestedDirNotFound(Exception):%0A %22%22%22Raised w...
bd1ad829908f0f0a029e4e00bdd2f12512fff297
add formaction class
rasa_core/actions/forms.py
rasa_core/actions/forms.py
Python
0.000001
@@ -0,0 +1,3144 @@ +# -*- coding: utf-8 -*-%0Afrom __future__ import absolute_import%0Afrom __future__ import division%0Afrom __future__ import print_function%0Afrom __future__ import unicode_literals%0A%0Afrom rasa_core.actions.action import Action%0Afrom rasa_core.dispatcher import Button%0Afrom rasa_core.events impo...
4836db9ba6686557ed005b8518098b9dd1a302e1
Add drown* to offensive regex
offensive.py
offensive.py
import re offensive = re.compile( r"\b(deaths?|dead(ly)?|die(s|d)?|hurts?|(sex|child)[ -]?(abuse|trafficking)|injur(e|i?es|ed|y)|" r"kill(ing|ed|er|s)?s?|wound(ing|ed|s)?|fatal(ly|ity)?|shoo?t(s|ing|er)?s?|crash(es|ed|ing)?|" r"attack(s|ers?|ing|ed)?|murder(s|er|ed|ing)?s?|hostages?|rap(e|es|ed|ing)|assaul...
Python
0.000026
@@ -689,16 +689,46 @@ %7Cin) +%7C%22%0A r%22drown(s%7Cing%7Ced%7Cings)? )%5CW?%5Cb%22, %0A @@ -723,20 +723,16 @@ )%5CW?%5Cb%22, -%0A flags=r
fdc31769208dc3a6fc81758083de1d98a968262b
Add new py-asserts package (#14038)
var/spack/repos/builtin/packages/py-asserts/package.py
var/spack/repos/builtin/packages/py-asserts/package.py
Python
0
@@ -0,0 +1,925 @@ +# Copyright 2013-2019 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 PyAsserts(PythonPackage):%0A %22%22%22Stand-alone Assert...
e101665e5e206c66198a9f30fcdf2a2ff53a128b
Update version to 1.5 (#5524)
var/spack/repos/builtin/packages/r-jsonlite/package.py
var/spack/repos/builtin/packages/r-jsonlite/package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0
@@ -2124,20 +2124,18 @@ an.r --project.org +studio.com /src @@ -2154,17 +2154,17 @@ nlite_1. -2 +5 .tar.gz%22 @@ -2164,16 +2164,95 @@ tar.gz%22%0A + list_url = homepage%0A%0A version('1.5', '2a81c261a702fccbbd5d2b32df108f76') %0A ver
85a8741564266fae7f7e4b1ccd518324277ad58a
Create diss.py
diss/diss.py
diss/diss.py
Python
0.000002
@@ -0,0 +1,753 @@ +from __main__ import send_cmd_help%0Afrom discord.ext import commands%0Afrom random import choice%0Aimport discord%0A%0Aclass Diss:%0A %22%22%22Example cog for dissing or respecting a user%22%22%22%0A%0A def __init__(self, bot):%0A self.bot = bot%0A self.users = %7B 'name1' : %5B'...
a244ffe1814e8ad7966f90b212faebfaf35424be
Initialize P01_tablePrinter
books/AutomateTheBoringStuffWithPython/Chapter06/PracticeProjects/P01_tablePrinter.py
books/AutomateTheBoringStuffWithPython/Chapter06/PracticeProjects/P01_tablePrinter.py
Python
0.000002
@@ -0,0 +1,645 @@ +# This program displays a list of strings in a table%0A#%0A# Write a function named printTable() that takes a list of lists of strings and%0A# displays it in a well-organized table with each column right-justified. Assume%0A# that all the inner lists will contain the same number of strings.%0A#%0A# F...
feae414803ba3a6458660314f212e5e20820d979
add core codes for distances
core/core.py
core/core.py
Python
0
@@ -0,0 +1,1469 @@ +# internal libraries%0Aimport multiprocessing%0Afrom time import time%0Aimport csv%0Aimport sys%0A%0A# external libraries%0Afrom sklearn.metrics import pairwise, accuracy_score%0Aimport numpy as np%0A%0ANOT_BOOL_METRICS = %5B%0A 'euclidean',%0A 'l2',%0A 'l1',%0A 'manhattan',%0A 'minko...
4b228cc867163b89c722bb93baae56f04fd1a5d7
is_bst.py
2-DataStructures/Week6/is_bst/is_bst.py
2-DataStructures/Week6/is_bst/is_bst.py
Python
0.998822
@@ -0,0 +1,910 @@ +#!/usr/bin/python3%0A%0Aimport sys, threading%0A%0Asys.setrecursionlimit(10**6) # max depth of recursion%0Athreading.stack_size(2**27) # new thread will get stack of such size%0A%0A%0Amx = None%0A%0Adef IsBinarySearchTree(tree):%0A if len(tree) in (0,1):%0A return True%0A%0A def inOrderTraversa...
7c750650961a6aac4e189b46e1353a3ec003dd56
add test-send-file-ipv6.py but disabled for now because of Python bug
tests/twisted/avahi/test-send-file-ipv6.py
tests/twisted/avahi/test-send-file-ipv6.py
Python
0
@@ -0,0 +1,1791 @@ +import avahi%0Afrom saluttest import exec_test%0Afrom avahitest import AvahiAnnouncer, get_host_name%0Afrom xmppstream import setup_stream_listener6%0Afrom file_transfer_helper import SendFileTest, CHANNEL_TYPE_FILE_TRANSFER, FT_STATE_PENDING, %5C%0A FT_STATE_CHANGE_REASON_NONE, FT_STATE_OPEN%0A%...
bec2f43e9e6a6f858c97ae19c07eb35cd912457c
Create 3_flickrlikes_assembledata_directory.py
3_flickrlikes_assembledata_directory.py
3_flickrlikes_assembledata_directory.py
Python
0.000554
@@ -0,0 +1,3036 @@ +#!/usr/bin/env python%0A%22%22%22%0AThis will create train and test txt files and a directory named images in flickr_likes parent directory, %0Awhere all the folders exist. Then, run following commands to copy all files into the images directory%0A# find ./ -name '*.jpg' -exec cp '%7B%7D' ./ %5C; To...
68942512cd5bb9ea1c15a3dc663b8ea1a08df8f4
Update the deprecation message of PageSet.
tools/telemetry/telemetry/page/page_set.py
tools/telemetry/telemetry/page/page_set.py
# Copyright 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os from telemetry.page import page as page_module from telemetry import decorators from telemetry import story PUBLIC_BUCKET = story.PUBLIC_BUCKET P...
Python
0.000002
@@ -432,10 +432,10 @@ 6, -25 +30 , 'P @@ -448,25 +448,24 @@ use the -User Story +Set class i
e8c8464d36e91c9a8d61db0531a2e73dcdee88b7
Add a test for check_inputs.
utilities/tests/test_simulation_utils.py
utilities/tests/test_simulation_utils.py
Python
0
@@ -0,0 +1,350 @@ +from utilities.simulation_utilities import check_inputs%0A%0Aimport pytest%0Aimport numpy as np%0A%0A%0A@pytest.mark.parametrize(%22input,expected%22, %5B%0A (None, np.ndarray(%5B0%5D)),%0A (%5B0%5D, np.array(%5B0%5D)),%0A (1, np.array(%5B1%5D)),%0A (range(5), np.array(%5B0,1,2,3,4%5D))%0...
0c5cbacab1c2925ed0a00d3af0415b76f50c1eec
Create wikipedia.py
dasem/wikipedia.py
dasem/wikipedia.py
Python
0.000454
@@ -0,0 +1,27 @@ +%22%22%22Wikipedia interface.%22%22%22%0A
ecef0ea7743f25326183d09622949682ce6feb3c
Test traverses a TS file quickly
test/ts.py
test/ts.py
Python
0
@@ -0,0 +1,2372 @@ +#!/usr/bin/env python%0A'''%0AModule: test%0ADesc: Test to see how quickly I can parse TS es packets%0AAuthor: John O'Neil%0AEmail: oneil.john@gmail.com%0ADATE: Thursday, October 20th 2016%0A%0A'''%0Aimport os%0Aimport sys%0Aimport argparse%0A%0APACKET_SIZE = 188%0ASYNC_BYTE = 'G'%0A%0A#generator%0A...
2bbd2ac9b4620f33189fa202ee17dee7f7481330
Create start.py
master_server/start.py
master_server/start.py
Python
0.000002
@@ -0,0 +1,390 @@ +import os%0Aimport threading%0Aimport sys%0Aport=5000%0A%0Adef new_serve():%0A global port%0A port=port + 1%0A os.system('python dummy_vm_server.py '+str(port))%0Adef master_server():%0A os.system('python master_server.py')%0Aif __name__ == '__main__':%0A t=threading.Thread(target=master_server)...
b5c6e37bdcb88545d187ad1e3adbbbe1d466f874
Add py solution for 688. Knight Probability in Chessboard
py/knight-probability-in-chessboard.py
py/knight-probability-in-chessboard.py
Python
0.99863
@@ -0,0 +1,787 @@ +from collections import Counter%0Afrom math import log, exp%0Aclass Solution(object):%0A def knightProbability(self, N, K, r, c):%0A %22%22%22%0A :type N: int%0A :type K: int%0A :type r: int%0A :type c: int%0A :rtype: float%0A %22%22%22%0A p ...
b6ec697d0dd8baa8866fb6619275d556e8b0165a
Add clear_cache command to clear cache
djutils/management/commands/clear_cache.py
djutils/management/commands/clear_cache.py
Python
0.000002
@@ -0,0 +1,575 @@ +###############################################################################%0A## Imports%0A###############################################################################%0A# Django%0Afrom django.core.management.base import BaseCommand%0Afrom django.core.cache import cache%0A%0A%0A###############...
9903c65a821dc0edf1a7a1bd2308f801fcfbdcfd
rollback of 92f8fde44f
testris.py
testris.py
#!/usr/bin/env python """ Testris is the test runner for Learntris. Learntris is the part *you* write, in whatever language you prefer. If you're seeing this message when you tried to run testris.py, it means testris can't find your code! Your first step is to write a *console-mode* program (one that does absolutely ...
Python
0.000001
@@ -1991,85 +1991,8 @@ ())%0A - elif sline == '': # ignore blank lines%0A pass%0A
2d663cf136b3bb2954ea1a53b17d70a28bfbd62f
add kattis/addingwords
Kattis/addingwords.py
Kattis/addingwords.py
Python
0.000785
@@ -0,0 +1,970 @@ +%22%22%22%0D%0AProblem: addingwords%0D%0ALink: https://open.kattis.com/problems/addingwords%0D%0ASource: Kattis%0D%0A%22%22%22%0D%0Aimport sys%0D%0A%0D%0Alines = sys.stdin%0D%0Amemory = dict()%0D%0A%0D%0A%0D%0Adef define(variable, value):%0D%0A memory%5Bvariable%5D = value%0D%0A%0D%0Adef calc(args...
f80acf05f7d492f3716be961b88c4e82d332500c
Create class to update instances with offering
dbaas/util/update_instances_with_offering.py
dbaas/util/update_instances_with_offering.py
Python
0
@@ -0,0 +1,941 @@ +# coding: utf-8%0A%0A%0Aclass UpdateInstances(object):%0A%0A @staticmethod%0A def do():%0A from dbaas_cloudstack.models import DatabaseInfraOffering%0A from dbaas_cloudstack.models import PlanAttr%0A from physical.models import Instance%0A%0A infra_offerings = Databa...
e6afab39aaf263525c5abf67d46a85ff13418340
Add default_settings.py
django_compat_patcher/default_settings.py
django_compat_patcher/default_settings.py
Python
0.000002
@@ -0,0 +1,128 @@ +%0A%0ADCP_INCLUDE_FIXER_IDS = None%0ADCP_INCLUDE_FIXER_FAMILIES = None%0A%0ADCP_EXCLUDE_FIXER_IDS = None%0ADCP_EXCLUDE_FIXER_FAMILIES = None
445b6f254ed1fa6193b1c29a9012fe38d9bc768f
Create ClassStaticRegularMethods.py
EmployeeManagementSystem/Findings/ClassStaticRegularMethods.py
EmployeeManagementSystem/Findings/ClassStaticRegularMethods.py
Python
0
@@ -0,0 +1,3048 @@ +#class methods vs regular methods vs static methods%0A#regular methods -automatically take the instance as the first argument (%22self%22 by convention)%0A#class methods - takes %22cls%22 as the first argument (%22a decorator class-method should be used)%0A#static methods - dont pass anything automa...
febc64250995cc3e110b553697f615213c1c4d1f
implement RGBAColor
mpf/core/rgba_color.py
mpf/core/rgba_color.py
Python
0.000019
@@ -0,0 +1,766 @@ +%22%22%22RGBA Color.%22%22%22%0Afrom typing import Tuple, Union%0A%0Afrom mpf.core.rgb_color import RGBColor%0A%0A%0Aclass RGBAColor(RGBColor):%0A%0A %22%22%22RGB Color with alpha channel.%22%22%22%0A%0A def __init__(self, color: Union%5BRGBColor, Tuple%5Bint, int, int, int%5D%5D):%0A %2...
c0137e888f3ea073fcca7b4abe05e8a52357b75d
Add base.py
Koko/base.py
Koko/base.py
Python
0.000001
@@ -0,0 +1,799 @@ +#!/usr/bin/python%0A# -*- coding: UTF-8 -*-%0A%0A__author__ = 'Markus Beuckelmann'%0A__author_email__ = 'email@markus-beuckelmann.de'%0A__version__ = '0.0.1'%0A%0ADEBUG = True%0AHOST = '127.0.0.1'%0APORT = 5002%0ANAME = 'Koko'%0A%0Afrom flask import Flask%0A%0Aapp = Flask(NAME)%0A%0Aif __name__ == '_...
689fe4b59e339f15de7e8e1fd6bc9ed1a2588cf3
Create two_sum.py
two_sum.py
two_sum.py
Python
0.999833
@@ -0,0 +1,217 @@ +import random%0A%0Aitems = %5Brandom.randint(-50, 50) for i in range(100)%5D%0Aexpected = 27%0A%0Aprint(items)%0A%0Aseen = set()%0A%0Afor i in items:%0A if expected - i in seen:%0A print(i, expected - i)%0A seen.add(i)%0A%0Aprint(seen)%0A
2e2f48ca37d18386a0faba23cbbdd94fff5727b2
Añade model para event
core/migrations/0018_event.py
core/migrations/0018_event.py
Python
0.000002
@@ -0,0 +1,936 @@ +# -*- coding: utf-8 -*-%0A# Generated by Django 1.11 on 2017-04-26 14:41%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('core', '0017_auto_20170426_1007'),%0A %5D%0A%0A ...
73ff8eb3a994741bb19384ae839f41a5125e3c7a
Add create_dev_account_roles
director/scripts/create_dev_account_roles.py
director/scripts/create_dev_account_roles.py
Python
0.000002
@@ -0,0 +1,546 @@ +%22%22%22%0AAssign account roles to the test users.%0A%22%22%22%0A%0Afrom django.contrib.auth.models import User%0Afrom django.conf import settings%0A%0Afrom accounts.models import Account, AccountUserRole, AccountRole%0A%0A%0Adef run(*args):%0A # Ensure that this is only used in development%0A ...
38b26f038fb7855a6b4d80fad897997acd4f0ef2
handle double deletion caused by httpretty
moto/route53/models.py
moto/route53/models.py
from moto.core import BaseBackend from moto.core.utils import get_random_hex class FakeZone: def __init__(self, name, id): self.name = name self.id = id self.rrsets = {} def add_rrset(self, name, rrset): self.rrsets[name] = rrset def delete_rrset(self, name): del...
Python
0
@@ -306,28 +306,24 @@ e):%0A -del self.rrsets%5B @@ -321,22 +321,32 @@ f.rrsets -%5Bname%5D +.pop(name, None) %0A%0A%0Aclass
bc17847b9e9cc71ea7ba45ef7292547384c70883
Create Remove_Nth_Node_From_End_of_List.py
Array/Remove_Nth_Node_From_End_of_List.py
Array/Remove_Nth_Node_From_End_of_List.py
Python
0.000002
@@ -0,0 +1,940 @@ +Given a linked list, remove the nth node from the end of list and return its head.%0A%0AFor example,%0A%0A Given linked list: 1-%3E2-%3E3-%3E4-%3E5, and n = 2.%0A%0A After removing the second node from the end, the linked list becomes 1-%3E2-%3E3-%3E5.%0ANote:%0AGiven n will always be valid.%0ATr...
112e3516d7c77f23edfed704651e8c5e7f7d75e4
Add example heat map script for data
scripts/DEV/adm/heatmap.py
scripts/DEV/adm/heatmap.py
Python
0
@@ -0,0 +1,1104 @@ +import numpy as np%0Aimport numpy.ma as ma%0Aimport matplotlib.pyplot as plt%0Aimport matplotlib.cm as cm%0Afrom pyiem.plot import MapPlot%0Aimport sys%0A%0Ayear = int(sys.argv%5B1%5D)%0A%0Ax = %5B%5D%0Ay = %5B%5D%0Afor linenum, line in enumerate(open('visit_history_093013_st12.csv')):%0A if line...
a2ff82db981aa6fd29f0b2d2d66e7cb02fb1813c
Create ctci-connected-cell-in-a-grid.py
cracking-the-coding-interview/ctci-connected-cell-in-a-grid.py
cracking-the-coding-interview/ctci-connected-cell-in-a-grid.py
Python
0.000001
@@ -0,0 +1,531 @@ +def getBiggestRegion(grid,m,n):%0A def size(i,j):%0A if 0 %3C= i %3C len(grid) and 0 %3C= j %3C len(grid%5Bi%5D) and grid%5Bi%5D%5Bj%5D == 1:%0A grid%5Bi%5D%5Bj%5D = 0%0A return 1 + sum(size(i2,j2) for i2 in range(i - 1,i + 2) for j2 in range(j - 1,j + 2))%0A re...
fe4e1eb3cc4485af9a1a48bfb02be4f651b23b1d
add config/
config/config.py
config/config.py
Python
0
@@ -0,0 +1,428 @@ +#SECRETS%0A%0Aprint %22%5BINFO%5D Env config vars loaded%22%0A%0A#DATABASE_URL is defined in the environment of the machine running the app%0A#for instance, if running locally, DATABASE_URL is set doing:%0A#export DATABASE_URL=%22psql://epb/%22 etc%0A%0A#for the time being%0ADEBUG=True%0ADEVELOPMENT=...
62a860112db8c263d26eb9e4cdb67d23ce61848a
Add a snippet (Python OpenCV).
python/opencv/opencv_2/write_image.py
python/opencv/opencv_2/write_image.py
Python
0.000018
@@ -0,0 +1,1477 @@ +#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2015 J%C3%A9r%C3%A9mie DECOCK (http://www.jdhp.org)%0A%0A%22%22%22%0AOpenCV - Write image: write an image given in arguments%0A%0ARequired: opencv library (Debian: aptitude install python-opencv)%0A%0ASee: https://opencv-python-tut...