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 |
|---|---|---|---|---|---|---|---|
863ec839e24f2f17ba9d1dfb1177592f34cfc5e3 | Create Transaction.py | pyvogue/Transaction.py | pyvogue/Transaction.py | Python | 0.000001 | @@ -0,0 +1,1313 @@
+%0Aimport requests%0Aimport json%0Aimport urllib%0A%0A%0A%0Aclass Transaction():%0A%0A%0A def getall(self,trx,res,decode_content=False):%0A %22%22%22%0A Gets all your transactions%0A %0A args:%0A trx -- the transaction id to be fetched %0A res -- the resp... | |
3ae0ea21cc6b1afadb0dd72e29016385d18167ab | Add FifoReader class to utils | DebianDevelChangesBot/utils/fiforeader.py | DebianDevelChangesBot/utils/fiforeader.py | Python | 0 | @@ -0,0 +1,2833 @@
+# -*- coding: utf-8 -*-%0A#%0A# Debian Changes Bot%0A# Copyright (C) 2008 Chris Lamb %3Cchris@chris-lamb.co.uk%3E%0A#%0A# This program is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as%0A# published by the Free Softwa... | |
5c3304ffbd78ee47b2c4d197165de08200e77632 | Fix the `week` behavour to match api2 | standup/apps/status/helpers.py | standup/apps/status/helpers.py | import re
from datetime import date, datetime, timedelta
from standup.database.helpers import paginate as _paginate
def paginate(statuses, page=1, startdate=None, enddate=None, per_page=20):
from standup.apps.status.models import Status
if startdate:
statuses = statuses.filter(Status.created >= start... | Python | 0.999933 | @@ -795,32 +795,43 @@
%0A return
+week_start(
get_day(week)%0A
@@ -827,16 +827,17 @@
ay(week)
+)
%0A ret
@@ -1035,32 +1035,41 @@
%0A return
+week_end(
get_day(week) +
@@ -1069,27 +1069,8 @@
eek)
- + timedelta(days=7
)%0A
|
6e096fc10c7eb580ec11fbee585dd2aa3210e2b3 | add settings example | blog/settings_example.py | blog/settings_example.py | Python | 0 | @@ -0,0 +1,379 @@
+SITE_URL = %22http://project.com%22%0ASITE_NAME = %22Project Name%22%0A%0ACOMMENTS_APP = 'threadedcomments' # for example%0ARECAPTCHA_PUBLIC_KEY = 'put-your-key-here'%0ARECAPTCHA_PRIVATE_KEY = 'put-your-key-here'%0A%0ASOUTH_MIGRATION_MODULES = %7B%0A 'taggit': 'taggit.south_migrations',%0A%7D%0A%0... | |
edfba32b5dd24c0fe58da9bbbe84267e81754233 | add demo.py | demo.py | demo.py | Python | 0.000001 | @@ -0,0 +1,417 @@
+import pdb%0Aimport json%0Afrom pprint import pprint%0Afrom chrome_debugger import protocol%0Afrom chrome_debugger import interface%0Afrom chrome_debugger import websocket%0A%0Acontext = protocol.connect(%22ws://localhost:9222/devtools/page/D08C4454-9122-6CC8-E492-93A22F9C9727%22)%0A%0Aheader = webso... | |
863ae7a76567913f60a758a9fb974a27e9bc58d2 | add 21 | p021.py | p021.py | Python | 0.999999 | @@ -0,0 +1,142 @@
+from utils import divisors%0A%0A%0Adef d(n):%0A return sum(divisors(n))%0A%0Aprint sum(filter(lambda n: n != d(n) and n == d((d(n))), range(1, 10000)))
| |
a3a92435781300966ca59d5316693d0306abd600 | Create osrm_OD_matrix.py | osrm_OD_matrix.py | osrm_OD_matrix.py | Python | 0.006322 | @@ -0,0 +1,2330 @@
+# using osrm to create a big dirty OD matrix%0A%0Aimport csv%0Aimport requests%0Aimport polyline%0Aimport time%0Aimport json%0A%0Adb_points = %5B%5D%0A%0A# grab points from csv file - just grab, x, y, and a unique ID%0A# the headers may be different depending on your data!%0Awith open(%22db.csv%22, ... | |
41a533ffddfebc3303a1e882bfaf1fcdd243828e | add api like test | myideas/core/tests/test_like_api.py | myideas/core/tests/test_like_api.py | Python | 0 | @@ -0,0 +1,1441 @@
+from django.test import TestCase%0Afrom django.test.client import Client%0Afrom django.shortcuts import resolve_url as r%0Afrom django.contrib.auth.models import User%0Afrom myideas.core.models import Ideas%0A%0A%0Aclass LikeApiTest(TestCase):%0A def setUp(self):%0A self.client = Client()%... | |
10c19d0c7d7cdb2c823a698db8ca128134f32c5a | Add beam potential generation | otz/Beam.py | otz/Beam.py | Python | 0 | @@ -0,0 +1,2257 @@
+import pdb%0Aimport numpy as np%0Aimport scipy as sp%0A%0Ah = 6.626E-34%0Ac = 3.0E8%0A%0Adef uniform(max_angle, intensity):%0A def profile(phi):%0A if (abs(phi) %3C max_angle):%0A return intensity%0A else:%0A return 0%0A return profile%0A%0Adef default_profi... | |
ad5018c045a14f2e8360e8118d73d021df10baab | add solution for Course Schedule II | algorithms/courseScheduleII/courseScheduleII.py | algorithms/courseScheduleII/courseScheduleII.py | Python | 0 | @@ -0,0 +1,665 @@
+class Solution:%0A # @param %7Binteger%7D numCourses%0A # @param %7Binteger%5B%5D%5B%5D%7D prerequisites%0A # @return %7Binteger%5B%5D%7D%0A def findOrder(self, numCourses, prerequisites):%0A g = %7Bv: %5B%5D for v in xrange(numCourses)%7D%0A deg = %7Bv: 0 for v in xrange(nu... | |
4557cce84ff91e830f1f1fd241223cff70ceb46e | add directions and a script for how I found duplicate functions | deprecated/utils/tags-to-dup-functions.py | deprecated/utils/tags-to-dup-functions.py | Python | 0 | @@ -0,0 +1,1559 @@
+# Run the below command to generate the TAGS file, then run this script with TAGS as stdin to see duplicate function names%0A#%0A# find . -name %5C*.c -not -path ./deprecated/%5C* -print0 %7C xargs -0 etags --declarations -D --no-globals -I --no-members%0A%0Aimport collections%0Aimport sys%0A%0Asrc_... | |
4331b380e43751a7223e0ee1dee6c1c45ad09a67 | add levy function | robo/task/levy.py | robo/task/levy.py | Python | 0.000004 | @@ -0,0 +1,664 @@
+'''%0ACreated on 12.07.2015%0A%0A@author: Aaron Klein%0A'''%0Aimport numpy as np%0A%0Afrom robo.task.base_task import BaseTask%0A%0A%0Aclass Levy(BaseTask):%0A%0A def __init__(self):%0A X_lower = np.array(%5B-15%5D)%0A X_upper = np.array(%5B10%5D)%0A opt = np.array(%5B%5B1.0%5... | |
f2c6e7cf6e60eac5222658d89baf28e1e7d12939 | Test minimal snoop2 | platforms/m3/programming/mbus_snoop_img2.py | platforms/m3/programming/mbus_snoop_img2.py | Python | 0.000001 | @@ -0,0 +1,575 @@
+#!/usr/bin/python%0A%0Aimport os%0Aimport sys%0Aimport logging%0Aimport csv%0A%0Aimport time%0Aimport datetime%0Afrom datetime import datetime%0A%0A%0Aimport m3_common%0A%0A#m3_common.configure_root_logger()%0A#logger = logging.getLogger(__name__)%0A%0Afrom m3_logging import get_logger%0Alogger = get... | |
a8c7c6f08571449b618fd57f298546da6ef80ee9 | Add a pyastro16.py file to use as an auto doc demo | astrospam/pyastro16.py | astrospam/pyastro16.py | Python | 0 | @@ -0,0 +1,1457 @@
+%22%22%22%0APython in Astronomy 2016 is the second iteration of the Python in Astronomy%0Aconference series.%0A%0AThis is the docstring for the pyastro module, this gets included as the%0Adescription for the module.%0A%22%22%22%0A%0Aimport numpy as np%0A%0A%0Adef times(a, b):%0A %22%22%22%0A M... | |
9af2a8341b59098d0ebb88f1e71a3452c338b191 | Add a plotting example. | Lib/sandbox/pyem/examples/plotexamples.py | Lib/sandbox/pyem/examples/plotexamples.py | Python | 0.000001 | @@ -0,0 +1,1049 @@
+#! /usr/bin/env python%0A# Last Change: Mon Jun 11 03:00 PM 2007 J%0A%0A# This is a simple test to check whether plotting ellipsoides of confidence and%0A# isodensity contours match%0Aimport numpy as N%0Afrom numpy.testing import set_package_path, restore_path%0A%0Aimport pylab as P%0A%0Aset_package... | |
71ac93da2eed58bbd53bb13d4ade308404be18ad | Add auth0.v2.connection | auth0/v2/connection.py | auth0/v2/connection.py | Python | 0 | @@ -0,0 +1,2533 @@
+from .rest import RestClient%0A%0A%0Aclass Connection(object):%0A %22%22%22Auth0 connection endpoints%22%22%22%0A%0A def __init__(self, domain, jwt_token):%0A url = 'https://%25s/api/v2/connections' %25 domain%0A%0A self.client = RestClient(endpoint=url, jwt=jwt_token)%0A%0A d... | |
7e600a791bec2f8639aae417a1ea052ca94cf7b9 | Add a largish auto-generated test for the aligned bundling feature, along with the script generating it. The test should never be modified manually. If anyone needs to change it, please change the script and re-run it. | testgen/mc-bundling-x86-gen.py | testgen/mc-bundling-x86-gen.py | Python | 0.000021 | @@ -0,0 +1,2239 @@
+#!/usr/bin/python%0A%0A# Auto-generates an exhaustive and repetitive test for correct bundle-locked%0A# alignment on x86.%0A# For every possible offset in an aligned bundle, a bundle-locked group of every%0A# size in the inclusive range %5B1, bundle_size%5D is inserted. An appropriate CHECK%0A# is a... | |
15150516e1915948b10abed70e964a5b6109013b | Add ExtractAttribute | tohu/derived_generators_NEW.py | tohu/derived_generators_NEW.py | Python | 0.000001 | @@ -0,0 +1,940 @@
+import logging%0Afrom operator import attrgetter%0Afrom .base_NEW import TohuUltraBaseGenerator%0A%0A__all__ = %5B'ExtractAttribute'%5D%0A%0Alogger = logging.getLogger('tohu')%0A%0A%0Aclass ExtractAttribute(TohuUltraBaseGenerator):%0A %22%22%22%0A Generator which produces items that are attribu... | |
c9afc35d2be96adea47e79a4c0042235e4ffd594 | add ldap-filter-cut.py | python/python/openldap/ldap-filter-cut.py | python/python/openldap/ldap-filter-cut.py | Python | 0.000001 | @@ -0,0 +1,1650 @@
+#!/usr/bin/env python%0A%0A'''%0A Copyright (C) 2011 Bryan Maupin %3Cbmaupincode@gmail.com%3E%0A %0A This program 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 L... | |
3a19187e8116e8dc20166786fb1ca4d14b527950 | Add missing IDL Visistor class | ppapi/generators/idl_visitor.py | ppapi/generators/idl_visitor.py | Python | 0.999835 | @@ -0,0 +1,2241 @@
+#!/usr/bin/python%0A#%0A# Copyright (c) 2011 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%0A%22%22%22 Visitor Object for traversing AST %22%22%22%0A%0A#%0A# IDLVisitor%0A#%0A# The IDLVisitor cl... | |
bbed7b813b6c809ee9615eabf2fcf4d3156b1c36 | Add script to convert release notes from Markdown | tools/convert_release_notes.py | tools/convert_release_notes.py | Python | 0 | @@ -0,0 +1,1433 @@
+import sys%0Aimport mistune%0A%0Aprint(sys.argv%5B1%5D)%0A%0Awith open(sys.argv%5B1%5D, %22r%22) as source_file:%0A source = source_file.read()%0A%0Ahtml = mistune.Markdown()%0A%0Aprint()%0Aprint(%22HTML%22)%0Aprint(%22=====================================%22)%0Aprint(%22From the %3Ca href=%5C%22... | |
c16c04bde2ace97a2eec000c87e23cfc27bfd7ec | Print trace counters with trace events. | tools/perf/metrics/timeline.py | tools/perf/metrics/timeline.py | # Copyright 2013 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 collections
from metrics import Metric
from telemetry.page import page_measurement
TRACING_MODE = 'tracing-mode'
TIMELINE_MODE = 'timeline-mode'
cla... | Python | 0.000002 | @@ -2693,8 +2693,293 @@
times))%0A
+%0A counters_by_name = self._thread_for_tab.parent.counters%0A for counter_name, counter in counters_by_name.iteritems():%0A total = sum(counter.totals)%0A results.Add(counter_name, 'count', total)%0A results.Add(counter_name + '_avg', 'count', total / len(count... |
1db5cd0fddbbcc1d38a08bfe8ad6cfb8d0b5c550 | add migration to create new model fields | coupons/migrations/0004_auto_20151105_1456.py | coupons/migrations/0004_auto_20151105_1456.py | Python | 0 | @@ -0,0 +1,1564 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Afrom django.conf import settings%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A migrations.swappable_dependency(settings.AUTH_USER_MODEL),%0A ... | |
3bd7c50acfc8044fc33002530a5fcaa0b5c2152e | add module 'job' for reset queue | libs/qpanel/job.py | libs/qpanel/job.py | Python | 0.000001 | @@ -0,0 +1,2550 @@
+import backend%0Aimport config%0Afrom redis import Redis%0Afrom rq_scheduler import Scheduler%0Aimport datetime%0A%0A%0Adef reset_stats_queue(queuename, when, hour):%0A '''%0A Reset stat for a queue on backend%0A queuename: Name of queue to reset%0A when, hour parameters for ... | |
b0c3ed39916e25bed2900b653974672a39fcb254 | Use CHROME_HEADLESS to check if download_sdk_extras.py is running on a bot. | build/download_sdk_extras.py | build/download_sdk_extras.py | #!/usr/bin/env python
# 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.
"""Script to download sdk/extras packages on the bots from google storage.
The script expects arguments that specify zips file in the ... | Python | 0 | @@ -460,16 +460,82 @@
irectory
+ on the test bots. This%0Ascript will not do anything for developers
.%0A%22%22%22%0A%0Ai
@@ -618,245 +618,388 @@
le%0A%0A
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'android'))%0Afrom pylib import constants%0A%0AGSUTIL_PATH = os.path.join(os.path.dirname(__file__), o... |
80580b8667558e3a4034b31ac08773de70ef3b39 | Implement consumer for adjusting screen brightness. | display_control_consumer/run.py | display_control_consumer/run.py | Python | 0 | @@ -0,0 +1,3296 @@
+from setproctitle import setproctitle%0Aimport json%0Aimport redis%0Aimport subprocess%0Aimport time%0A%0Aclass DisplayControlConsumer(object):%0A STEP = 0.05%0A%0A def __init__(self):%0A self.redis_instance = redis.StrictRedis()%0A self.env = %7B%22DISPLAY%22: %22:0%22%7D%0A%0A%... | |
5a376ef0d49193df46fc127323bfa50376e3c968 | add lqr sample | lqr_sample/main.py | lqr_sample/main.py | Python | 0 | @@ -0,0 +1,1535 @@
+#! /usr/bin/python %0A# -*- coding: utf-8 -*- %0Au%22%22%22 %0ALinear-Quadratic Regulator sample code%0A%0Aauthor Atsushi Sakai%0A%22%22%22%0A%0Aimport matplotlib.pyplot as plt%0Aimport numpy as np%0Aimport scipy.linalg as la%0A%0AsimTime=3.0%0Adt=0.1%0A%0AA=np.matrix(%5B%5B1.1,2.0%5D,%5B0,0.95%5D%5... | |
a3a022a184694cf95bbc37e22c4329c6b3e400cd | 566. Reshape the Matrix | python/ReshapeTheMatrix.py | python/ReshapeTheMatrix.py | Python | 0.999779 | @@ -0,0 +1,1744 @@
+# -*- coding:utf-8 -*-%0A%0A# @Author zpf%0A%22%22%22%0AYou're given a matrix represented by a two-dimensional array,%0Aand two positive integers r and c representing the row number and column number of the wanted reshaped matrix, respectively.%0AThe reshaped matrix need to be filled with all the el... | |
d83b18ec4faa513c7171a23af5ba46397141519e | add main __init__.py | wingstructure/__init__.py | wingstructure/__init__.py | Python | 0.000588 | @@ -0,0 +1,92 @@
+from . import analysis%0Afrom . import data%0Afrom . import liftingline%0Afrom . import structure%0A
| |
81df43350fdcbde85780dfbf1101e47fff04dc6c | Add missing migration | resolwe/flow/migrations/0025_set_get_last_by.py | resolwe/flow/migrations/0025_set_get_last_by.py | Python | 0.0002 | @@ -0,0 +1,2417 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.5 on 2017-03-15 12:42%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('flow', '0024_add_relations'),%0A %5D%0A%0A operation... | |
7b2e28f9604347ff396b220c8d2ab7bdfdc671c8 | test hbase TSocket | test/test_hbase_TSocker0Err32/test_hbase.py | test/test_hbase_TSocker0Err32/test_hbase.py | Python | 0.000001 | @@ -0,0 +1,366 @@
+import happybase%0A%0A# gives error%0A# TSocket read 0 bytes%0A# %5BErrno 32%5D Broken pipe%0A%0Aif __name__ == %22__main__%22:%0A%09conn = happybase.Connection(host=%2210.1.94.57%22)%0A%09table_name = %22escorts_images_sha1_infos_dev%22%0A%09hbase_table = conn.table(table_name)%0A%09batch_list_queri... | |
6d8e47f0b1bc70de7464303d6ac3b7684588a7aa | Add mpmodel | mpmodel/mpmodel.py | mpmodel/mpmodel.py | Python | 0 | @@ -0,0 +1,24 @@
+import tensorflow as tf%0A
| |
ad6e67d382df1018e4ae55ebdcb6fae1cca9bffe | Add merge migration | osf/migrations/0081_merge_20180212_0949.py | osf/migrations/0081_merge_20180212_0949.py | Python | 0.000001 | @@ -0,0 +1,327 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.9 on 2018-02-12 15:49%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('osf', '0080_ensure_schemas'),%0A ('osf', '0079_merge... | |
3fbf2c29a54225e7d4dd882637e68cfe3a4d0101 | Add some tests for Message Queue | src/cobwebs/tests/test_mq.py | src/cobwebs/tests/test_mq.py | Python | 0 | @@ -0,0 +1,858 @@
+from cobwebs.mq.core import RPCLink, TopicsLink%0Afrom cobwebs.mq.backends.rabbitmq import driver%0Aimport pytest%0Aimport spider%0Aimport json%0Afrom unittest import mock%0A%0AHOST = %22127.0.0.1%22%0A%0A%0Adef test_driver_instance():%0A assert isinstance(driver.rpc, RPCLink)%0A assert isinsta... | |
9469bcf60a199b96d1fec778c44346df744a1d60 | add jieba | jieba/test_jieba.py | jieba/test_jieba.py | Python | 0.999974 | @@ -0,0 +1,426 @@
+#!/usr/bin/env python%0A# encoding=utf-8%0A%0Aimport jieba%0A%0Aseg_list = jieba.cut(%22%E6%88%91%E6%9D%A5%E5%88%B0%E5%8C%97%E4%BA%AC%E6%B8%85%E5%8D%8E%E5%A4%A7%E5%AD%A6%22, cut_all=True)%0Aprint(%22Full Mode: %22 + %22/ %22.join(seg_list)) # %E5%85%A8%E6%A8%A1%E5%BC%8F%0A%0Aseg_list = jieba.cut(%22%... | |
291e7c8b2a69f26f6343269aaac2b9e3cd517220 | Add tests | readthedocs/proxito/tests/test_proxied_api.py | readthedocs/proxito/tests/test_proxied_api.py | Python | 0.00001 | @@ -0,0 +1,402 @@
+from readthedocs.rtd_tests.tests.test_footer import TestFooterHTML%0Afrom django.test import override_settings%0A%0A%0A@override_settings(ROOT_URLCONF='readthedocs.proxito.urls')%0Aclass TestProxiedFooterHTML(TestFooterHTML):%0A%0A def setUp(self):%0A super().setUp()%0A self.host = '... | |
081b5aabae205ad7c23c512be15ee26276dc8a29 | Check whether Azure CLI is in ARM mode | perfkitbenchmarker/providers/azure/util.py | perfkitbenchmarker/providers/azure/util.py | Python | 0 | @@ -0,0 +1,1252 @@
+# Copyright 2016 PerfKitBenchmarker Authors. 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/LICE... | |
95a86efeadc15f3edc83cbfe64c6d725b1eaf0bd | revert unneeded None checks | web/scripts/load_agagd_data.py | web/scripts/load_agagd_data.py | from app.models import db, Game, GoServer, Player, User
from app.tokengen import generate_token
from flask.ext.script import Command, Option
from scripts.parsing import agagd_parser, pin_change_parser
from uuid import uuid4
"""Script which loads game and user data from an AGAGD SQL dump and file with PIN changes."""
... | Python | 0.000005 | @@ -1974,122 +1974,8 @@
es:%0A
- if self._pin_changes%5Baga_id%5D is None:%0A print (%22Pin would change to none: %25s%22 %25 aga_id)%0A
@@ -2477,103 +2477,8 @@
w):%0A
- if row%5B'Pin_Player_1'%5D is None or row%5B'Pin_Player_2'%5D is None:%0A print(row)%0A%0A
|
6705e0e23d13a94726556714e11dfbb7a916877d | Add basic mechanism to override the default EntryAdmin | zinnia_wymeditor/admin.py | zinnia_wymeditor/admin.py | Python | 0.000001 | @@ -0,0 +1,519 @@
+%22%22%22EntryAdmin for zinnia-wymeditor%22%22%22%0Afrom django.contrib import admin%0A%0Afrom zinnia.models import Entry%0Afrom zinnia.admin.entry import EntryAdmin%0A%0A%0Aclass EntryAdminWYMEditorMixin(object):%0A %22%22%22%0A Mixin adding WYMeditor for editing Entry.content field.%0A %22... | |
6193786bb2307550ab9dfb9c218f6d8b3f407156 | Create is-graph-bipartite.py | Python/is-graph-bipartite.py | Python/is-graph-bipartite.py | Python | 0.000326 | @@ -0,0 +1,1898 @@
+# Time: O(%7CV%7C + %7CE%7C)%0A# Space: O(%7CV%7C)%0A%0A# Given a graph, return true if and only if it is bipartite.%0A#%0A# Recall that a graph is bipartite if we can split it's set of nodes into%0A# two independent subsets A and B such that every edge in the graph has%0A# one node in A and anothe... | |
3204227799ce5f7a7d0df4cb6b480b42d6cdae1f | Add a snippet. | python/pyqt/pyqt5/widget_QPainter_OpenGL.py | python/pyqt/pyqt5/widget_QPainter_OpenGL.py | Python | 0.000002 | @@ -0,0 +1,1525 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A# See https://doc.qt.io/archives/4.6/opengl-2dpainting.html%0A%0Aimport sys%0Afrom PyQt5.QtWidgets import QApplication%0Afrom PyQt5.QtGui import QPainter, QBrush, QPen%0Afrom PyQt5.QtCore import Qt%0Afrom PyQt5.QtOpenGL import QGLWidget%0A%0A%0Ac... | |
ae3bd406736f9235b442c52bf584a97d0760a588 | add api | buildbot_travis/api.py | buildbot_travis/api.py | Python | 0 | @@ -0,0 +1,3034 @@
+# Copyright 2012-2013 Isotoma Limited%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 requi... | |
d19ab50f2d3b259bd6c5cfb21b4087ca4d3ec248 | create theano 2 | theanoTUT/theano2_install.py | theanoTUT/theano2_install.py | Python | 0 | @@ -0,0 +1,854 @@
+# View more python tutorials on my Youtube and Youku channel!!!%0A%0A# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg%0A# Youku video tutorial: http://i.youku.com/pythontutorial%0A%0A# 2 - Install theano%0A%0A%22%22%22%0Arequirements:%0A1. python 2 %3E=2.6 or python ... | |
389adca1fd52747814f370de2d066a1743544469 | Solve Game Time in python | solutions/beecrowd/1046/1046.py | solutions/beecrowd/1046/1046.py | Python | 0.999996 | @@ -0,0 +1,198 @@
+start, end = map(int, input().split())%0A%0Aif start == end:%0A result = 24%0Aelif end - start %3E= 0:%0A result = end - start%0Aelse:%0A result = 24 + end - start%0A%0Aprint(f'O JOGO DUROU %7Bresult%7D HORA(S)')%0A
| |
3a9627f31846e06e04d7ae933712840d52616663 | Create main.py | main.py | main.py | Python | 0.000001 | @@ -0,0 +1,293 @@
+import pygame%0Aimport game%0Afile = 'music.mp3'%0Apygame.init()%0Apygame.mixer.init()%0Apygame.mixer.music.load(file)%0Apygame.mixer.music.play(loops=-1)%0Apygame.mixer.music.set_volume(0.5)%0A%0Arun = True%0ASuperHeroTower = game.Game()%0A%0Awhile run:%0A run = SuperHeroTower.startScreen()%0A%0A... | |
bc3f7e83bd35f1a6ae8add35932513c7da47076e | fix a typo. | restclients/test/util/datetime_convertor.py | restclients/test/util/datetime_convertor.py | from django.test import TestCase
from datetime import date, datetime
from restclients.util.datetime_convertor import convert_to_begin_of_day,\
convert_to_end_of_day
class DatetimeConvertorTest(TestCase):
def test_convert_to_begin_of_day(self):
self.assertEquals(convert_to_begin_of_day(date(2013, 4,... | Python | 0.03285 | @@ -668,17 +668,17 @@
time(201
-3
+2
, 2, 29,
|
2199f4c5ed563200d555315b9a8575e00486e667 | Add a simple script to generate monthly confirmed / fixed counts | script/confirmed-fixed-monthly-breakdown.py | script/confirmed-fixed-monthly-breakdown.py | Python | 0 | @@ -0,0 +1,2123 @@
+#!/usr/bin/python%0A%0A# A script to draw graphs showing the number of confirmed reports%0A# created each month, and those of which that have been fixed. This%0A# script expects to find a file called 'problems.csv' in the current%0A# directory which should be generated by:%0A#%0A# DIR=%60pwd%... | |
417f1832dbb6a1d0742b2f01d56429139f8885ef | add conversion script | scripts/conversionScripts/toValidationPP.py | scripts/conversionScripts/toValidationPP.py | Python | 0.000001 | @@ -0,0 +1,2330 @@
+# Copyright 2017 Battelle Energy Alliance, 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 at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unles... | |
bbae3e9fee30634a659276732f16a883500e8f45 | Create memcache.py | cutout/cache/memcache.py | cutout/cache/memcache.py | Python | 0.000001 | @@ -0,0 +1,2213 @@
+# -*- coding: utf-8 -*-%0A%0A%0A%0A%0Aimport os%0Aimport re%0Aimport tempfile%0Afrom time import time%0Afrom .basecache import BaseCache%0Afrom .posixemulation import rename, _items%0Atry:%0A import cPickle as pickle%0Aexcept ImportError:%0A import pickle%0Atry:%0A from hashlib import md5%0... | |
e5d4e0f0ebb2138cdc5efee0b8584e0cb571ac8a | Add test_notify_of_new_user_internally. | zerver/tests/test_new_users.py | zerver/tests/test_new_users.py | from django.conf import settings
from django.core import mail
from django.contrib.auth.signals import user_logged_in
from zerver.lib.test_classes import ZulipTestCase
from zerver.signals import get_device_browser, get_device_os
class SendLoginEmailTest(ZulipTestCase):
"""
Uses django's user_logged_in signal to... | Python | 0.000001 | @@ -220,16 +220,107 @@
evice_os
+%0Afrom zerver.lib.actions import notify_new_user%0Afrom zerver.models import Recipient, Stream
%0A%0Aclass
@@ -4316,8 +4316,562 @@
ent%5B2%5D)%0A
+%0A%0Aclass TestNotifyNewUser(ZulipTestCase):%0A def test_notify_of_new_user_internally(self):%0A # type: () -%3E None%0A ... |
3719a0371fa6fcc95ca65b6d759762f1f17a16be | Solving p025 | p025.py | p025.py | Python | 0.999768 | @@ -0,0 +1,407 @@
+%22%22%22%0AWhat is the first term in the Fibonacci sequence to contain 1000 digits?%0A%22%22%22%0A%0Adef solve_p025():%0A for i, num in enumerate(fib_generator()):%0A if len(str(num)) == 1000:%0A return i + i%0A%0Adef fib_generator():%0A prev = 1%0A curr = 1%0A yield pr... | |
bd2a70930ba67f3dd510b172fe4e00ddc2dc23c2 | Create voxelmodel.py | odvm/voxelmodel.py | odvm/voxelmodel.py | Python | 0.000002 | @@ -0,0 +1,696 @@
+from panda3d.core import *%0Afrom odvm.quads import Quads%0A%0A%0Aclass VoxelModel(Geom):%0A def __init__(self):%0A Geom.__init__( self, GeomVertexData( 'vertices', GeomVertexFormat.get_v3n3c4(), Geom.UH_static ) )%0A self.quads = Quads(self)%0A self.add_primitive(self.quads)%0A%0A ... | |
b4d82c21995fb2b9e2afd93eea8849ded8b7d489 | Update next-greater-element-iii.py | Python/next-greater-element-iii.py | Python/next-greater-element-iii.py | # Time: O(logn)
# Space: O(logn)
# Given a positive 32-bit integer n, you need to find the smallest 32-bit integer
# which has exactly the same digits existing in the integer n and is greater in value than n.
# If no such positive 32-bit integer exists, you need to return -1.
@
# Example 1:
# Input: 12
# Output: 21
#... | Python | 0.000007 | @@ -9,16 +9,23 @@
O(logn)
+ = O(1)
%0A# Space
@@ -33,16 +33,23 @@
O(logn)
+ = O(1)
%0A%0A# Give
|
f30c542a9714574dbcee15ca7f7b4ca4cdb9d965 | add atexit01.py | trypython/stdlib/atexit01.py | trypython/stdlib/atexit01.py | Python | 0.000001 | @@ -0,0 +1,749 @@
+# coding: utf-8%0A%0A%22%22%22%0Aatexit%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E3%81%AE%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%81%A7%E3%81%99%E3%80%82%0A%22%22%22%0Aimport atexit%0Aimport sys%0A%0Afrom trypython.common.commoncls import SampleBase%0Afrom trypy... | |
926fe25c4995b5ab1d2464159223e2c403b72570 | use python command line tool with tshark to parse pcap and convert to csv | pcap2csv.py | pcap2csv.py | Python | 0.000001 | @@ -0,0 +1,500 @@
+import os%0Aimport csv%0A%0Acmd = %22tshark -n -r %7B0%7D -T fields -Eheader=y -e ip.addr %3E tmp.csv%22%0A%0Aos.system(cmd.format(%22wireshark_sample.pcap%22))%0A%0Aresult = %5B%5D%0A%0Awith open(%22tmp.csv%22, %22r%22) as infile:%0A for line in infile:%0A if line == %22%5Cn%22:%0A ... | |
81f4976645225b6cf4a422186a3419a06756bfc5 | add a set of test utils that will be useful for running tests | test/test_util.py | test/test_util.py | Python | 0.000009 | @@ -0,0 +1,919 @@
+import contextlib%0Aimport os%0Aimport os.path%0A%0Aimport mock%0Aimport requests%0A%0A%0A@contextlib.contextmanager%0Adef mocked_requests(path):%0A %22%22%22mocks the requests library to return a given file's content%22%22%22%0A # if environment variable is set, then don't mock the tests just ... | |
0827fce61013172fa7183ee294189275030c0faf | Create code_5.py | MPI_Practice_Examples/code_5.py | MPI_Practice_Examples/code_5.py | Python | 0.001674 | @@ -0,0 +1,1799 @@
+#dotProductParallel_1.py%0A#%22to run%22 syntax example: mpiexec -n 4 python26 dotProductParallel_1.py 40000%0A%0Afrom mpi4py import MPI%0Aimport numpy%0Aimport sys%0A%0Acomm = MPI.COMM_WORLD%0Arank = comm.Get_rank()%0Asize = comm.Get_size()%0A%0A#read from command line%0An = int(sys.argv%5B1%5D) ... | |
6454548da01dbc2b9f772a5c0ffb11a03dc933e7 | Add module capable of rendering a circle when ran | draw_shape.py | draw_shape.py | Python | 0 | @@ -0,0 +1,627 @@
+import pygame%0A%0A%0Apygame.init()%0A%0A#-- SCREEN CHARACTERISTICS -------------------------%3E%3E%3E%0Abackground_color = (255,255,255)%0A(width, height) = (300, 200)%0A%0A#-- RENDER SCREEN ----------------------------------%3E%3E%3E%0Ascreen = pygame.display.set_mode((width, height))%0Ascreen.fill... | |
469b28aec45c9832e4cfe658143316fb15e103d1 | Add server | server.py | server.py | Python | 0.000001 | @@ -0,0 +1,20 @@
+print(%22Hola mundo%22)%0A
| |
6ac6f9f3f933a98af8722561ba181ca50c6ad1fe | Add performance test | perftest.py | perftest.py | Python | 0.000043 | @@ -0,0 +1,922 @@
+import resource%0Afrom time import clock%0A%0Afrom sortedsets import SortedSet%0A%0Adef test(size):%0A tm = clock()%0A ss = SortedSet((str(i), i*10) for i in range(size))%0A create_time = clock() - tm%0A print(%22SORTED SET WITH%22, size, %22ELEMENTS%22, ss._level, %22LEVELS%22)%0A pri... | |
a107d3c088e13c4bf1a600f0ebf2664321d6799f | add solution for Binary Tree Maximum Path Sum | src/binaryTreeMaximumPathSum.py | src/binaryTreeMaximumPathSum.py | Python | 0.000001 | @@ -0,0 +1,617 @@
+# Definition for a binary tree node%0A# class TreeNode:%0A# def __init__(self, x):%0A# self.val = x%0A# self.left = None%0A# self.right = None%0A%0A%0Aclass Solution:%0A # @param root, a tree node%0A # @return an integer%0A%0A def maxPathSum(self, root):%0A ... | |
4fdef464be6eabee609ecc4327493c277693c0e0 | Make content text mandatory | content/migrations/0023_auto_20160614_1130.py | content/migrations/0023_auto_20160614_1130.py | Python | 0.999999 | @@ -0,0 +1,613 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.7 on 2016-06-14 09:30%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('content', '0022_auto_20160608_1407'),%0A %5D%0A%0... | |
b106bb6f346811181c9fde27147f7b1685827cbe | 436. Find Right Interval. Brute force | p436_bruteforce.py | p436_bruteforce.py | Python | 0.999464 | @@ -0,0 +1,1212 @@
+import sys%0Aimport unittest%0A%0A%0A# Definition for an interval.%0Aclass Interval(object):%0A def __init__(self, s=0, e=0):%0A self.start = s%0A self.end = e%0A%0A%0Aclass Solution(object):%0A def findRightInterval(self, intervals):%0A %22%22%22%0A :type intervals... | |
5a857703de5fc1e67e958afb41a10db07b98bfa1 | Add migration script to fix valid users with date_confirmed==None | scripts/migrate_unconfirmed_valid_users.py | scripts/migrate_unconfirmed_valid_users.py | Python | 0.000184 | @@ -0,0 +1,1884 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22Script to migrate users with a valid date_last_login but no date_confirmed.%22%22%22%0A%0Aimport sys%0Aimport logging%0A%0Afrom website.app import init_app%0Afrom website.models import User%0Afrom scripts import utils as script_utils%0Afrom ... | |
e12371408af1682904483341fd1f41ef6034a17f | add test | OperateSystem/Ex1/Test/SellTest.py | OperateSystem/Ex1/Test/SellTest.py | Python | 0.000002 | @@ -0,0 +1,383 @@
+# -*- coding: utf-8 -*-%0A__author__ = 'jayin'%0A%0Aimport requests%0Aimport threading%0A%0A%0Adef buy_ticket():%0A res = requests.get('http://localhost:8000/buy1')%0A print threading.currentThread().getName() + u' buy ticket ' + res.content%0A%0A%0Adef main():%0A for x in range(1, 40):%0A ... | |
edeffbcbe8fb239553c73fa37e73c0188ffc2479 | Add unit test for retrieving credentials from environment variables | tests/test_cli.py | tests/test_cli.py | Python | 0 | @@ -0,0 +1,1508 @@
+import sys%0A%0Aimport fixtures%0Aimport imgurpython%0Aimport testtools%0A%0Aimport imgur_cli.cli as cli%0A%0AFAKE_ENV = %7B'IMGUR_CLIENT_ID': 'client_id',%0A 'IMGUR_CLIENT_SECRET': 'client_secret',%0A 'IMGUR_ACCESS_TOKEN': 'access_token',%0A 'IMGUR_REFRESH_TOKEN': '... | |
4c148281ee8071ea8f150362388a44cf5c0895bf | Add exception classes. | tgif/exception.py | tgif/exception.py | Python | 0 | @@ -0,0 +1,180 @@
+%22%22%22 All exceptions go here.%0A%22%22%22%0A%0Aclass Friday(Exception):%0A %22%22%22 Base exception in Friday game.%0A %22%22%22%0A%0Aclass GameOver(Friday):%0A %22%22%22 Indicats that the game is overed.%0A %22%22%22%0A
| |
a6935d250dfdbc275ce450f813697b73ebc291e3 | Create addDigits.py | Puzzles/leetcode/April-9th-2016/addDigits.py | Puzzles/leetcode/April-9th-2016/addDigits.py | Python | 0 | @@ -0,0 +1,634 @@
+/*%0A%5Bref.href%5D leetcode.com/problems/add-digits%0A%22%0A Given a non-negative integer num, repeatedly add all its digits %0A until the result has only one digit.%0A %0A For example:%0A %0A Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. %0A Since 2 has only one digit, return i... | |
85142dd9f7413dcb7c214ec251d21c93517ce26c | add AcoraMatcher tool | AcoraMatcher.py | AcoraMatcher.py | Python | 0 | @@ -0,0 +1,2082 @@
+# coding:utf-8%0Aimport cPickle%0Aimport json%0Aimport acora%0Afrom atma import tool%0Aimport collections%0Afrom itertools import groupby%0A%0A%0Aclass AcoraMatcher:%0A def __init__(self, spec_set, min_count=1, min_len=1):%0A key_lst = %5B%5D%0A if type(spec_set) == dict or type(spe... | |
7a880376e098f60b1666833bb6b14b359b0ebda5 | add fitness_spider.py | Exercise/fitness_spider.py | Exercise/fitness_spider.py | Python | 0.00231 | @@ -0,0 +1,995 @@
+from bs4 import BeautifulSoup%0Aimport requests%0Afrom selenium import webdriver%0Aimport time%0Aimport sqlite3%0Afrom selenium import webdriver%0Aimport json%0A%0Adriver = webdriver.PhantomJS()%0Aclass Fitness:%0A i = 0%0A url = %22http://www.hiyd.com/dongzuo/%22%0A headers = %7B%0A ... | |
52684fdcd94e05c96e9d9643a5c9d2cf9d8f5713 | Use six.string_types as suggested by @piquadrat. | opbeat/instrumentation/packages/dbapi2.py | opbeat/instrumentation/packages/dbapi2.py | """Provides classes to instrument dbapi2 providers
https://www.python.org/dev/peps/pep-0249/
"""
import re
from opbeat.instrumentation.packages.base import AbstractInstrumentedModule
from opbeat.traces import trace
from opbeat.utils import wrapt
class Literal(object):
def __init__(self, literal_type, content):
... | Python | 0 | @@ -240,16 +240,21 @@
rt wrapt
+, six
%0A%0A%0Aclass
@@ -1652,18 +1652,31 @@
exeme, s
-tr
+ix.string_types
) and le
|
a8fd0bfa974ff818ec105a42c585bae48030a086 | Create notebooknetc.py | _src/om2py3w/3wex0/notebooknetc.py | _src/om2py3w/3wex0/notebooknetc.py | Python | 0.000002 | @@ -0,0 +1,467 @@
+# _*_coding:utf-8_*_%0A# %E5%AE%A2%E6%88%B7%E7%AB%AF%E7%A8%8B%E5%BA%8F%0A%0Afrom socket import *%0Aimport time%0Aimport notebooknets%0A%0Adef main():%0A BUF_SIZE = 65565%0A ss_addr = ('127.0.0.1', 8800)%0A cs = socket(AF_INET, SOCK_DGRAM)%0A%0A while True:%0A global data%0A ... | |
e3aa781fe60e3ce293e34767c78e947ffc169cbc | Allow module contributions to return dict | src/ggrc/extensions.py | src/ggrc/extensions.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: david@reciprocitylabs.com
# Maintained By: david@reciprocitylabs.com
import sys
from ggrc import settings
import ggrc
def get_extension_name(exte... | Python | 0.000001 | @@ -2550,16 +2550,96 @@
ions()%0A%0A
+ if isinstance(contributions, dict):%0A contributions = contributions.items()%0A
if not
@@ -3641,16 +3641,127 @@
name))%0A
+ if all(isinstance(val, tuple) for val in all_contributions):%0A all_contributions = dict(all_contributions)%0A
return
|
13f495ddabd1997b7dfdc9e2933b82fd25ecd664 | Create LevelOrderTraversal.py from LeetCode | LevelOrderTraversal.py | LevelOrderTraversal.py | Python | 0 | @@ -0,0 +1,1687 @@
+%0A#https://leetcode.com/problems/binary-tree-level-order-traversal/#/description%0A%0A# Definition for a binary tree node.%0A# class TreeNode(object):%0A# def __init__(self, x):%0A# self.val = x%0A# self.left = None%0A# self.right = None%0A%0A%0Aclass Node(object):%0A ... | |
6f83518ebbbc94de83368d4c1a598850df0a6ba5 | Include any_cuts only if they exist | cubes/auth.py | cubes/auth.py | # -*- coding=utf -*-
import os.path
import json
from collections import namedtuple
from .extensions import get_namespace, initialize_namespace
from .browser import Cell, cut_from_string, cut_from_dict
from .errors import *
from .common import read_json_file, sorted_dependencies
__all__ = (
"create_authorizer",
... | Python | 0 | @@ -6366,24 +6366,49 @@
LDCARD, %5B%5D)%0A
+ if any_cuts:%0A
cuts
|
891dc05f36ae9084d8511bf3e26e0631eadecef7 | add medications urls | medications/urls.py | medications/urls.py | Python | 0.000009 | @@ -0,0 +1,194 @@
+%0Afrom django.conf.urls import url%0Afrom medications.views import MedicationsView%0A%0Aurlpatterns = %5B%0A url(r'%5E$', MedicationsView.as_view()),%0A url(r'%5E(%5B0-9%5D+)/$', MedicationsView.as_view()),%0A%5D%0A
| |
aa4f1df448c6d01875ed667e37afe68c114892ed | Add initial verification endpoint. Add all balance endpoint | api/mastercoin_verify.py | api/mastercoin_verify.py | Python | 0.000001 | @@ -0,0 +1,1201 @@
+import os%0Aimport glob%0Afrom flask import Flask, request, jsonify, abort, json%0A%0Adata_dir_root = os.environ.get('DATADIR')%0A%0Aapp = Flask(__name__)%0Aapp.debug = True%0A%0A%0A@app.route('/addresses')%0Adef addresses():%0A currency_id = request.args.get('currency_id')%0A print currency_id%0A... | |
23799c4a33b9d2da82ec0770f15e840459a940c6 | Add api comtrade | app/apis/comtrade_api.py | app/apis/comtrade_api.py | Python | 0 | @@ -0,0 +1,1699 @@
+from flask import Blueprint, jsonify, request%0Afrom sqlalchemy import func, distinct%0Afrom inflection import singularize%0Afrom app.models.comtrade import Comtrade as Model%0Afrom app import cache%0Afrom app.helpers.cache_helper import api_cache_key%0A%0Ablueprint = Blueprint('comtrade_api', __nam... | |
670e5d017adb24c5adffb38fa59059fec5175c3c | Create hello.py | hello.py | hello.py | Python | 0.999503 | @@ -0,0 +1,23 @@
+print('hello, world!')%0A
| |
1692161ad43fdc6a0e2ce9eba0bacefc04c46b5c | Add form generator module. | src/epiweb/apps/survey/utils.py | src/epiweb/apps/survey/utils.py | Python | 0 | @@ -0,0 +1,1202 @@
+from django import forms%0Afrom epiweb.apps.survey.data import Survey, Section, Question%0A%0A_ = lambda x: x%0A%0Adef create_field(question):%0A if question.type == 'yes-no':%0A field = forms.ChoiceField(widget=forms.RadioSelect,%0A choices=%5B('yes', _('Y... | |
3ae03deee41a5c243e46071f98bc2f0eedb7ed8f | Check for DirectiveSection duplicates before Clause import. | src/ggrc/converters/sections.py | src/ggrc/converters/sections.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
from .base import *
from ggrc.models import Directive, DirectiveSection, Section,... | Python | 0 | @@ -1722,32 +1722,36 @@
ive_id')%0A if
+not
directive_id:%0A
@@ -1744,24 +1744,386 @@
rective_id:%0A
+ return%0A # Make sure directive/clause aren't already connected before creating%0A clause_id = getattr(self.obj, 'id', None)%0A matching_relationship_count = DirectiveSection.query%5C%0A .... |
72a5f0d301b2169367c8bcbc42bb53b71c1d635c | Create utils.py | utils.py | utils.py | Python | 0.000001 | @@ -0,0 +1,1053 @@
+from google.appengine.api import users%0Afrom google.appengine.ext import webapp%0Afrom google.appengine.ext.webapp import blobstore_handlers%0Afrom google.appengine.api import memcache%0A%0Aimport jinja2%0Aimport logging%0Aimport json%0Aimport os%0A%0Aclass BaseHandler(webapp.RequestHandler):%0A ... | |
26bc11340590b0b863527fa12da03cea528feb46 | Add initial stub of GerritClient class | pygerrit/client.py | pygerrit/client.py | Python | 0.000006 | @@ -0,0 +1,1224 @@
+%22%22%22 Gerrit client interface. %22%22%22%0A%0Afrom Queue import Queue, Empty, Full%0A%0Afrom pygerrit.error import GerritError%0Afrom pygerrit.events import GerritEventFactory%0A%0A%0Aclass GerritClient(object):%0A%0A %22%22%22 Gerrit client interface. %22%22%22%0A%0A def __init__(self, ho... | |
10f99acc11051b37595751b9b9b84e11dd133a64 | Add functions for getting available checksums for a channel from remote and disk. | kolibri/core/content/utils/file_availability.py | kolibri/core/content/utils/file_availability.py | Python | 0 | @@ -0,0 +1,2878 @@
+import json%0Aimport os%0Aimport re%0A%0Aimport requests%0Afrom django.core.cache import cache%0A%0Afrom kolibri.core.content.models import LocalFile%0Afrom kolibri.core.content.utils.paths import get_content_storage_dir_path%0Afrom kolibri.core.content.utils.paths import get_file_checksums_url%0A%0... | |
61ec190ca29187cbf9ad7b721fbf1936d665e4f6 | Revert "rm client.py" | orchestration/containerAPI/client.py | orchestration/containerAPI/client.py | Python | 0 | @@ -0,0 +1,374 @@
+from docker import Client as docker_client%0A%0Aclass Client(object):%0A '''%0A Docker engine client%0A '''%0A def __init__(self, hostURL, version):%0A self.client = docker_client(base_url=hostURL, version=version)%0A self.url = hostURL%0A self.version = version%0A%0A... | |
dcc08986d4e2f0e7940f485d0ece465b1325a711 | Add barebones FileBlob class | python/fileblob.py | python/fileblob.py | Python | 0.000009 | @@ -0,0 +1,1235 @@
+#!/usr/bin/env python%0A%0Aimport os%0A%0AMEGABYTE = 1024 * 1024%0A%0Aclass FileBlob:%0A def __init__(self, path):%0A self.path = path%0A%0A def data(self):%0A return open(self.path).read()%0A%0A def size(self):%0A try:%0A return os.path.getsize(self.path)%0A... | |
5c1e1744fa19bf900981d6a40c69195419861357 | Add snactor sanity-check command (#564) | leapp/snactor/commands/workflow/sanity_check.py | leapp/snactor/commands/workflow/sanity_check.py | Python | 0 | @@ -0,0 +1,1592 @@
+from __future__ import print_function%0Aimport sys%0A%0Afrom leapp.exceptions import LeappError, CommandError%0Afrom leapp.logger import configure_logger%0Afrom leapp.repository.scan import find_and_scan_repositories%0Afrom leapp.snactor.commands.workflow import workflow%0Afrom leapp.utils.clicmd im... | |
d5aa7df9928603c7b7294587a7abeea2b0b18061 | version set to semver.org conform 4.2.0-dev | rdflib/__init__.py | rdflib/__init__.py | """\
A pure Python package providing the core RDF constructs.
The packages is intended to provide the core RDF types and interfaces
for working with RDF. The package defines a plugin interface for
parsers, stores, and serializers that other packages can use to
implement parsers, stores, and serializers that will plug ... | Python | 0 | @@ -935,16 +935,18 @@
_ = %224.2
+.0
-dev%22%0A__
@@ -962,15 +962,15 @@
%22201
-3/12/31
+4/01/07
%22%0A%0A_
|
489004c5f81b8a5a2a639bc67f3ed5008f18960a | fix the naming error of the plotting script | doc/source/report/plots/plot_hc_dendrogram.py | doc/source/report/plots/plot_hc_dendrogram.py | Python | 0.000004 | @@ -0,0 +1,692 @@
+from mousestyles import data%0Afrom mousestyles.classification import clustering%0Afrom mousestyles.visualization import plot_clustering%0A%0A%0A# load data%0Amouse_data = data.load_all_features()%0A%0A# mouse inidividual%0Amouse_dayavgstd_rsl = clustering.prep_data(mouse_data, melted=False, std = Tr... | |
e47f61f22a568a69e74cbf8d0b70c4858879b9b5 | Temporary workaround for an apprtc bug. | chrome/test/functional/webrtc_apprtc_call.py | chrome/test/functional/webrtc_apprtc_call.py | #!/usr/bin/env python
# Copyright (c) 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 random
# Note: pyauto_functional must come before pyauto.
import pyauto_functional
import pyauto
import webrtc_test_base
... | Python | 0.998543 | @@ -195,16 +195,28 @@
t random
+%0Aimport time
%0A%0A# Note
@@ -1794,32 +1794,148 @@
0, tab_index=0)%0A
+ # TODO(phoglund): workaround for%0A # https://code.google.com/p/webrtc/issues/detail?id=1742%0A time.sleep(1)%0A
self.Perform
|
37d851bb34552edfc3b1abd4d1034d4fdf46408f | Implement --remote | nvim-remote.py | nvim-remote.py | Python | 0.000097 | @@ -0,0 +1,2639 @@
+#!/usr/bin/env python3%0A%0A%22%22%22%0ACopyright (c) 2015 Marco Hinz%0A%0APermission is hereby granted, free of charge, to any person obtaining a copy%0Aof this software and associated documentation files (the %22Software%22), to deal%0Ain the Software without restriction, including without limitat... | |
49424b855f043ae2bbb3562481493b1fa83f5090 | add random selection wip code | af_scripts/tmp/randSelect.py | af_scripts/tmp/randSelect.py | Python | 0 | @@ -0,0 +1,358 @@
+import random as rd%0A%0Alist = %5B%22a%22,%22b%22,%22c%22,%22d%22,%22e%22,%22f%22,%22g%22,%22h%22,%22i%22,%22j%22,%22k%22,%22l%22,%22m%22,%22n%22,%22o%22,%22p%22,%22q%22,%22r%22,%22s%22,%22t%22,%22u%22,%22v%22,%22w%22,%22x%22,%22y%22,%22z%22%5D%0A%0ArandList = list%0A#print randList%0A%0Adiv=3%0A%0A... | |
7d4281574a9ee2a8e7642f14402a452f82a807db | Create smarthome.py | demos/smarthome/smarthome.py | demos/smarthome/smarthome.py | Python | 0 | @@ -0,0 +1,1297 @@
+import logging%0A%0Afrom pabiana import area%0Afrom pabiana.area import autoloop, load_interfaces, pulse, register, scheduling, subscribe%0Afrom pabiana.node import create_publisher, run%0A%0ANAME = 'smarthome'%0Apublisher = None%0A%0A%0A# Triggers%0A@register%0Adef increase_temp():%0A%09area.contex... | |
babdfe81ef57c52c16f11dc48bf148157d052995 | change to use new method names | src/robotide/plugins/preview.py | src/robotide/plugins/preview.py | # Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | Python | 0.000002 | @@ -1923,30 +1923,25 @@
elf.
-remove_added_menu_item
+unregister_action
s()%0A
@@ -1964,12 +1964,11 @@
ete_
-page
+tab
(sel
|
a0493ff48b96056709880804f61e794621886c61 | Add CoNLL reader tests | compattern/dependency/tests/test_conll.py | compattern/dependency/tests/test_conll.py | Python | 0 | @@ -0,0 +1,1483 @@
+# encoding: utf8%0A%0Afrom compattern.dependency import conll%0A%0A%0Adef test_read_french():%0A %22%22%22Test that conll.read understands French Bonsai output%22%22%22%0A line = (u%226%5Ctchauff%C3%A9%5Ctchauffer%5CtV%5CtVPP%5Ctg=m%7Cm=part%7Cn=s%7Ct=past%5Ct%22%0A u%221100011%5Ct5... | |
4b696c2a54f7afd95013763c098aec30b08409d6 | Create bulb-switcher-ii.py | Python/bulb-switcher-ii.py | Python/bulb-switcher-ii.py | Python | 0.000001 | @@ -0,0 +1,383 @@
+# Time: O(1)%0A# Space: O(1)%0A%0Aclass Solution(object):%0A def flipLights(self, n, m):%0A %22%22%22%0A :type n: int%0A :type m: int%0A :rtype: int%0A %22%22%22%0A if m == 0: return 1%0A if n == 1: return 2%0A if m == ... | |
0621b935558b6805d2b45fee49bc2e959201fd7a | add number-of-digit-one | vol5/number-of-digit-one/number-of-digit-one.py | vol5/number-of-digit-one/number-of-digit-one.py | Python | 0.999993 | @@ -0,0 +1,868 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# @Author: Zeyuan Shang%0A# @Date: 2015-11-03 15:21:00%0A# @Last Modified by: Zeyuan Shang%0A# @Last Modified time: 2015-11-03 15:21:14%0Aimport itertools%0A%0Aclass Solution(object):%0A def countDigitOne(self, n):%0A %22%22%22%0A ... | |
27d37833663842405f159127f30c6351958fcb10 | Add draft of example using the new @bench | bench_examples/bench_dec_insert.py | bench_examples/bench_dec_insert.py | Python | 0 | @@ -0,0 +1,800 @@
+from csv import DictWriter%0A%0Afrom ktbs_bench.utils.decorators import bench%0A%0A%0A@bench%0Adef batch_insert(graph, file):%0A %22%22%22Insert triples in batch.%22%22%22%0A print(graph, file)%0A%0A%0Aif __name__ == '__main__':%0A # Define some graph/store to use%0A graph_list = %5B'g1',... | |
175470eea9716f587a2339932c1cfb6c5240c4df | add tools.testing module for asserts (numpy, pandas compat wrapper) | statsmodels/tools/testing.py | statsmodels/tools/testing.py | Python | 0 | @@ -0,0 +1,1442 @@
+%22%22%22assert functions from numpy and pandas testing%0A%0A%22%22%22%0A%0Aimport re%0Afrom distutils.version import StrictVersion%0A%0Aimport numpy as np%0Aimport numpy.testing as npt%0Aimport pandas%0Aimport pandas.util.testing as pdt%0A%0A# for pandas version check%0Adef strip_rc(version):%0A ... | |
3f8fd4eb96e778148e73e1e89b369f03d2e97f69 | Update ceph_help.py | tendrl/commons/flows/create_cluster/ceph_help.py | tendrl/commons/flows/create_cluster/ceph_help.py | # flake8: noqa
import gevent
from tendrl.commons.event import Event
from tendrl.commons.flows.exceptions import FlowExecutionFailedError
from tendrl.commons.message import Message
def create_ceph(parameters):
# install the packages
Event(
Message(
job_id=parameters['job_id'],
f... | Python | 0.000001 | @@ -2552,109 +2552,29 @@
-status, err = sync_task_status(task_id)%0A if not status:%0A raise FlowExecutionFailedError(err
+wait_for_task(task_id
)%0A
@@ -3000,109 +3000,29 @@
-status, err = sync_task_status(task_id)%0A if not status:%0A raise FlowExecutionFailedError(err
+wait_for_tas... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.