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 |
|---|---|---|---|---|---|---|---|
bbc208548f0dd381f3045d24db3c21c4c8ee004e | Test all sensors at once | grovepi/scan.py | grovepi/scan.py | Python | 0 | @@ -0,0 +1,1456 @@
+import time%0Aimport grove_i2c_temp_hum_mini # temp + humidity%0Aimport hp206c # altitude + temp + pressure%0Aimport grovepi # used by air sensor and dust sensor%0Aimport atexit # used for the dust sensor%0Aimport json%0A%0A# Initialize the sensors%0At= grove_i2c_temp_hum_mini.th02()%0Ah= hp206c.hp... | |
c834082c59abe6ae6d2e065e1a5afac2d399a612 | Add unittests for the bridgedb.crypto module. | lib/bridgedb/test/test_crypto.py | lib/bridgedb/test/test_crypto.py | Python | 0 | @@ -0,0 +1,2114 @@
+# -*- coding: utf-8 -*-%0A#%0A# This file is part of BridgeDB, a Tor bridge distribution system.%0A#%0A# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 %3Cisis@torproject.org%3E%0A# please also see AUTHORS file%0A# :copyright: (c) 2013, Isis Lovecruft%0A# (c) 2007-2013, The Tor Pr... | |
8373de2daf5c44c069b9312ad3a3b21e2f5c21e3 | Implement channel mode +l | txircd/modules/cmode_l.py | txircd/modules/cmode_l.py | Python | 0 | @@ -0,0 +1,1039 @@
+from twisted.words.protocols import irc%0Afrom txircd.modbase import Mode%0A%0Aclass LimitMode(Mode):%0A%09def checkSet(self, user, target, param):%0A%09%09intParam = int(param)%0A%09%09if str(intParam) != param:%0A%09%09%09return False%0A%09%09return (intParam %3E= 0)%0A%09%0A%09def commandPermissi... | |
a24844a20634354167511163870438c36581c656 | Add py-hpack (#19189) | var/spack/repos/builtin/packages/py-hpack/package.py | var/spack/repos/builtin/packages/py-hpack/package.py | Python | 0 | @@ -0,0 +1,614 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass PyHpack(PythonPackage):%0A %22%22%22Pure-Python HPACK he... | |
5ed57df8d1e3b85bc27d5a834c9ec35b18055ba9 | Create codility.py | codility.py | codility.py | Python | 0.000003 | @@ -0,0 +1,494 @@
+#lesson 1%0Adef solution(N):%0A bstr = dectoBin(N)%0A arr = %5B%5D%0A cnt = 0%0A for b in bstr:%0A if b == '0':%0A cnt = cnt + 1%0A if b != '0':%0A arr.append(cnt)%0A cnt = 0 %0A return getMax(arr)%0A%0Adef dectoBin(N):%0A bstr = %22%22... | |
955bca3beb7808636a586bed43c37e5f74fba17f | Add Weather class (use forecastio, geopy) - forecase(current/daily) | kino/functions/weather.py | kino/functions/weather.py | Python | 0 | @@ -0,0 +1,1562 @@
+# -*- coding: utf-8 -*-%0A%0Aimport datetime%0Aimport forecastio%0Afrom geopy.geocoders import GoogleV3%0A%0Afrom kino.template import MsgTemplate%0Afrom slack.slackbot import SlackerAdapter%0Afrom utils.config import Config%0A%0Aclass Weather(object):%0A%0A def __init__(self):%0A self.con... | |
1005f983774392306ca10e5fb12b59eeb63a88c4 | add remote file inclusion exploit | framework/Exploits/OSVDB_82707_D.py | framework/Exploits/OSVDB_82707_D.py | Python | 0.000001 | @@ -0,0 +1,2463 @@
+%0A# Copyright 2013 University of Maryland. All rights reserved.%0A# Use of this source code is governed by a BSD-style%0A# license that can be found in the LICENSE.TXT file.%0A%0A%0Aimport framework %0Aimport time%0Aimport selenium.common.exceptions%0A%0Aclass Exploit (frame... | |
2c1b393c347ffcf24d9584be800378a1b77fa86d | add example to test error handling | flexx/ui/examples/errors.py | flexx/ui/examples/errors.py | Python | 0 | @@ -0,0 +1,1713 @@
+%22%22%22%0AApp that can be used to generate errors on the Python and JS side. These%0Aerrors should show tracebacks in the correct manner (and not crash the app%0Aas in #164).%0A%0ATo test thoroughly, you should probably also set the foo and bar%0Aproperties from the Python and JS console.%0A%22%22... | |
331308eedd37628f5419001fc48fc5a328c1bab9 | Add test_jsc | unnaturalcode/test_jsc.py | unnaturalcode/test_jsc.py | Python | 0.00001 | @@ -0,0 +1,1604 @@
+#!/usr/bin/python%0A# Copyright 2017 Dhvani Patel%0A#%0A# This file is part of UnnaturalCode.%0A# %0A# UnnaturalCode 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 Foundat... | |
a6495a05d4652beeefca9e383f5dd7b8fc4246d7 | Create simple_fun_91:unique_digit_products.py | Solutions/simple_fun_91:unique_digit_products.py | Solutions/simple_fun_91:unique_digit_products.py | Python | 0.999972 | @@ -0,0 +1,115 @@
+from operator import mul%0A%0Adef unique_digit_products(a):%0A return len(%7Breduce(mul, map(int, str(x))) for x in a%7D)%0A
| |
371545ecae0296f9274319c971be1378c3dafbbe | Add migration | services/migrations/0036_auto_20150327_1434.py | services/migrations/0036_auto_20150327_1434.py | Python | 0.000002 | @@ -0,0 +1,1298 @@
+# -*- 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 ('services', '0035_auto_20150325_1637'),%0A %5D%0A%0A operations = %5B%0A migrations.AddFi... | |
7d061e698788a60f0e3b59559961408015d891ed | Add first iteration of message_producer | utils/message_producer.py | utils/message_producer.py | Python | 0.000051 | @@ -0,0 +1,1109 @@
+import argparse%0Aimport pika%0A%0A%0Adef send_message(queue, body=None):%0A %22%22%22%0A Sends a message to the specified queue with specified body if applicable.%0A%0A :param queue: Name of queue.%0A :type queue: str%0A :param body: Content of message body in the form %22%7B'key': '... | |
49614576524e74cb2e8eaa6656c1e86bf546c8e6 | Create keystone_test.py | keystone_test.py | keystone_test.py | Python | 0.000005 | @@ -0,0 +1,1624 @@
+import keystoneclient.v2_0.client as ksclient%0Aimport novaclient.v1_1.client as nvclient%0Afrom novaclient import client as novaclient%0Aimport glanceclient%0Aimport os%0A%0Adef get_keystone_creds():%0A d = %7B%7D%0A d%5B'username'%5D = 'admin'%0A d%5B'password'%5D = 'password'%0A d%5B'... | |
6789f2ea1862f4c30e8d60bd0b47640b7e5835c1 | Add script to count labels in a data set | count_labels.py | count_labels.py | Python | 0 | @@ -0,0 +1,1059 @@
+%22%22%22Count HEEM labels in data set.%0A%0AUsage: python count_labels.py %3Cdir with train and test files%3E%0A%22%22%22%0Aimport codecs%0Afrom glob import glob%0Aimport numpy as np%0Aimport argparse%0Afrom collections import Counter%0A%0A%0Adef load_data(data_file):%0A data = %5Bln.rsplit(None... | |
2c4a2368d2dc1c6ee910358fedd6e85cdf4f043a | Add test from jasmine-core | test/jasmine_core_test.py | test/jasmine_core_test.py | Python | 0 | @@ -0,0 +1,630 @@
+from pytest import raises%0Aimport pytest%0Aimport subprocess%0A%0Afrom jasmine_core import Core%0Aimport os%0Aimport pkg_resources%0A%0Anotwin32 = pytest.mark.skipif(%22sys.platform == 'win32'%22)%0A%0A@notwin32%0Adef test_js_files():%0A files = %5B%0A 'jasmine.js',%0A 'jasmine-html... | |
7b5b4fdf8d5801d6e87d1b39f46a5f868aa07110 | Add test | tests/cupy_tests/test_typing.py | tests/cupy_tests/test_typing.py | Python | 0.000005 | @@ -0,0 +1,135 @@
+import cupy%0A%0A%0Aclass TestClassGetItem:%0A%0A def test_class_getitem(self):%0A from typing import Any%0A cupy.ndarray%5BAny, Any%5D%0A
| |
a9609a500a65cc0efb787f5d90e164bd6fa48c1a | Print the left view of a BST | leftViewofBST.py | leftViewofBST.py | Python | 0.999984 | @@ -0,0 +1,1075 @@
+class BST:%0A def __init__(self,val):%0A self.left = None%0A self.right = None%0A self.data = val%0A%0Adef insertToBst(root,value):%0A if root is None:%0A root = value%0A else:%0A if value.data %3C root.data:%0A if root.left is None:%0A ... | |
08e7103766ce684e849f23fac77792876fded586 | fix helper to use the actual lines form ceph.conf | tests/functional/tests/mon/test_initial_members.py | tests/functional/tests/mon/test_initial_members.py | import pytest
uses_mon_initial_members = pytest.mark.skipif(
'mon_initial_members' not in pytest.config.slaveinput['node_config']['components'],
reason="only run in monitors configured with initial_members"
)
class TestMon(object):
def get_line_from_config(self, string, conf_path):
with open(c... | Python | 0 | @@ -414,34 +414,40 @@
ine in ceph_conf
+_lines
:%0A
-
@@ -801,33 +801,33 @@
_config('mon
-_
+
initial
-_
+
members', ce
@@ -1183,33 +1183,33 @@
_config('mon
-_
+
initial
-_
+
members', ce
@@ -1261,33 +1261,33 @@
line == 'mon
-_
+
initial
-_
+
members = mo
|
5fad9d4fb60eb29d04d8d6a7fd967aad67ca28e2 | Create __init__.py | pagination_bootstrap/__init__.py | pagination_bootstrap/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
379d2953c90610a48eb80d1cabedb63b8f948813 | Use `for_app` helper | thefuck/rules/fab_command_not_found.py | thefuck/rules/fab_command_not_found.py | from thefuck.utils import eager, get_closest
def match(command):
return (command.script_parts[0] == 'fab'
and 'Warning: Command(s) not found:' in command.stderr)
# We need different behavior then in get_all_matched_commands.
@eager
def _get_between(content, start, end=None):
should_yield = False... | Python | 0.000036 | @@ -37,18 +37,43 @@
_closest
-%0A%0A
+, for_app%0A%0A%0A@for_app('fab')
%0Adef mat
@@ -100,58 +100,8 @@
urn
-(command.script_parts%5B0%5D == 'fab'%0A and
'War
@@ -146,17 +146,16 @@
d.stderr
-)
%0A%0A%0A# We
|
df777bf0771fdd8aadfbb26fe13b51692f4c161d | Add autogen package (#3542) | var/spack/repos/builtin/packages/autogen/package.py | var/spack/repos/builtin/packages/autogen/package.py | Python | 0 | @@ -0,0 +1,2398 @@
+##############################################################################%0A# Copyright (c) 2013-2016, 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... | |
cbbf9f34d08897358023078d81be3fa798601b02 | add the repl.py | repl.py | repl.py | Python | 0 | @@ -0,0 +1,824 @@
+#!/usr/bin/env python3%0A%22%22%22Run Django shell with imported modules%22%22%22%0Aif __name__ == %22__main__%22:%0A import os%0A%0A if not os.environ.get(%22PYTHONSTARTUP%22):%0A from subprocess import check_call%0A import sys%0A%0A base_dir = os.path.dirname(os.path.absp... | |
21799cbe81c57f80f66cb5a90992d6ff66c31e2d | Create new package. (#5919) | var/spack/repos/builtin/packages/r-hmisc/package.py | var/spack/repos/builtin/packages/r-hmisc/package.py | Python | 0 | @@ -0,0 +1,2543 @@
+##############################################################################%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... | |
cf7c33e3b3d733f24376badac70392ecb5f5a323 | add more tests | tests/test_build_definitions.py | tests/test_build_definitions.py | Python | 0 | @@ -0,0 +1,1416 @@
+from vdist.builder import Build%0Afrom vdist.source import git, directory, git_directory%0A%0A%0Adef test_build_projectroot_from_uri():%0A build = Build(%0A name='my build',%0A app='myapp',%0A version='1.0',%0A source=git(%0A uri='https://github.com/objectif... | |
e19097216c090c0e3f4b68c743d6427f012ab69e | Add migration for legislator change | txlege84/legislators/migrations/0004_auto_20141201_1604.py | txlege84/legislators/migrations/0004_auto_20141201_1604.py | Python | 0 | @@ -0,0 +1,505 @@
+# -*- 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 ('legislators', '0003_auto_20141120_1731'),%0A %5D%0A%0A operations = %5B%0A migrations.Alt... | |
01327c49590641c8fe918d91a7877aa67fd56e88 | Add lc0172_factorial_trailing_zeroes.py | lc0172_factorial_trailing_zeroes.py | lc0172_factorial_trailing_zeroes.py | Python | 0.000087 | @@ -0,0 +1,584 @@
+%22%22%22Leetcode 172. Factorial Trailing Zeroes%0AEasy%0A%0AURL: https://leetcode.com/problems/factorial-trailing-zeroes/%0A%0AGiven an integer n, return the number of trailing zeroes in n!.%0A%0AExample 1:%0AInput: 3%0AOutput: 0%0AExplanation: 3! = 6, no trailing zero.%0A%0AExample 2:%0AInput: 5%0A... | |
6a9b224834d1a523b03ce1e7c6ff4fa3ccea2583 | Add tests for parse_utils.extract_tables. | tests/test_parse_utils.py | tests/test_parse_utils.py | Python | 0 | @@ -0,0 +1,1003 @@
+from pgcli.packages.parseutils import extract_tables%0A%0Adef test_simple_select_single_table():%0A tables = extract_tables('select * from abc')%0A assert tables == %5B'abc'%5D%0A%0Adef test_simple_select_multiple_tables():%0A tables = extract_tables('select * from abc, def')%0A assert t... | |
897843932937faa841220cde90bdc89603d95615 | Solve hackerrank linked list problem | hackerrank/linked-list/dedup.py | hackerrank/linked-list/dedup.py | Python | 0.005101 | @@ -0,0 +1,463 @@
+# https://www.hackerrank.com/challenges/delete-duplicate-value-nodes-from-a-sorted-linked-list/problem%0A%0Adef RemoveDuplicates(head):%0A if head is None:%0A return None%0A %0A curr = head%0A while curr.next is not None:%0A currentData = curr.data%0A next = curr.next... | |
b3a20379162a068cc8f9a0f314a21a46ec40e4c6 | Add simple unit test for snapshot iteration class | test.py | test.py | Python | 0 | @@ -0,0 +1,819 @@
+#!/usr/bin/env python%0A%0Aimport unittest%0Afrom fix_time_machine_backup import SnapshotList%0A%0Aclass TestSnapshotList(unittest.TestCase):%0A def setUp(self):%0A self.snapshot_list = SnapshotList(%5B%0A 'auto-20160820.2103-2m', %0A 'auto-20160821.0003-2m', %0A ... | |
aaea97c5cab778174b45cb2557d819deb769a45e | Create instagram_checker.py | instagram_checker.py | instagram_checker.py | Python | 0.000035 | @@ -0,0 +1,2998 @@
+import requests, argparse, sys%0A%0Aclass checker:%0A def __init__(self):%0A%0A #Declare some variables%0A self.headers = %7B'User-agent': 'Mozilla/5.0'%7D%0A self.loginurl = 'https://www.instagram.com/accounts/login/ajax/'%0A self.url = 'https://www.instagram.com/'%0A... | |
20600b8cac9488ff416397de374c2d3dacf4afe4 | add tests and netcdf-cxx4 | var/spack/repos/builtin/packages/dealii/package.py | var/spack/repos/builtin/packages/dealii/package.py | from spack import *
class Dealii(Package):
"""C++ software library providing well-documented tools to build finite element codes for a broad variety of PDEs."""
homepage = "https://www.dealii.org"
url = "https://github.com/dealii/dealii/releases/download/v8.4.0/dealii-8.4.0.tar.gz"
version('8.4.0... | Python | 0 | @@ -12,16 +12,30 @@
import *
+%0Aimport shutil
%0A%0Aclass
@@ -709,16 +709,21 @@
(%22netcdf
+-cxx4
%22)%0A #
@@ -2050,16 +2050,21 @@
%5B'netcdf
+-cxx4
'%5D.prefi
@@ -2525,24 +2525,24 @@
ake(%22test%22)%0A
-
make
@@ -2553,8 +2553,1187 @@
stall%22)%0A
+%0A # run some MPI examples with differen... |
16aa4a292fafa2a74f668a56c5cf1a66f923df24 | Make src.cm.tools a package | src/cm/tools/__init__.py | src/cm/tools/__init__.py | Python | 0.000437 | @@ -0,0 +1,70 @@
+%22%22%22@package cm.tools%0A@date Jun 6, 2014%0A%0A@author Zosia Soboci%C5%84ska%0A%22%22%22%0A%0A
| |
519d6052e3bf16c8028d39eab374cd2aa17ffd4e | add position field to user committee | application/migrations/0014_usercommittee_position.py | application/migrations/0014_usercommittee_position.py | Python | 0 | @@ -0,0 +1,462 @@
+# -*- 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 ('application', '0013_auto_20150313_2126'),%0A %5D%0A%0A operations = %5B%0A migrations.Add... | |
557b0f30e0180a526433b65915d2a137144f2f05 | add test_logger.py | tests/unit/test_logger.py | tests/unit/test_logger.py | Python | 0.000007 | @@ -0,0 +1,1050 @@
+# Tai Sakuma %3Ctai.sakuma@gmail.com%3E%0Aimport logging%0A%0Aimport alphatwirl%0A%0A##__________________________________________________________________%7C%7C%0Adef test_logger_exist():%0A assert 'alphatwirl' in logging.Logger.manager.loggerDict%0A%0Adef test_len_handlers():%0A logger = loggi... | |
59b00a4f5cc5aa5139492660206c99185df24f7b | create unittest for area serializer for #191 | popit/tests/test_area_api.py | popit/tests/test_area_api.py | Python | 0 | @@ -0,0 +1,485 @@
+from rest_framework.test import APITestCase%0Afrom rest_framework import status%0Afrom rest_framework.authtoken.models import Token%0Afrom popit.models import *%0A%0A%0Aclass AreaAPITestCase(APITestCase):%0A fixtures = %5B %22api_request_test_data.yaml%22 %5D%0A%0A def test_create_area_serializ... | |
a8274a5d5e4ec68f3ee594ffa741e90f11cf24db | Add tool to regenerate JSON files from P4 progs | tools/update_test_bmv2_jsons.py | tools/update_test_bmv2_jsons.py | Python | 0.000001 | @@ -0,0 +1,2155 @@
+#!/usr/bin/env python2%0A%0Aimport argparse%0Aimport fnmatch%0Aimport os%0Aimport subprocess%0Aimport sys%0A%0Adef find_files(root):%0A files = %5B%5D%0A for path_prefix, _, filenames in os.walk(root, followlinks=False):%0A for filename in fnmatch.filter(filenames, '*.p4'):%0A ... | |
f1d3717b45650244d9a4f44caf6f610636bb72ee | Add other_data_collections/2015ApJ...812...60B/biteau.py | other_data_collections/2015ApJ...812...60B/biteau.py | other_data_collections/2015ApJ...812...60B/biteau.py | Python | 0 | @@ -0,0 +1,558 @@
+%22%22%22%0AScript to check and ingest Biteau & Williams (2015) data for gamma-cat.%0A%22%22%22%0Afrom astropy.table import Table%0A%0A%0Aclass Biteau:%0A def __init__(self):%0A filename = 'other_data_collections/2015ApJ...812...60B/BiteauWilliams2015_AllData_ASDC_v2016_12_20.ecsv'%0A ... | |
6f7fd163106ec5f4346eaaef04ed9726a3289801 | add wrong reversesubstring problem solution | problems/reversesubstring.py | problems/reversesubstring.py | Python | 0.995257 | @@ -0,0 +1,871 @@
+import sys%0A%0Atest = %22aabbbbababaaabbab%22%0A%0A%22%22%22%0AFind a) the first occurrence of b in string%0A b) the longest list of only as in string, store final index%0A%22%22%22%0A%0Adef solution(string):%0A firstB = string.find('b')%0A print ((string, firstB))%0A if(firstB == -1):%... | |
9ff1b6ffa297199dc73042382c369fc7af0813fc | Create stress_test1.py | home/moz4r/Test/stress_test1.py | home/moz4r/Test/stress_test1.py | Python | 0.000033 | @@ -0,0 +1,653 @@
+# stress test%0A%0Afrom time import sleep%0Aimport random%0A%0AleftPort = %22COM3%22%0A%0Ai01 = Runtime.createAndStart(%22i01%22, %22InMoov%22)%0Asleep(1)%0Ai01.startMouth()%0Ai01.startHead(leftPort)%0Ai01.startLeftHand(leftPort)%0Ai01.head.jaw.map(0,180,85,110)%0Ai01.startMouthControl(leftPort)%0A%0... | |
a183922bd275414259800e75fd78db980604fa20 | create thread3 | threading/thread3_join.py | threading/thread3_join.py | Python | 0 | @@ -0,0 +1,495 @@
+import threading%0Aimport time%0Adef thread_job():%0A print('T1 start%5Cn')%0A for i in range(10):%0A time.sleep(0.1)%0A print('T1 finish%5Cn')%0A%0Adef T2_job():%0A print('T2 start%5Cn')%0A print('T2 finish%5Cn')%0A%0Adef main():%0A added_thread = threading.Thread(target=thr... | |
143dbdb6d0d9840c4991eadbb2f5459398a6ddae | Add a 'cache' which only caches ETOPO1 files. | joerd/store/cache.py | joerd/store/cache.py | Python | 0 | @@ -0,0 +1,1616 @@
+from joerd.mkdir_p import mkdir_p%0Afrom joerd.plugin import plugin%0Afrom os import link%0Aimport os.path%0A%0A%0Aclass CacheStore(object):%0A %22%22%22%0A Every tile that gets generated requires ETOPO1. Rather than re-download%0A it every time (it's 446MB), we cache that file only.%0A%0A ... | |
679ae2966f44a071630934c7b7d9eeb550a59223 | Create balance_array.py | balance_array.py | balance_array.py | Python | 0.000521 | @@ -0,0 +1,1720 @@
+'''%0A%60Balance Array%60%0A%0AFind i in array A where: A%5B1%5D + A%5B2%5D...A%5Bi-1%5D = A%5Bi+1%5D + A%5Bi+2%5D...A%5Blen(A)%5D%0A%0AWrite a %60balanceSum%60 function which take an integer array as input,%0Ait should return the smallest i, where i is an index in the array such that%0Athe sum of e... | |
19dd8b925b188bc09eb85952db1f9f11db4c570e | add batch pics | batch_cut_pic.py | batch_cut_pic.py | Python | 0 | @@ -0,0 +1,1297 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A#function: %E5%89%AA%E5%88%87%E6%9B%B4%E6%94%B9%E5%9B%BE%E7%89%87%E5%B0%BA%E5%AF%B8%E5%A4%A7%E5%B0%8F%0Aimport os%0Aimport os.path%0Aimport sys, getopt, argparse%0Afrom PIL import Image%0A%0Afrom change_pic_size_by_cut import CutImage%0A%0Adef mai... | |
41933fa83138f3572b899839a721b95b877d09e6 | Sample code for create customer payment profile | CustomerProfiles/create-customer-payment-profile.py | CustomerProfiles/create-customer-payment-profile.py | Python | 0.996976 | @@ -0,0 +1,1239 @@
+from authorizenet import apicontractsv1%0Afrom authorizenet.apicontrollers import *%0A%0AmerchantAuth = apicontractsv1.merchantAuthenticationType()%0AmerchantAuth.name = '5KP3u95bQpv'%0AmerchantAuth.transactionKey = '4Ktq966gC55GAX7S'%0A%0AcreditCard = apicontractsv1.creditCardType()%0AcreditCard.ca... | |
f36a0d1d53b4a15d8ead51a54260946f293a8718 | add mac free memory script | mac_free.py | mac_free.py | Python | 0 | @@ -0,0 +1,1226 @@
+#!/usr/bin/python%0A'''%0ACreated on Jun 1, 2014%0A %0A@author: jay%0A'''%0A %0Aimport subprocess%0Aimport re%0A %0A# Get process info%0Aps = subprocess.Popen(%5B'ps', '-caxm', '-orss,comm'%5D, stdout=subprocess.PIPE).communicate()%5B0%5D%0Avm = subprocess.Popen(%5B'vm_stat'%5D, stdout=subprocess.PI... | |
375662aae4ab24444cbe0c8372c01ff8b8a08bc1 | add a TODO | myriadeploy/create_deployment.py | myriadeploy/create_deployment.py | #!/usr/bin/env python
""" Create a Myria deployment file """
import sys
import argparse
from itertools import groupby
def get_deployment(path, coordinator_hostname, worker_hostnames, name='myria',
rest_port=8753, database_type='postgresql',
database_port=5432, heap='2g', debug=... | Python | 0.000014 | @@ -2416,16 +2416,108 @@
up)))%5D%0A%0A
+ # TODO: add support for specifying different directories and database names for workers%0A
for
|
d9be75200af8c63a4457b6fb6ee107f4e8aa1048 | Create medium_BinaryConverter.py | medium_BinaryConverter.py | medium_BinaryConverter.py | Python | 0.000001 | @@ -0,0 +1,149 @@
+%22%22%22%0AConvert from binary string to%0Ainteger%0A%22%22%22%0Adef BinaryConverter(str): %0A return int(str,2)%0A %0A %0Aprint BinaryConverter(raw_input()) %0A
| |
470ae84c10d889b725316f6f19b1049af0c87125 | Fix Array class name | blaze/objects/array.py | blaze/objects/array.py | """This file defines the Concrete Array --- a leaf node in the expression graph
A concrete array is constructed from a Data Descriptor Object which handles the
indexing and basic interpretation of bytes
"""
from __future__ import absolute_import, division, print_function
import datashape
from ..compute.expr import ... | Python | 0.000059 | @@ -2124,38 +2124,32 @@
class__ = type('
-blaze.
Array', (Array,)
@@ -2153,24 +2153,24 @@
y,), props)%0A
+
%0A # N
@@ -2606,38 +2606,32 @@
class__ = type('
-blaze.
Array', (Array,)
@@ -2983,38 +2983,32 @@
class__ = type('
-blaze.
Array', (Array,)
@@ -3506,16 +3506,16 @@
s.imag)%0A
+
@@ -3545,1... |
73cfd55b6db4e8623ff7c5f8d0df7433e694f8c4 | Split dottable-dict logic into separate class. | metadatastore/document.py | metadatastore/document.py | import six
import mongoengine
from mongoengine.base.datastructures import BaseDict, BaseList
from mongoengine.base.document import BaseDocument
from bson.objectid import ObjectId
from datetime import datetime
from itertools import chain
from collections import MutableMapping
def _normalize(in_val):
"""
Helper... | Python | 0 | @@ -1137,22 +1137,36 @@
class Do
-cument
+ttableMutableMapping
(Mutable
@@ -1186,796 +1186,93 @@
%22%22%22
-%0A Copy the data out of a mongoengine.Document, including nested Documents,%0A but do not copy any of the mongo-specific methods or attributes.%0A %22%22%22%0A def __init__(self, mongo_document):... |
b9034ca499ae8c0366ac8cd5ee71641f39c0ffba | Add taxonomy model and initiation | website/project/taxonomies/__init__.py | website/project/taxonomies/__init__.py | Python | 0.000001 | @@ -0,0 +1,1581 @@
+import json%0Aimport os%0A%0Afrom website import settings%0A%0Afrom modularodm import fields, Q%0Afrom modularodm.exceptions import NoResultsFound%0A%0Afrom framework.mongo import (%0A ObjectId,%0A StoredObject,%0A utils as mongo_utils%0A)%0A%0A%0A@mongo_utils.unique_on(%5B'id', '_id'%5D)%0... | |
e747714e16250f3c2e85d09520f36953b1c417c3 | Create HeapSort.py | Algorithms/Sort_Algorithms/Heap_Sort/HeapSort.py | Algorithms/Sort_Algorithms/Heap_Sort/HeapSort.py | Python | 0.000001 | @@ -0,0 +1,1165 @@
+# Python program for implementation of heap Sort%0A %0A# To heapify subtree rooted at index i.%0A# n is size of heap%0Adef heapify(arr, n, i):%0A largest = i # Initialize largest as root%0A l = 2 * i + 1 # left = 2*i + 1%0A r = 2 * i + 2 # right = 2*i + 2%0A %0A # See if left ch... | |
5c0730d7caef6503e3f97849d9df6825c289e9a0 | Fix check for valid emoji. | zerver/views/reactions.py | zerver/views/reactions.py | from __future__ import absolute_import
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from typing import Text
from zerver.decorator import authenticated_json_post_view,\
has_request_variables, REQ, to_non_negative_int
from zerver.lib.actions import do_add_reac... | Python | 0.000062 | @@ -551,16 +551,23 @@
eaction,
+ Realm,
UserPro
@@ -572,16 +572,280 @@
rofile%0A%0A
+def check_valid_emoji(realm, emoji_name):%0A # type: (Realm, Text) -%3E None%0A if emoji_name in set(realm.get_emoji().keys()):%0A return%0A if emoji_name in emoji_list:%0A return%0A raise JsonableError(_(... |
17fcfd6d1962b23429d48a8a45dfb0944c2f1453 | Add constraints.py | conference_scheduler/constraints.py | conference_scheduler/constraints.py | Python | 0.000003 | @@ -0,0 +1,165 @@
+from typing import Callable, List, Dict%0A%0A%0Aclass Constraint(NamedTuple):%0A function: Callable%0A args: List%0A kwargs: Dict%0A operator: Callable%0A value: int%0A
| |
e9efb5e2ba19fcda77e35d0efdaa03b13d025df0 | create model of a feature | devmine/app/models/feature.py | devmine/app/models/feature.py | Python | 0.000001 | @@ -0,0 +1,322 @@
+from sqlalchemy import (%0A Column,%0A Integer,%0A String%0A)%0A%0Afrom devmine.app.models import Base%0A%0A%0Aclass Feature(Base):%0A %22%22%22Model of a feature.%22%22%22%0A%0A __tablename__ = 'features'%0A%0A id = Column(Integer, primary_key=True)%0A name = Column(String, null... | |
7491f500c75850c094158b4621fdef602bce3d27 | Add benchmarks for custom generators | benchmarks/benchmarks/benchmark_custom_generators.py | benchmarks/benchmarks/benchmark_custom_generators.py | Python | 0 | @@ -0,0 +1,1776 @@
+from tohu.v6.primitive_generators import Integer, HashDigest, FakerGenerator%0Afrom tohu.v6.derived_generators import Apply, Lookup, SelectOne, SelectMultiple%0Afrom tohu.v6.custom_generator import CustomGenerator%0A%0Afrom .common import NUM_PARAMS%0A%0A%0Amapping = %7B%0A 'A': %5B'a', 'aa', 'aa... | |
63d45b975d33227b65e79644622773a49dd7ccc6 | Add new package: libxcrypt (#18783) | var/spack/repos/builtin/packages/libxcrypt/package.py | var/spack/repos/builtin/packages/libxcrypt/package.py | Python | 0 | @@ -0,0 +1,920 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass Libxcrypt(AutotoolsPackage):%0A %22%22%22libxcrypt is a ... | |
465b83e394c2bb90a85580946e291d0249fc754e | Fix model fields label | apps/accounts/migrations/0005_auto_20160101_1840.py | apps/accounts/migrations/0005_auto_20160101_1840.py | Python | 0.000001 | @@ -0,0 +1,706 @@
+# -*- 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 ('accounts', '0004_auto_20151227_1553'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterF... | |
6c599caaf8a4daadfe287898901cad54fda37875 | add Post model | XdaPy/model/post.py | XdaPy/model/post.py | Python | 0 | @@ -0,0 +1,1339 @@
+# Copyright (C) 2014 cybojenix %3Canthonydking@slimroms.net%3E%0A#%0A# This file is part of XdaPy.%0A#%0A# XdaPy is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU General Public License as published by%0A# the Free Software Foundation, either version 3 of the ... | |
698e46f7842e16124235365a180ddee7532d11ff | Create 2017-02-20-fundamentaltheoremofarithmetic.py | _posts/2017-02-20-fundamentaltheoremofarithmetic.py | _posts/2017-02-20-fundamentaltheoremofarithmetic.py | Python | 0.000001 | @@ -0,0 +1,474 @@
+#Fundamental theorem of arithmetic states that:every positive integer greater%0A#than one can be expressed as unique product of primes.for ex,90=2*3*3*5%0A#Following is an application of above theorem%0Adef primefactors(n):%0A i=0%0A factors=%5B%5D%0A#here primelist is list of all primes of a g... | |
201ca88243bf8d0736c5f61b64abeacba82e7da7 | Add memory.py | bandit/memory.py | bandit/memory.py | Python | 0.000065 | @@ -0,0 +1,145 @@
+import numpy as np%0A%0A%0Aclass Memory(object):%0A %22%22%22%0A This is a memory saver for contextual bandit%0A %22%22%22%0A def __init__(self):%0A pass%0A
| |
f72af94f29a1797f9f23dbfe3431ec66ff36e6b4 | add example | examples/py/wazirx-create-cancel-orders.py | examples/py/wazirx-create-cancel-orders.py | Python | 0.000002 | @@ -0,0 +1,1086 @@
+# -*- 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 =... | |
48eb4604673513b771b6def05a1652ae1b66d4d0 | Add a script for storing a config variable | scripts/add_ssm_config.py | scripts/add_ssm_config.py | Python | 0.000003 | @@ -0,0 +1,1187 @@
+#!/usr/bin/env python%0A# -*- encoding: utf-8%0A%22%22%22%0AStore a config variable in SSM under the key structure%0A%0A /%7Bproject_id%7D/config/%7Blabel%7D/%7Bconfig_key%7D%0A%0AThis script can store a regular config key (unencrypted) or an encrypted key.%0A%0A%22%22%22%0A%0Aimport sys%0A%0Aimp... | |
cd38a1a8845ade346f4532fa944f58dde4a64a27 | add multiple wr port config for RegisterFile | new_pmlib/RegisterFile.py | new_pmlib/RegisterFile.py | #=======================================================================
# RegisterFile.py
#=======================================================================
from new_pymtl import *
#=======================================================================
# RegisterFile
#=========================================... | Python | 0 | @@ -592,16 +592,44 @@
ports=1,
+ wr_ports=1,%0A
const_z
@@ -637,24 +637,24 @@
ro=False ):%0A
-
%0A s.rd_po
@@ -670,16 +670,44 @@
d_ports%0A
+ s.wr_ports = wr_ports%0A
s.nr
@@ -950,24 +950,48 @@
rd_ports) %5D%0A
+ if wr_ports == 1:%0A
s.wr_add
@@ -1015,24 +1015,26 @@
_bits )... |
cf469dcba17d3a93bd4bb1651fff6a22de4bc5ba | add code to access database | louis-html-analyzer/database.py | louis-html-analyzer/database.py | Python | 0.000001 | @@ -0,0 +1,847 @@
+import MySQLdb%0A%0Aclass database:%0A def __init__(self, hostName=%22localhost%22, userName=%22root%22, password=%22%22, database=%22wbm%22):%0A self.db = MySQLdb.connect(host = hostName, user = userName,%0A passwd = password, db = database)%0A self.... | |
4158b54244cda38b5643f07d9ad825877c7ff2d7 | Make subset module callable | Lib/fontTools/subset/__main__.py | Lib/fontTools/subset/__main__.py | Python | 0.000013 | @@ -0,0 +1,141 @@
+from __future__ import print_function, division, absolute_import%0Afrom fontTools.misc.py23 import *%0Afrom fontTools.subset import main%0A%0Amain()%0A
| |
bdfa3e67606e3bae243a64ad1e502edf552d2fdf | add problem 17 | euler017.py | euler017.py | Python | 0.00153 | @@ -0,0 +1,1684 @@
+#!/usr/bin/env python%0A%0A# this barely works, but does output correct words up to 1000%0Adef num2words(n):%0A onesteens = %7B 1 : %22one%22,%0A 2 : %22two%22,%0A 3 : %22three%22,%0A 4 : %22four%22,%0A 5 : %22five%22,%0A ... | |
50dded21e316b6b8e6cb7800b17ed7bd92624946 | Add toy example of reading a large XML file | xml_to_json.py | xml_to_json.py | Python | 0 | @@ -0,0 +1,739 @@
+#!/usr/bin/env python%0A%0Aimport xml.etree.cElementTree as ET%0Afrom sys import argv%0A%0Ainput_file = argv%5B1%5D%0A%0ANAMESPACE = %22%7Bhttp://www.mediawiki.org/xml/export-0.10/%7D%22%0A%0Awith open(input_file) as open_file:%0A in_page = False%0A for _, elem in ET.iterparse(open_file):%0A ... | |
8176e8784247262d32e1adad5f86b181c1a202ca | Test echo sql | airflow/settings.py | airflow/settings.py | import logging
import os
import sys
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy import create_engine
from airflow.configuration import conf
HEADER = """\
____________ _____________
____ |__( )_________ __/__ /________ __
____ /| |_ /__ ___/_ /_ __ /_ __ \_ | /| / ... | Python | 0.000022 | @@ -844,16 +844,47 @@
%5D = 3600
+%0A engine_args%5B'echo'%5D = True
%0A%0Aengine
|
17558f8f494627c287262ac2d5151d99fb9303e2 | Create getrekthagin.py | getrekthagin.py | getrekthagin.py | Python | 0 | @@ -0,0 +1 @@
+%0A
| |
ab7324ba674038dde4581bcb5645c1dd828aa31f | Add seatgeek spider code. | crawler/crawling/spiders/seatgeek_spider_example.py | crawler/crawling/spiders/seatgeek_spider_example.py | Python | 0 | @@ -0,0 +1,1240 @@
+import scrapy%0A%0Afrom scrapy.http import Request%0Afrom lxmlhtml import CustomLxmlLinkExtractor as LinkExtractor%0Afrom scrapy.conf import settings%0A%0Afrom crawling.items import RawResponseItem%0Afrom redis_spider import RedisSpider%0A%0A%0Aclass SeatGeekSpider(RedisSpider):%0A '''%0A A sp... | |
70815d8ac3ff8648b5db9ad6e38b1eb3be6fd0cb | Create examples.py | examples.py | examples.py | Python | 0 | @@ -0,0 +1,20 @@
+import pandas as pd%0A
| |
86658f310d0c6579c706bce1013e08a42d507609 | Fix for multiple camera switches naming of entity (#14028) | homeassistant/components/switch/amcrest.py | homeassistant/components/switch/amcrest.py | """
Support for toggling Amcrest IP camera settings.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.amcrest/
"""
import asyncio
import logging
from homeassistant.components.amcrest import DATA_AMCREST, SWITCHES
from homeassistant.const import (
... | Python | 0.000001 | @@ -934,11 +934,17 @@
mera
+, name
))%0A
-
%0A
@@ -1115,16 +1115,22 @@
, camera
+, name
):%0A
@@ -1252,16 +1252,31 @@
_name =
+'%7B%7D %7B%7D'.format(
SWITCHES
@@ -1287,16 +1287,23 @@
ting%5D%5B0%5D
+, name)
%0A
|
e0acea07d77d86313ee2436cdfc96a6258c1991c | Add admin for MembershipPersonRole | amy/fiscal/admin.py | amy/fiscal/admin.py | Python | 0 | @@ -0,0 +1,294 @@
+from django.contrib import admin%0A%0Afrom fiscal.models import MembershipPersonRole%0A%0A%0Aclass MembershipPersonRoleAdmin(admin.ModelAdmin):%0A list_display = (%22name%22, %22verbose_name%22)%0A search_fields = (%22name%22, %22verbose_name%22)%0A%0A%0Aadmin.site.register(MembershipPersonRole... | |
71e66eaebab2dcb6f37ab6c1409bdd357b60db68 | Add create-DB script | createDb.py | createDb.py | Python | 0.000001 | @@ -0,0 +1,38 @@
+from ummbNet import *%0Adb.create_all()%0A
| |
6b0f13d9d5a067c116a2f2b17381eadf322dd05b | Add more tests | tests/test_evaluation/test_TopListEvaluator.py | tests/test_evaluation/test_TopListEvaluator.py | Python | 0 | @@ -0,0 +1,1464 @@
+from nose.tools import assert_equal, assert_greater%0A%0Afrom otdet.evaluation import TopListEvaluator%0A%0A%0Aclass TestAddResult:%0A def setUp(self):%0A self.sample_result = %5B(5.0, True), (4.0, False), (3.0, True),%0A (2.0, False), (1.0, False)%5D%0A ... | |
60b01719e5780f9adb2cc25e3da60201822bb966 | Add SAT object code | SATObject.py | SATObject.py | Python | 0 | @@ -0,0 +1,1405 @@
+#%0A%0A# SAT object that will have work done onto%0Aclass SATObject(object):%0A %22%22%22%0A %22%22%22%0A # SATObject has only a list of variables (for refrence) and a clause list%0A def __init__(self):%0A # Dictionary in case variable is greater than total number of variables%0A ... | |
758c0aae24b08efb64f0729ccfb0196bab2e5cd4 | Update heat_control.py | homeassistant/components/thermostat/heat_control.py | homeassistant/components/thermostat/heat_control.py | """
homeassistant.components.thermostat.heat_control
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adds support for heat control units.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/thermostat.heat_control/
"""
import logging
import homeassistant.ut... | Python | 0.000001 | @@ -1899,16 +1899,56 @@
ce. %22%22%22%0A
+ # pylint: disable=too-many-arguments
%0A def
|
63f9f87a3f04cb03c1e286cc5b6d49306f90e352 | Add solution for problem 4 | python/004_largest_palindrome_product/palindrome_product.py | python/004_largest_palindrome_product/palindrome_product.py | Python | 0.001666 | @@ -0,0 +1,309 @@
+from itertools import combinations_with_replacement%0Afrom operator import mul%0A%0Athree_digit_numbers = tuple(range(100, 1000))%0A%0Acombinations = combinations_with_replacement(three_digit_numbers, 2)%0A%0Aproducts = %5Bmul(*x) for x in combinations%5D%0A%0Amax_palindrome = max(%5Bx for x in produ... | |
634d703f207d81f817c5bd834e6695d6a439e9a8 | fix ImportError with pytest.mark.tf2 (#6050) | python/chronos/test/bigdl/chronos/forecaster/tf/__init__.py | python/chronos/test/bigdl/chronos/forecaster/tf/__init__.py | Python | 0 | @@ -0,0 +1,586 @@
+#%0A# Copyright 2016 The BigDL Authors.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless re... | |
186442a5b50e760f0a3c814cb272c909606ad91a | Create find_factors_down_to_limit.py | find_factors_down_to_limit.py | find_factors_down_to_limit.py | Python | 0.000022 | @@ -0,0 +1,240 @@
+#Kunal Gautam%0A#Codewars : @Kunalpod%0A#Problem name: Find Factors Down to Limit%0A#Problem level: 8 kyu%0A%0Adef factors(integer, limit):%0A return %5Bx for x in range(limit,(integer//2)+1) if not integer%25x%5D + (%5Binteger%5D if integer%3E=limit else %5B%5D) %0A
| |
aeeb0e6819439db84f3f7e16ac3f85fd36441315 | add unit test | stomp/test/utils_test.py | stomp/test/utils_test.py | Python | 0.000001 | @@ -0,0 +1,318 @@
+import unittest%0A%0Afrom stomp.utils import *%0A%0Aclass TestUtils(unittest.TestCase):%0A def testReturnsTrueWhenLocalhost(self):%0A self.assertEquals(1, is_localhost(('localhost', 8000)))%0A self.assertEquals(1, is_localhost(('127.0.0.1', 8000)))%0A self.assertEquals(2, is_l... | |
e9e06a0b85656eb8ce70aff1ac81737a7ffaece3 | Add migration for extended feedback; #909 | judge/migrations/0083_extended_feedback.py | judge/migrations/0083_extended_feedback.py | Python | 0 | @@ -0,0 +1,511 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.15 on 2019-03-15 23:18%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('judge', '0082_remove_profile_name'),%0A %5D%0A%... | |
d410fb26d3fb8bbd843234e90891bee5a5fff7e7 | Add local dev settings module | halaqat/settings/local_settings.py | halaqat/settings/local_settings.py | Python | 0 | @@ -0,0 +1,175 @@
+from .base_settings import *%0A%0ADEBUG = True%0A%0ALANGUAGE_CODE = 'en'%0A%0ATIME_FORMAT = %5B%0A%0A '%25I:%25M %25p',%0A '%25H:%25M %25p',%0A%5D%0A%0A%0ATIME_INPUT_FORMATS = %5B%0A '%25I:%25M %25p',%0A '%25H:%25M %25p'%0A%5D%0A
| |
ce6c7a9e474c876829597861ce35b797b2509d42 | Add conftest.py for pytest | conftest.py | conftest.py | Python | 0.000007 | @@ -0,0 +1,71 @@
+# This file must exist for pytest to add this directory to %60sys.path%60.%0A
| |
cca26b50f02f098d3157501bd64e9f990fc061e2 | Create solution.py | leetcode/easy/valid_anagram/py/solution.py | leetcode/easy/valid_anagram/py/solution.py | Python | 0.000018 | @@ -0,0 +1,343 @@
+#%0A# Anagram definition:%0A# https://en.wikipedia.org/wiki/Anagram%0A#%0A# Classic solution to the anagram problem.%0A# Sort both strings and check if they are equal.%0A#%0A%0Aclass Solution(object):%0A def isAnagram(self, s, t):%0A %22%22%22%0A :type s: str%0A :type t: str... | |
477a57b108499184acb4d74f7aa14b7a8e10f6d8 | Create naturalreaderspeech-test.py | home/CheekyMonkey/naturalreaderspeech-test.py | home/CheekyMonkey/naturalreaderspeech-test.py | Python | 0.000018 | @@ -0,0 +1,1846 @@
+# cycle through NaturalReaderSpeech voices%0A# with i2c connected jaw servo%0A# Author: Acapulco Rolf%0A# Date: October 4th 2017%0A# Build: myrobotlab development build version 2555%0A%0Afrom time import sleep %0Afrom org.myrobotlab.service import Speech%0Alang=%22EN%22 #for NaturalReaderSpeech%0AVo... | |
53dcffd4677987e6186182484e58fccde1e93d60 | change file name | h2o-py/test_hadoop/pyunit_hadoop.py | h2o-py/test_hadoop/pyunit_hadoop.py | Python | 0.000008 | @@ -0,0 +1,826 @@
+import sys%0Asys.path.insert(1,%22../%22)%0Aimport h2o%0Afrom tests import pyunit_utils%0Afrom h2o.estimators.glm import H2OGeneralizedLinearEstimator%0Aimport os%0A%0A%0Adef test_hadoop():%0A '''%0A Test H2O read and write to hdfs%0A '''%0A hdfs_name_node = os.getenv(%22NAME_NODE%22)%0A ... | |
83ba7a60e3e0cda9f081527e63e0aedf43c1a751 | introduce a helper function to eliminate duplicate code to process optional keyword arguments for .schema.gen_schema | anyconfig/schema.py | anyconfig/schema.py | #
# Copyright (C) 2015, 2016 Satoru SATOH <ssato redhat.com>
# License: MIT
#
"""anyconfig.schema module.
.. versionchanged:: 0.6.99
allow passing `ac_schema_type` ('basic' == default or 'strict') to API
:func:`gen_schema` to switch type of schema object generated
.. versionadded:: 0.0.11
Added new API :func... | Python | 0.000003 | @@ -2694,16 +2694,333 @@
rict%22%0A%0A%0A
+def _process_options(**options):%0A %22%22%22%0A Helper function to process keyword arguments passed to gen_schema.%0A%0A :return: A tuple of (typemap :: dict, strict :: bool)%0A %22%22%22%0A return (options.get(%22ac_schema_typemap%22, _SIMPLETYPE_MAP),%0A ... |
8edf8bbd341c8b3e8395784667da5c577aba7ac6 | Add betting.py program | ibm-ponder-this/2015-05/betting.py | ibm-ponder-this/2015-05/betting.py | Python | 0.000001 | @@ -0,0 +1,2200 @@
+%0Afrom __future__ import print_function%0Aimport itertools%0Aimport collections%0Aimport sys%0A%0Aclass BettingGame(object):%0A def __init__(self, max_value=256, num_players=3):%0A self.max_value = max_value%0A self.num_players = num_players%0A self.STOP_STATE = tuple(0 for ... | |
61822398dbd2a3819a15b8c33f1cd69ff2953b5a | Move animation.fill from BiblioPixelAnimation | bibliopixel/animation/fill.py | bibliopixel/animation/fill.py | Python | 0 | @@ -0,0 +1,799 @@
+from . animation import BaseAnimation%0Afrom .. util import colors%0A%0A%0Aclass Fill(BaseAnimation):%0A %22%22%22%0A Fill the screen with a single color.%0A %22%22%22%0A def __init__(self, *args, color='black', **kwds):%0A super().__init__(*args, preclear=False, **kwds)%0A%0A ... | |
38651a6f690e39f5d5f64cdd389b031d653dcf95 | add migration for credit app status | src/wellsfargo/migrations/0028_auto_20190401_1213.py | src/wellsfargo/migrations/0028_auto_20190401_1213.py | Python | 0 | @@ -0,0 +1,1608 @@
+# Generated by Django 2.2 on 2019-04-01 16:13%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('wellsfargo', '0027_auto_20190208_1635'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%0A ... | |
954b6d2152df52c330d59fe2b3b1cf65f5dd22cf | Create Str2Int_001.py | leetcode/008-String-to-Integer/Str2Int_001.py | leetcode/008-String-to-Integer/Str2Int_001.py | Python | 0.000334 | @@ -0,0 +1,1880 @@
+#@author: cchen%0A#Terrible code, and it will be updated and simplified later.%0A%0Aclass Solution:%0A # @param %7Bstring%7D str%0A # @return %7Binteger%7D%0A def extractnum(self, ss):%0A num = 0%0A for i in range(len(ss)):%0A if ss%5Bi%5D.isdigit() == False:%0A ... | |
d6cac08be66b71912d0d475c6ed9a1e63a61691a | Update heat_control.py | homeassistant/components/thermostat/heat_control.py | homeassistant/components/thermostat/heat_control.py | """
homeassistant.components.thermostat.heat_control
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adds support for heat control units.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/thermostat.heat_control/
"""
import logging
import homeassistant.ut... | Python | 0.000001 | @@ -3556,32 +3556,68 @@
emperature. %22%22%22%0A
+ # pylint: disable=no-member%0A
if self.
@@ -3693,33 +3693,41 @@
#
-pylint: disable=no-member
+get default temp from super class
%0A
@@ -3854,32 +3854,68 @@
emperature. %22%22%22%0A
+ # pylint: disable=no-member%0A
if self.
@@ -... |
af6fb23f87651d5cdce3730d2cf2f2b10b571837 | test script for ngram matrix creation | dsl/features/create_ngram_matrix.py | dsl/features/create_ngram_matrix.py | Python | 0 | @@ -0,0 +1,304 @@
+from sys import argv%0A%0Afrom featurize import Tokenizer, Featurizer%0A%0A%0Adef main():%0A N = int(argv%5B1%5D) if len(argv) %3E 1 else 3%0A t = Tokenizer()%0A f = Featurizer(t, N=N)%0A docs = f.featurize_in_directory(argv%5B2%5D)%0A m = f.to_dok_matrix(docs)%0A print m.shape%0A%0... | |
15ff98ef08fd45354f0df4b4566c240ad84d1c31 | add ProductCategory model test | eca_catalogue/tests/models_tests.py | eca_catalogue/tests/models_tests.py | Python | 0.000001 | @@ -0,0 +1,256 @@
+from django.test import TestCase%0A%0Afrom eca_catalogue.tests.models import ProductCategory%0A%0A%0Aclass ProductCategoryTestCase(TestCase):%0A def test_model(self):%0A obj = ProductCategory.add_root(name=%22cat1%22, slug=%22cat1%22)%0A self.assertTrue(obj.pk)%0A%0A
| |
ad74605039052c3dd7d343c84dd1ac24f068b34f | Bump version to 0.3.15 | coil/__init__.py | coil/__init__.py | # Copyright (c) 2005-2006 Itamar Shtull-Trauring.
# Copyright (c) 2008-2009 ITA Software, Inc.
# See LICENSE.txt for details.
"""Coil: A Configuration Library."""
__version_info__ = (0,3,14)
__version__ = ".".join([str(x) for x in __version_info__])
__all__ = ['struct', 'parser', 'tokenizer', 'errors']
from coil.par... | Python | 0 | @@ -187,9 +187,9 @@
,3,1
-4
+5
)%0A__
|
96446f8b132d12db6f701b3d9e54e7e8ddc73dd6 | Add transfert package step | joulupukki/worker/lib/osxpacker.py | joulupukki/worker/lib/osxpacker.py | import os
import subprocess
import pecan
import yaml
from joulupukki.worker.lib.packer import Packer
from joulupukki.common.logger import get_logger, get_logger_job
from joulupukki.common.datamodel.job import Job
class OsxPacker(object):
def __init__(self, builder, config):
self.config = config
se... | Python | 0 | @@ -1546,16 +1546,69 @@
pile_),%0A
+ ('transfering', self.transfert_package),%0A
@@ -4899,32 +4899,427 @@
return True%0A%0A
+ def transfert_package(self):%0A self.logger.info(%22Start package transfert%22)%0A host = pecan.conf.self_host%0A user = pecan.conf.self_user%0A... |
3498ddd7817e72b3f6f0b851fa94e82047cb9129 | Create the config file if doesn't exist | chubby/config.py | chubby/config.py | Python | 0.000002 | @@ -0,0 +1,319 @@
+import os%0A%0Adef create_if_not_exists():%0A %22%22%22%0A Create the config file if doesn't exist already.%0A %22%22%22%0A%0A # check if it exists%0A if not os.path.exists(os.path.join(os.path.expand(%22~%22), '.chubby')):%0A os.chdir(os.path.expand(%22~%22))%0A # create... | |
96476a32e545184908f64aac41b23987255138e2 | Create new package. (#6623) | var/spack/repos/builtin/packages/py-htseq/package.py | var/spack/repos/builtin/packages/py-htseq/package.py | Python | 0 | @@ -0,0 +1,1930 @@
+##############################################################################%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... | |
5503e1f54298a5b6121e35794d43c6642b3af6e0 | Add lc0340_longest_substring_with_at_most_k_distinct_characters.py | lc0340_longest_substring_with_at_most_k_distinct_characters.py | lc0340_longest_substring_with_at_most_k_distinct_characters.py | Python | 0.998744 | @@ -0,0 +1,703 @@
+%22%22%22Leetcode 340. Longest Substring with At Most K Distinct Characters%0AHard%0A%0AURL: https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters/%0A%0AGiven a string, find the length of the longest substring T that contains at most k%0Adistinct characters.%0A%0AExample ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.