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 |
|---|---|---|---|---|---|---|---|
1f731dcbfcff76ba63e4aea4fc05a15dd5021daa | Test for overriding sys.stdout. | tests/io/sys_stdio_override.py | tests/io/sys_stdio_override.py | Python | 0.000009 | @@ -0,0 +1,317 @@
+try:%0A import uio as io%0Aexcept ImportError:%0A try:%0A import io%0A except ImportError:%0A print(%22SKIP%22)%0A raise SystemExit%0A%0Aimport sys%0A%0Atry:%0A sys.stdout = sys.stdout%0Aexcept AttributeError:%0A print(%22SKIP%22)%0A raise SystemExit%0A%0A%0Abuf... | |
855d10b768fbfec7772f8e5df4c181d971fe0dd4 | add tests. | tests/test_primesieve_array.py | tests/test_primesieve_array.py | Python | 0 | @@ -0,0 +1,387 @@
+from primesieve.array import n_primes, primes%0A%0Adef assert_array_equal(have, want):%0A assert list(have) == want%0A%0Adef test_primes_array():%0A assert_array_equal(primes(10), %5B2,3,5,7%5D)%0A assert_array_equal(primes(10, 20), %5B11,13,17,19%5D)%0A%0Adef test_n_primes_array():%0A as... | |
9de475e8007b209d005ed222686cb46bddef053d | Integrate LLVM at llvm/llvm-project@9e37b1e5a0c1 | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "ab85996e475ceddfda82255c314229ac0c0f4994"
LLVM_SHA256 = "140b4198fa4f0ec1917a0e252feec5e19ccd9d7e96fc818c555b5551c796ec5b"
tf_http_archive(
... | Python | 0.000003 | @@ -160,133 +160,133 @@
= %22
-ab85996e475ceddfda82255c314229ac0c0f4994%22%0A LLVM_SHA256 = %22140b4198fa4f0ec1917a0e252feec5e19ccd9d7e96fc818c555b5551c796ec5b
+9e37b1e5a0c15f36c5642406d5aa02a657a0b19c%22%0A LLVM_SHA256 = %22e2cca91a76ee6b44a6af91874e429af582b248b96ccd139373fec69ed0b0215f
%22%0A%0A
|
c6b0b5a8cef752481d5ec6672313ec8829d4299f | Create saving.py | Webpage/cgi-bin/saving.py | Webpage/cgi-bin/saving.py | Python | 0.000001 | @@ -0,0 +1,1545 @@
+#!/usr/bin/python3%0Aimport os%0Aimport os.path%0Aimport cgi, cgitb%0Aimport re%0Aimport pickle%0A%0A#own packages%0Aimport dbcPattern%0A%0A%0Adef dbc_main(): # NEW except for the call to processInput%0A%09form = cgi.FieldStorage() # standard cgi script lines to here!%0A %0A # use format ... | |
8c6335c7ba7ebb34566603eb2943752fd3f524db | Add Exercise 9.13. | Kane1985/Chapter5/Ex9.13.py | Kane1985/Chapter5/Ex9.13.py | Python | 0.000001 | @@ -0,0 +1,2044 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22Exercise 9.13 from Kane 1985.%22%22%22%0A%0Afrom __future__ import division%0Afrom sympy import expand, symbols%0Afrom sympy.physics.mechanics import ReferenceFrame, Point%0Afrom sympy.physics.mechanics import dynamicsymbols%0Afrom util impo... | |
5a2f8967ac09b3aa1fc1cda21fd6dc5cf1d3f896 | Add gesture recognition prototype | gesture_recognition/__init__.py | gesture_recognition/__init__.py | Python | 0.000002 | @@ -0,0 +1,2471 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0Aimport pygame%0Afrom pygame import camera%0Afrom pygame.constants import QUIT, K_ESCAPE, KEYDOWN%0Aimport numpy as np%0A%0A%0Aclass Capture(object):%0A def __init__(self):%0A camera.init()%0A self.size = (640, 480, )%0A # ... | |
41ee54414845c3d8c1592048fe2f7cee57153eee | Add Python Numpy and Pandas cheatsheet | pythonCheatsheet.py | pythonCheatsheet.py | Python | 0.000001 | @@ -0,0 +1,61 @@
+#!/usr/local/bin/python%0A# Python Numpy and Pandas Cheatsheet%0A
| |
a813d79ccd63c9ff40afaf3fda4e2c8c0a37ee25 | Add wsgi file | readthedocs/wsgi.py | readthedocs/wsgi.py | Python | 0.000001 | @@ -0,0 +1,467 @@
+import os%0A%0Aos.environ.setdefault(%22DJANGO_SETTINGS_MODULE%22, %22settings%22)%0A%0A# This application object is used by any WSGI server configured to use this%0A# file. This includes Django's development server, if the WSGI_APPLICATION%0A# setting points here.%0Afrom django.core.wsgi import get_... | |
3d0ac61fa03ab27c567155f989db0ceb2134c9e0 | adding test_hello | test_hello.py | test_hello.py | Python | 0.999096 | @@ -0,0 +1,21 @@
+print %22Hello World%22%0A%0A
| |
7e9794dc98a268479f0f57128effc67f88586c8f | Add default message for list pages | bvspca/core/migrations/0025_auto_20180202_1214.py | bvspca/core/migrations/0025_auto_20180202_1214.py | Python | 0.000001 | @@ -0,0 +1,495 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.9 on 2018-02-02 19:14%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('core', '0024_contentindexpage_empty_message'),%0A ... | |
63db1dc6c23c4afd41bca5cf06207e383c982b51 | structure of the commandprocessor | app/core/commandprocessor.py | app/core/commandprocessor.py | Python | 0.000015 | @@ -0,0 +1,125 @@
+class CommandProcessor:%0A%09def parseCommand(self):%0A%09%09pass%0A%09%0A%09def constructUrl(self):%0A%09%09pass%0A%0A%09def processCommand(self):%0A%09%09pass%0A
| |
2c687118a9aa248d6e6f28259d8a81217ee9cb1d | add solution for Number of Digit One | algorithms/numberOfDigitOne/numberOfDigitOne.py | algorithms/numberOfDigitOne/numberOfDigitOne.py | Python | 0.999957 | @@ -0,0 +1,455 @@
+class Solution:%0A # @param %7Binteger%7D n%0A # @return %7Binteger%7D%0A%0A def countDigitOne(self, n):%0A res = prev = 0%0A x = 1%0A while n %3E 0: # n = 23%5By%5Dxxx%0A y = n %25 10%0A n /= 10%0A if y %3E 1:%0A res += x... | |
67dfcd5abb73aff7fd416f665de0d8461ba3e8b4 | Create Subset.py | Tests/Subset.py | Tests/Subset.py | Python | 0.000001 | @@ -0,0 +1,2352 @@
+__author__ = 'Marius Wirtz'%0A%0Afrom TM1py import TM1Queries, Subset%0Aimport uuid%0Aimport json%0Aimport unittest%0A%0A%0Aclass TestAnnotationMethods(unittest.TestCase):%0A q = TM1Queries(ip='', port=8008, user='admin', password='apple', ssl=True)%0A random_string1 = str(uuid.uuid4()).replac... | |
93d6915c0e45d1873a48c298749d6956edbc337e | add remote ssh capability to fs-drift.py | ssh_thread.py | ssh_thread.py | Python | 0.000001 | @@ -0,0 +1,1140 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A%0A'''%0Assh_thread.py -- manages parallel execution of shell commands on remote hosts%0ACopyright 2012 -- Ben England%0ALicensed under the Apache License at http://www.apache.org/licenses/LICENSE-2.0%0ASee Appendix on this page for instructions pertaini... | |
88e05bd1fe0f2e46e740a3d8d631d4a810c155a6 | Complete P8 | Quiz/Problem8_satisfiesF.py | Quiz/Problem8_satisfiesF.py | Python | 0 | @@ -0,0 +1,631 @@
+def satisfiesF(L):%0A %22%22%22%0A Assumes L is a list of strings%0A Assume function f is already defined for you and it maps a string to a Boolean%0A Mutates L such that it contains all of the strings, s, originally in L such%0A that f(s) returns True, and no other elements%0A... | |
820fe44762f0037eaacba9b7bf4129a29e25e799 | add migration | accelerator/migrations/0036_add_user_deferrable_modal.py | accelerator/migrations/0036_add_user_deferrable_modal.py | Python | 0 | @@ -0,0 +1,1688 @@
+# Generated by Django 2.2.10 on 2021-03-03 17:08%0A%0Afrom django.conf import settings%0Afrom django.db import (%0A migrations,%0A models,%0A)%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A migrations.swappable_dependency... | |
a5cabf4b778d03cac472e22b0e62bc262796b5ff | Add tests for `cms.templatetags.pagination`. | cms/tests/test_templatetags_pagination.py | cms/tests/test_templatetags_pagination.py | Python | 0 | @@ -0,0 +1,1180 @@
+from django.http import Http404%0Afrom django.test import RequestFactory, TestCase%0A%0Afrom ..templatetags.pagination import paginate, pagination, pagination_url%0A%0A%0Aclass Object(object):%0A paginator = None%0A%0A%0Aclass PaginationTest(TestCase):%0A%0A def setUp(self):%0A self.fac... | |
aa218407a9efdde9daa53d638fdfdacff873f14b | test change | clients/python/flask-server/tests/client_tests.py | clients/python/flask-server/tests/client_tests.py | Python | 0.000002 | @@ -0,0 +1,1561 @@
+%22%22%22%0Aintegration test in python%0A!!!! NEED PYTHON 2.7.8%0A%22%22%22%0A%0Aimport unittest%0Aimport urllib2%0Aimport urllib%0Aimport thread%0Aimport time%0Aimport json%0Afrom client import app%0Afrom multiprocessing import Process%0A%0Aclass ServerHandlerTest(unittest.TestCase):%0A server =... | |
e2ed85ae1bb3f647095abb00b118cf06ae7549aa | add setup (even if not really needed) | 0_Python/setup.py | 0_Python/setup.py | Python | 0 | @@ -0,0 +1,270 @@
+#!/usr/bin/python%0A%0Afrom distutils.core import setup%0Afrom Cython.Distutils import build_ext%0Afrom distutils.extension import Extension%0A%0Acy_mod = Extension(%22inside_polygon%22,%0A%09sources=%09%5B%22inside_polygon.pyx%22%5D)%0A%0Asetup(ext_modules=%5Bcy_mod%5D,%0A%09cmdclass=%7B'build_ext':... | |
cd1c88c519a7079b2cef752473e5da3ddb4224e3 | Add stress package (#3695) | var/spack/repos/builtin/packages/stress/package.py | var/spack/repos/builtin/packages/stress/package.py | Python | 0 | @@ -0,0 +1,1722 @@
+##############################################################################%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... | |
9ce90bc43cfcc5a56be958671f304e7929eb0446 | Add missing migration step dua changes in model | cmsplugin_collapse/migrations/0002_auto_20160210_0651.py | cmsplugin_collapse/migrations/0002_auto_20160210_0651.py | Python | 0 | @@ -0,0 +1,537 @@
+# -*- 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 ('cmsplugin_collapse', '0001_initial'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterFi... | |
b0ea743fa320f0df6e35b4381e6bd778906a5532 | Add caching mechanism | labmanager/rlms/caches.py | labmanager/rlms/caches.py | Python | 0.000001 | @@ -0,0 +1,2321 @@
+import calendar%0A%0Afrom cachecontrol import CacheControl%0Afrom cachecontrol.caches import FileCache%0Afrom cachecontrol.heuristics import LastModified, TIME_FMT%0A%0Afrom email.utils import formatdate, parsedate, parsedate_tz%0A%0Aclass LastModifiedNoDate(LastModified):%0A %22%22%22 This takes... | |
b6ac6a73cf10372be3384dbeb99b82b137a9daa2 | Use chevrons instead of arrows in sortable links | oscar/templatetags/sorting_tags.py | oscar/templatetags/sorting_tags.py | # This is a rewrite of django-sorting but with added support for i18n title
# strings.
# See https://github.com/directeur/django-sorting
from django import template
from django.conf import settings
register = template.Library()
DEFAULT_SORT_UP = getattr(settings, 'DEFAULT_SORT_UP', '↑')
DEFAULT_SORT_DOWN = geta... | Python | 0 | @@ -242,32 +242,37 @@
RT_UP = getattr(
+%0A
settings, 'DEFAU
@@ -287,16 +287,45 @@
UP',
- '↑
+%0A '%3Ci class=%22icon-chevron-up%22%3E%3C/i%3E
')%0AD
@@ -351,16 +351,21 @@
getattr(
+%0A
settings
@@ -390,16 +390,47 @@
WN',
- '↓
+%0A '%3Ci class=%22icon-chevron-down%22%3E%3C/i%3E
')%0A%0A
|
38f28bd0e5d4ea5af69ac7ccc553403a85ac61be | add problem 053 | problem_053.py | problem_053.py | Python | 0.000383 | @@ -0,0 +1,881 @@
+#!/usr/bin/env python%0A#-*-coding:utf-8-*-%0A%0A'''%0AThere are exactly ten ways of selecting three from five, 12345:%0A123, 124, 125, 134, 135, 145, 234, 235, 245, and 345%0AIn combinatorics, we use the notation, 5C3 = 10.%0AIn general,%0A%0AnCr =%0An!%0Ar!(n%E2%88%92r)!%0A,where r %E2%89%A4 n, n! ... | |
ac2d5c10e7895515acd63e2ca91924e99ec17003 | add (Failing) test | test/test_writing.py | test/test_writing.py | Python | 0.000033 | @@ -0,0 +1,586 @@
+import RMF%0A%0ARMF.set_log_level(%22trace%22)%0Apath = RMF._get_temporary_file_path(%22writing.rmf%22)%0Aprint path%0Afh = RMF.create_rmf_file(path)%0Afh.add_frame(%22frame%22, RMF.FRAME)%0Afn = fh.get_root_node().add_child(%22frag%22, RMF.REPRESENTATION)%0A%0Apf = RMF.ParticleFactory(fh)%0Aff = RMF... | |
492d90e1197803f2dbce0b07417d12497c9031fe | Implement away-notify | txircd/modules/ircv3/awaynotify.py | txircd/modules/ircv3/awaynotify.py | Python | 0.999988 | @@ -0,0 +1,1482 @@
+from twisted.plugin import IPlugin%0Afrom txircd.module_interface import IModuleData, ModuleData%0Afrom zope.interface import implements%0A%0Aclass AwayNotify(ModuleData):%0A%09implements(IPlugin, IModuleData)%0A%09%0A%09name = %22AwayNotify%22%0A%09%0A%09def actions(self):%0A%09%09return %5B (%22us... | |
a6ca9fdb71eacffe94fad476712650f82870bb2e | Add base code for choosing solver | pyoommf/sim.py | pyoommf/sim.py | import os
from drivers.llg import LLG
import oommfmif as o
class Sim(object):
def __init__(self, mesh, Ms, name=None):
self.mesh = mesh
self.Ms = Ms
self.name = name
self.gamma = 2.21e5
self.energies = []
self.N_Sims_Run = 0
# Want some kind of persistent '... | Python | 0.000001 | @@ -784,16 +784,173 @@
energy)%0A
+ %0A def set_solver(self, solver='rk4'):%0A %22%22%22%0A Available solvers in OOMMF:%0A rk2, rk2heun, rk4, rkf54, rkf54m, rkf54s %0A %22%22%22
%0A def
|
cc78dc401b16ff189b86466e3c0cb4609a72af0d | add tester | batch/depute/test.py | batch/depute/test.py | Python | 0.000001 | @@ -0,0 +1,1514 @@
+#!/usr/bin/env python%0A%0Aimport os, sys, json%0A%0Asplit = False%0Asplitval = False%0Aif len(sys.argv) %3E 1:%0A field = sys.argv%5B1%5D%0A if len(sys.argv) %3E 2:%0A split = True%0A if len(sys.argv) %3E 3:%0A splitval = int(sys.argv%5B3%5D)%0Aelse:%0A field = %22... | |
b674a3e4de86728139e97bb02fa90a62a7700c31 | add speech processing test | testing/miniBrain.py | testing/miniBrain.py | Python | 0.000001 | @@ -0,0 +1,2561 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0Aimport sys%0Aimport time%0Afrom os.path import dirname, abspath%0Asys.path.append(dirname(dirname(abspath(__file__))))%0Areload(sys)%0Asys.setdefaultencoding('utf-8')%0A%0Afrom EmeraldAI.Pipelines.InputProcessing.ProcessInput import ProcessInput%0Afrom E... | |
842c796a223ee9cb78c69ccb59416a2afe0fcee0 | Add tests for Permission class. | tests/permissions.py | tests/permissions.py | Python | 0 | @@ -0,0 +1,1701 @@
+import unittest%0Afrom permission import Permission, PERMISSION_DELIMITER%0A%0A%0Aclass BasicPermissionTests(unittest.TestCase):%0A%0A def setUp(self):%0A self.p1 = Permission(%22test%7B0%7D1%7B0%7Dhello%22.format(PERMISSION_DELIMITER))%0A self.p2 = Permission(%22test%7B0%7D2%7B0%7D... | |
cb7d205add1d6e114277e596b2023c755dd1ff19 | add an example unit test | tests/test_docker.py | tests/test_docker.py | Python | 0 | @@ -0,0 +1,1391 @@
+%22%22%22 run with%0A%0Apython setup.py install; pip install . ; nosetests -v --nocapture tests/docker/test_docker.py%0Apython setup.py install; pip install . ; nosetests -v --nocapture tests/docker/test_docker.py:Test_docker.test_001%0A%0Anosetests -v --nocapture tests/cm_basic/test_var.py%0A%0Aor%... | |
4e0476fa83d0832c328abf00b5167887a0af3fe6 | Add tests for hashes | tests/test_hashes.py | tests/test_hashes.py | Python | 0.000001 | @@ -0,0 +1,244 @@
+from webhooks.hashes import placebo_hash_function, basic_hash_function%0A%0A%0Adef test_placebo():%0A assert placebo_hash_function() == %22%22%0A%0A%0Adef test_basic():%0A hashes = set(%5Bbasic_hash_function() for x in range(30)%5D)%0A assert len(hashes) == 30%0A
| |
ef8ca51dbd9b93a801a4a87be3c04f2c56cdef5a | test for call to enqueue passing | tests/test_server.py | tests/test_server.py | Python | 0 | @@ -0,0 +1,876 @@
+import hashlib%0Aimport json%0Afrom unittest.mock import Mock%0Afrom unittest.mock import ANY%0A%0Afrom queue_functions import do_work%0Afrom server import handle_post%0Afrom uploaders.s3 import get_url%0Afrom uploaders.s3 import upload%0A%0Adef test_post():%0A q = Mock()%0A filename = 'afakefi... | |
b73e125fdcb12649e79aa2e108dcc019d9fffeb0 | add strtol test | tests/test_strtol.py | tests/test_strtol.py | Python | 0.000043 | @@ -0,0 +1,1229 @@
+import nose%0Aimport angr%0Aimport subprocess%0A%0Aimport logging%0Al = logging.getLogger('angr.tests.strtol')%0A%0Aimport os%0Atest_location = str(os.path.dirname(os.path.realpath(__file__)))%0A%0A%0Adef test_strtol():%0A b = angr.Project(os.path.join(test_location, %22../../binaries/tests/x86_6... | |
f5d2b17371dbd974820b9b8ab1fcdb11ad8fa646 | Add in script to count duplicates. | backend/scripts/countdups.py | backend/scripts/countdups.py | Python | 0 | @@ -0,0 +1,406 @@
+#!/usr/bin/env python%0A%0Aimport rethinkdb as r%0A%0Aconn = r.connect('localhost', 30815, db='materialscommons')%0Arql = r.table('datafiles').filter(r.row%5B'usesid'%5D.match(%22%5E%5B0-9a-f%5D%22)).pluck('size')%0Atotal_bytes = 0%0Atotal_files = 0%0Afor doc in rql.run(conn):%0A total_bytes = tot... | |
8488e7c5245758e4651e6d723f93d52f3ff54d73 | Add tool for submitting jobs to AreWeCompressedYet | tools/submit_awcy.py | tools/submit_awcy.py | Python | 0 | @@ -0,0 +1,1122 @@
+#!/usr/bin/env python%0A%0Afrom __future__ import print_function%0A%0Aimport requests%0Aimport argparse%0Aimport os%0Aimport subprocess%0Aimport sys%0A%0Aif 'DAALA_ROOT' not in os.environ:%0A print(%22Please specify the DAALA_ROOT environment variable to use this tool.%22)%0A sys.exit(1)%0A%0A... | |
0c145918d0f34bee1193eeaa0488eb369f0e843e | Use item_lookup_field for DELETE methods | eve/methods/delete.py | eve/methods/delete.py | # -*- coding: utf-8 -*-
"""
eve.methods.delete
~~~~~~~~~~~~~~~~~~
This module imlements the DELETE method.
:copyright: (c) 2013 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
from flask import current_app as app, abort
from eve.utils import config
from eve.auth import requir... | Python | 0 | @@ -1133,22 +1133,24 @@
source,
-lookup
+original
%5Bconfig.
|
837089f9195af984597522fffc8c2c6a02e73097 | Create config.example.py | scripts/eurotram/config.example.py | scripts/eurotram/config.example.py | Python | 0.000003 | @@ -0,0 +1,173 @@
+dbname='gis'%0Auser='trolleway'%0Ahost='localhost'%0Apassword='admin'%0A%0Angw_url='http://trolleway.nextgis.com'%0Angw_resource_id=%0Angw_login = 'administrator'%0Angw_password = 'admin' %0A
| |
4d30756e722cafa40fa449e48c967eeebc58500a | Add a manage.py command to import realm filters | zerver/management/commands/import_realm_filters.py | zerver/management/commands/import_realm_filters.py | Python | 0 | @@ -0,0 +1,930 @@
+from __future__ import absolute_import%0A%0Afrom django.core.management.base import BaseCommand%0A%0Afrom zerver.models import RealmFilter, get_realm%0A%0Aimport logging%0A%0Aclass Command(BaseCommand):%0A help = %22%22%22Imports realm filters to database%22%22%22%0A%0A def handle(self, *args, ... | |
c7fa4500b22104b34b50bbcacc3b64923d6da294 | Add a parser for plain text | trex/parsers.py | trex/parsers.py | Python | 0.000945 | @@ -0,0 +1,966 @@
+# -*- coding: utf-8 -*-%0A#%0A# (c) 2014 Bjoern Ricks %3Cbjoern.ricks@gmail.com%3E%0A#%0A# See LICENSE comming with the source of 'trex' for details.%0A#%0A%0Afrom io import TextIOWrapper%0A%0Afrom rest_framework.parsers import BaseParser%0A%0A%0Aclass PlainTextParser(BaseParser):%0A%0A media_type... | |
72d7e2a37bec5f7ae904ed2119dd8c30c22801fb | Add clinvar bot users | gennotes_server/migrations/0002_add_clinvar_bot_users.py | gennotes_server/migrations/0002_add_clinvar_bot_users.py | Python | 0 | @@ -0,0 +1,555 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.contrib.auth import get_user_model%0Afrom django.db import migrations%0A%0A%0Adef add_clinvar_bot_users(apps, schema_editor):%0A usernames = %5B'clinvar-variant-importer', 'clinvar-data-importer'%5D%0A for userna... | |
68b991404ee7bd3bde1300d456a46d863ff4d54a | Set styles on current selection | chat/richtext.py | chat/richtext.py | #!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import pango
import xml.sax
class RichTextBuffer(gtk.TextBuffer):
def __init__(self):
gtk.TextBuffer.__init__(self)
self.connect_after("insert-text", self.__insert_text_cb)
self.__create_tags()
self.active_tags = []
def apply_tag(se... | Python | 0 | @@ -368,77 +368,266 @@
me)%0A
-%0A%09def unapply_tag(self, tag_name):%0A%09%09self.active_tags.remove(tag_name
+%09%09%0A%09%09%5Bstart, end%5D = self.get_selection_bounds()%0A%09%09self.apply_tag_by_name(tag_name, start, end)%0A%0A%09def unapply_tag(self, tag_name):%0A%09%09self.active_tags.remove(tag_name)%0A%0A%09%... |
d56515878d4a1d4d56a10426fe5d6c45de97a671 | Create servos.py | gadgets/motors/servos.py | gadgets/motors/servos.py | Python | 0.000022 | @@ -0,0 +1,529 @@
+from gadgets.th_gpio import TH_GPIO%0Aimport time %0A%0Aclass Servo5V():%0A%09def __init__(self,pin_number=12,freq=100):%0A%09%09self.pin_number = pin_number%0A%09%09self.freq = freq%0A%09%09self.pwm = TH_GPIO().pwm_create(self.pin_number,freq=self.freq)%0A%09%09self.width = float(1000/self.freq)%0A%... | |
0a074f3af770f049cf6f112bdc7fa5ae35c4a6dc | Create Run.py | ImageNet/Run.py | ImageNet/Run.py | Python | 0.000001 | @@ -0,0 +1,2004 @@
+# From https://groups.google.com/a/tensorflow.org/forum/#!topic/discuss/4xjc7tSrb18 %0A %0Afrom __future__ import absolute_import%0Afrom __future__ import division%0Afrom __future__ import print_function%0A %0Aimport os, math, time%0Aimport cv2, csv%0Aimport numpy as np%0Aimport tensorflow as tf%0Ai... | |
99f2130476064062c3dd6338163010df53d60594 | Bootstrap output | output.py | output.py | Python | 0.999999 | @@ -0,0 +1,137 @@
+import colour%0Aimport csv%0Aimport json%0A%0A# export as json, csv, textfile or output to console%0A%0A%0Adef write_data(data, format=None):%0A pass%0A
| |
b453943f86f97e38e52af3a1b048ee93b0177df8 | add a test to make sure we don't have any more missing migrations | axes/tests/test_models.py | axes/tests/test_models.py | Python | 0 | @@ -0,0 +1,1023 @@
+from django.test import TestCase%0A%0A%0Aclass MigrationsCheck(TestCase):%0A def setUp(self):%0A from django.utils import translation%0A self.saved_locale = translation.get_language()%0A translation.deactivate_all()%0A%0A def tearDown(self):%0A if self.saved_locale ... | |
1e7aee8c5597a7ccd9f2bc8f4e05e3ae489c3bfd | Add bot.py to run as an actual bot, via pywikibot | src/bot.py | src/bot.py | Python | 0 | @@ -0,0 +1,3069 @@
+from app import *%0Afrom time import sleep%0Aimport pywikibot%0A%0Adef run_bot(template_param, access_token=None, site=None, max_edits=100000):%0A cached_pages = list_cache_contents('bot_cache/')%0A edits_made = 0%0A for page_name in cached_pages:%0A print(page_name)%0A cache_... | |
eb517e5b323ea183571b9d4967f46821729dd3e7 | add part 6 | part_6.py | part_6.py | Python | 0.000012 | @@ -0,0 +1,414 @@
+# Let's try to draw a point moving on a line%0A# To make things simple, we are going back to 1D%0A%0Apos = 1%0Avelo = 1%0A%0A# Since there are multiple positions at a time, we can represent as a list%0Aline_1 = %5B' ', ' ', ' '%5D%0Aline_2 = 3*%5B' '%5D%0A%0A# Note how they are equal statements%0Apri... | |
98a6fd1b1d095d6babc55c5d415c2450743fdba6 | Add antibody audits | src/encoded/audit/antibody_lot.py | src/encoded/audit/antibody_lot.py | Python | 0 | @@ -0,0 +1,2355 @@
+from snovault import (%0A AuditFailure,%0A audit_checker,%0A)%0Afrom .conditions import rfa%0A%0A%0A@audit_checker('antibody_lot', frame=%5B'characterizations'%5D,%0A condition=rfa('ENCODE3', 'modERN'))%0Adef audit_antibody_missing_characterizations(value, system):%0A '''%0A ... | |
e8560c42e3ae73f1753073b8ad6aef7d564e6d65 | Implement basic active monitoring algorithm | Host/original.py | Host/original.py | Python | 0.000018 | @@ -0,0 +1,1067 @@
+import sys%0Afrom functools import reduce%0A%0AtempVmId = -1%0A%0Adef enhancedActiveVMLoadBalancer(vmStateList, currentAllocationCounts):%0A '''%0A vmStateList: Dict%3CvmId, vmState%3E%0A currentAllocationCounts: Dict%3CvmId, currentActiveAllocationCount%3E%0A '... | |
0a5e419dd91317d3a9d755cc5e8ee32c3a68d4af | Fix dates in show pending notifications | src/ggrc/notification/__init__.py | src/ggrc/notification/__init__.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: mouli@meics.org
# Maintained By: miha@reciprocitylabs.com
from collections import defaultdict
from freezegun import freeze_time
from datetime impo... | Python | 0 | @@ -320,16 +320,26 @@
ort date
+, datetime
%0Afrom gg
@@ -1909,16 +1909,78 @@
ta = %7B%7D%0A
+ today = datetime.combine(date.today(), datetime.min.time())%0A
for da
@@ -2013,24 +2013,58 @@
teritems():%0A
+ current_day = max(day, today)%0A
with fre
@@ -2072,16 +2072,24 @@
ze_time(
+current_
day):%0A
... |
b7e09bb39aa6161215799960bd5fda33a882e40f | fix docstring | 01_basics/03_advanced_expressions/01_basic_indexing_soln.py | 01_basics/03_advanced_expressions/01_basic_indexing_soln.py | Python | 0.000018 | @@ -0,0 +1,547 @@
+# Fill in the TODOs in this exercise, then run the script to see if your%0A# solution works.%0Aimport numpy as np%0Aimport theano.tensor as T%0A%0Adef increment_odd(x):%0A %22%22%22%0A x: a Theano vector%0A Returns:%0A y: a Theano vector equal to x, but with all odd-numbered elements%0A ... | |
787b46749a26f8078c1ac4e914aea7fbd0ced8c6 | Add test for checking if privatecode in journey's is unique per day | bin/test.py | bin/test.py | Python | 0 | @@ -0,0 +1,1432 @@
+import helper%0Aimport logging%0Aimport psycopg2%0Afrom settings.const import database_connect%0A%0Aconn = psycopg2.connect(database_connect)%0Acur = conn.cursor()%0Acur.execute(%22%22%22%0ASELECT j.id,jp.operator_id,j.operator_id FROM%0A(select journeypatternref,count(distinct pointorder) as points... | |
3693b1aea769af1e0fbe31007a00f3e33bcec622 | Add function to solve two pair sum | aids/sorting_and_searching/pair_sum.py | aids/sorting_and_searching/pair_sum.py | Python | 0.002605 | @@ -0,0 +1,934 @@
+'''%0AGiven an integer array, output all pairs that sum up to a specific value k%0A%0A'''%0A%0Afrom binary_search import binary_search_iterative%0A%0Adef pair_sum_sorting(arr, k):%0A%09'''%0A%09Using sorting - O(n logn)%0A%0A%09'''%0A%09number_of_items = len(arr)%0A%09if number_of_items %3C 2:%0A%09%... | |
72cfd9b52e860aaaca05e7ef7941d0b4e17ad95f | Add vocab_word.py | vocab_word.py | vocab_word.py | Python | 0.998753 | @@ -0,0 +1,2216 @@
+import cv2%0Aimport numpy as np%0A%0Afrom os import listdir%0Afrom os.path import isfile, join%0Afrom numpy import *%0Afrom scipy.cluster.vq import kmeans,vq%0A%0Adef buildVocabulary(path,k,grid_m,grid_n):%0A files = %5B f for f in listdir(path) if isfile(join(path,f)) %5D%0A dict_vocab = arra... | |
9a67d63650b751c7b876f248bb3d82e619b37725 | Add new script to create a list of words from frequencies | frequenciesToWords.py | frequenciesToWords.py | Python | 0 | @@ -0,0 +1,1727 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A# Spell corrector - http://www.chiodini.org/%0A# Copyright %C2%A9 2015 Luca Chiodini %3Cluca@chiodini.org%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 Lice... | |
50e9418ade654360ce2feb2d22e4dae3eca691ea | make copytree can copy recursively | simiki/utils.py | simiki/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, absolute_import
import os
import os.path
import shutil
import errno
import logging
logger = logging.getLogger(__name__)
COLOR_CODES = {
"reset": "\033[0m",
"black": "\033[1;30m",
"red": "\033[1;31m",
... | Python | 0.000004 | @@ -1587,39 +1587,32 @@
s):%0A
-shutil.
copytree(s, d, s
|
875fd0f57b1cbead04bd60b7d8c19cd1f106595a | add example python server | Server/server.py | Server/server.py | Python | 0 | @@ -0,0 +1,2305 @@
+#!/usr/bin/env python%0Aimport tornado.ioloop%0Aimport tornado.web%0Aimport tornado.websocket%0A%0Afrom tornado.options import define, options, parse_command_line%0A%0Aimport os%0Aimport json%0Aimport uuid%0A%0Adefine(%22port%22, default=8888, help=%22run on the given port%22, type=int) %0A %0... | |
4535d6c41e17031b943e7016fc7de6f76b890f17 | Put the test into the correct directory. | test/lib/test_inputsource.py | test/lib/test_inputsource.py | Python | 0.999992 | @@ -0,0 +1,881 @@
+########################################################################%0A# test/xslt/test_inputsource.py%0A%0Aimport os%0Afrom amara.lib import inputsource, iri, treecompare%0A%0Amodule_dir = os.path.dirname(os.path.abspath(__file__))%0A%0Arlimit_nofile = 300%0Atry:%0A import resource%0Aexcept I... | |
5bbb2a994397374356964b1db4c23b6b8ff5c848 | Add the 'version' variable. | TODO/__init__.py | TODO/__init__.py | Python | 0.001248 | @@ -0,0 +1,1610 @@
+# The MIT License%0A#%0A# Copyright (c) 2016 Jeremie DECOCK (http://www.jdhp.org)%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining a copy%0A# of this software and associated documentation files (the %22Software%22), to deal%0A# in the Software without restriction, includ... | |
fcd96cb766f3211a185a3aadbd7c8dde795134ca | Add ILCommand class | il_commands.py | il_commands.py | Python | 0 | @@ -0,0 +1,2067 @@
+%22%22%22Classes representing IL commands, including procedures to generate asm code%0Afrom a given IL command.%0A%0A%22%22%22%0A%0Aimport spots%0A%0Aclass ILCommand:%0A %22%22%22Base interface for all IL commands%22%22%22%0A def __init__(self):%0A raise NotImplementedError%0A%0A def... | |
0cf909cce9ba47f34297e87ae800f49b7ea4e18a | Correct ci failed tests | homeassistant/components/thermostat/radiotherm.py | homeassistant/components/thermostat/radiotherm.py | """
homeassistant.components.thermostat.radiotherm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adds support for Radio Thermostat wifi-enabled home thermostats
"""
import logging
from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL,
STATE_IDLE, STAT... | Python | 0.000001 | @@ -1076,15 +1076,8 @@
rror
- as err
:%0A
@@ -1089,17 +1089,17 @@
logger.
-E
+e
xception
@@ -3075,16 +3075,30 @@
e.t_heat
+ = temperature
%0A%0A de
|
732898dc4858ae5cfc7eac3e470069ac702f6c12 | Add a command for deactivating a generation | mapit/management/commands/mapit_generation_deactivate.py | mapit/management/commands/mapit_generation_deactivate.py | Python | 0.000004 | @@ -0,0 +1,1440 @@
+# This script deactivates a particular generation%0A%0Afrom optparse import make_option%0Afrom django.core.management.base import BaseCommand%0Afrom mapit.models import Generation%0A%0Aclass Command(BaseCommand):%0A help = 'Deactivate a generation'%0A args = '%3CGENERATION-ID%3E'%0A option_... | |
404ede26f42a29520f845c3df1650cf70080de5f | Fix Windows compatibility (again) | botogram/bot.py | botogram/bot.py | """
botogram.bot
The actual bot application base
Copyright (c) 2015 Pietro Albini <pietro@pietroalbini.io>
Released under the MIT license
"""
import re
import logbook
import uuid
import requests.exceptions
from . import api
from . import objects
from . import runner
from . import defaults
from . imp... | Python | 0 | @@ -2807,39 +2807,32 @@
hook%22%22%22%0A
-return
self._main_compo
@@ -2860,32 +2860,52 @@
ssing_hook(func)
+%0A return func
%0A%0A def proces
@@ -2974,31 +2974,24 @@
%22%22%22%0A
-return
self._main_c
@@ -3029,16 +3029,36 @@
ok(func)
+%0A return func
%0A%0A de
|
f04d683d44507a53be39a2db54d545d2f2a1361b | Add example settings module | settings_example.py | settings_example.py | Python | 0 | @@ -0,0 +1,655 @@
+import os%0Aimport re%0A%0Afrom imap import EmailCheckError, EmailServer%0Afrom postgresql import DatabaseServer%0A%0A%0ACSV_FOLDER = os.getcwd()%0A%0A# Restrict emails by sender.%0AEMAIL_FROM = 'sender@example.com'%0A%0A# Restrict emails by subject.%0AEMAIL_SUBJECT_RE = re.compile(''.join(%5B%0A%09r... | |
29c20a662f347e720c5228f0853eaa6ac0164379 | Create ScreenSocket.py | ScreenSocket.py | ScreenSocket.py | Python | 0.000001 | @@ -0,0 +1,1813 @@
+#!/usr/bin/env python%0A%0A##--Zachary Trette%0A##-- accepts commands for screen responses%0A##-- EV3- Remote - https://github.com/flyinactor91/EV3-Remote%0A%0A## 2013-12-1%0A%0Afrom socket import *%0Aimport sys, os%0Aimport pygame%0Afrom pygame.locals import *%0A%0Adef setup():%0A pygame.init()%... | |
d79ed2b4aa8315579688f4c6e9bfc8980e9717e3 | Create chghost.py | merc/features/ircv32/chghost.py | merc/features/ircv32/chghost.py | Python | 0.000003 | @@ -0,0 +1,1351 @@
+from merc import capability%0Afrom merc import feature%0Afrom merc import message%0A%0A%0Aclass ChgHostFeature(feature.Feature):%0A NAME = __name__%0A%0A%0Ainstall = ChgHostFeature.install%0A%0A%0A@ChgHostFeature.register_user_capability%0Aclass ChgHostCapability(capability.Capability):%0A NAME = ... | |
d4a7cdd400fe29458cc584455c7b082efed99e2b | Add files via upload | timedscripts/rollupwinlog.py | timedscripts/rollupwinlog.py | Python | 0 | @@ -0,0 +1,1132 @@
+import requests%0D%0Aimport json%0D%0Aimport pandas as pd%0D%0Aimport sqlite3%0D%0Afrom datetime import date%0D%0Afrom datetime import datetime%0D%0Afrom dateutil import parser%0D%0Aimport time%0D%0A%0D%0ASERVER = '10.24.25.130:8000'%0D%0Aconn = sqlite3.connect('usersrollup.db')%0D%0Ac = conn.cursor... | |
98fbfe6e65c4cb32ea0f4f6ce6cba77f7fadcb7b | Add test for vendor object creation | app/api/tests/test_vendor_api.py | app/api/tests/test_vendor_api.py | Python | 0 | @@ -0,0 +1,2369 @@
+from django.test import Client, TestCase%0A%0Afrom .utils import obtain_api_key, create_admin_account%0A%0A%0Aclass VendorApiTest(TestCase):%0A %22%22%22Test for Vendor API.%22%22%22%0A%0A def setUp(self):%0A self.client = Client()%0A self.endpoint = '/api'%0A self.admin_t... | |
2cd2d7a20f2d19221b40aac9bfa1303dbfd97459 | create metashare.wsgi | metashare/apache/metashare.wsgi | metashare/apache/metashare.wsgi | Python | 0 | @@ -0,0 +1,360 @@
+import os%0Aimport sys%0A%0Apath = '/var/www/CEF-ELRC'%0Aif path not in sys.path:%0A sys.path.insert(0, path)%0Asys.path.insert(0, '%7B0%7D/metashare'.format(path))%0Asys.path.append('%7B0%7D/lib/python2.7/site-packages'.format(path))%0A%0Aos.environ%5B'DJANGO_SETTINGS_MODULE'%5D = 'metashare.setting... | |
123959bc3594299c2f1d4c54b11a996e92147347 | Add missing migration | system_maintenance/migrations/0002_auto_20181214_2122.py | system_maintenance/migrations/0002_auto_20181214_2122.py | Python | 0.0002 | @@ -0,0 +1,1399 @@
+# Generated by Django 2.1.4 on 2018-12-14 21:22%0A%0Afrom django.db import migrations%0Aimport markupfield_helpers.helpers%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('system_maintenance', '0001_initial'),%0A %5D%0A%0A operations = %5B%0A migrat... | |
880fb0c36e2adbe810e1b516cdd73ad3283ed859 | use server_address, as we need auth | modules/recently_added.py | modules/recently_added.py | from flask import Flask, render_template, send_file
import jsonrpclib
import urllib
from Maraschino import app
from settings import *
from maraschino.noneditable import *
from maraschino.tools import *
@app.route('/xhr/recently_added')
@requires_auth
def xhr_recently_added():
return render_recently_added_episodes... | Python | 0 | @@ -1261,21 +1261,16 @@
fs/' %25 (
-safe_
server_a
|
b080ae154cc8e948e3f4e7b79bfbde0221a31e61 | Add devices detected by ping as SOURCE_TYPE_ROUTER instead of GPS (#5625) | homeassistant/components/device_tracker/ping.py | homeassistant/components/device_tracker/ping.py | """
Tracks devices by sending a ICMP ping.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.ping/
device_tracker:
- platform: ping
count: 2
hosts:
host_one: pc.local
host_two: 192.168.2.25
"""
import logging
import sub... | Python | 0 | @@ -486,16 +486,36 @@
INTERVAL
+, SOURCE_TYPE_ROUTER
)%0Afrom h
@@ -2048,16 +2048,48 @@
f.dev_id
+, source_type=SOURCE_TYPE_ROUTER
)%0A
|
cebaba60bf12b00ce267fb84cb3029eb318041c2 | Flask hello world | synthia.py | synthia.py | Python | 0.999432 | @@ -0,0 +1,110 @@
+from flask import Flask%0Aapp = Flask(__name__)%0A%0A%0A@app.route('/')%0Adef hello_world():%0A return 'Hello, world.'%0A
| |
7c33e8c7a386e911d835f81e637515d40dfc4e62 | Add a Laplace equation solving benchmark (from Numpy) | benchmarks/bench_laplace.py | benchmarks/bench_laplace.py | Python | 0.000031 | @@ -0,0 +1,861 @@
+%22%22%22%0ABenchmark Laplace equation solving.%0A%0AFrom the Numpy benchmark suite, original code at%0Ahttps://github.com/yarikoptic/numpy-vbench/commit/a192bfd43043d413cc5d27526a9b28ad343b2499%0A%22%22%22%0A%0Aimport numpy as np%0A%0Afrom numba import jit%0A%0A%0Adx = 0.1%0Ady = 0.1%0Adx2 = (dx * d... | |
4d8845e05cd58d507a00d9a85fbf8caf845fbb3a | implement the `can_import` (for a user) and `is_active` (global config). | oneflow/core/gr_import.py | oneflow/core/gr_import.py | # -*- coding: utf-8 -*-
"""
1flow "core" application. It's an Ember.JS based application, which
explains why we don't have much things here. Everything takes place
in the static/ and templates/ directories.
"""
import time
import redis
import logging
import datetime
import simplejson as json
from django.... | Python | 0 | @@ -310,35 +310,147 @@
rom
-django.conf import settings
+constance import config%0Afrom django.conf import settings%0Afrom django.contrib.auth import get_user_model%0A%0Afrom .models.nonrel import Article
%0A%0ALO
@@ -664,16 +664,41 @@
', 0))%0A%0A
+User = get_user_model()%0A%0A
ftstamp
@@ -731,16 +731,44 @@
mes... |
9a3c5517446a2f26875925b1c42607ea6aa31b29 | Implementing the first step of the Web App Flow. | getAuthenticationCode.py | getAuthenticationCode.py | Python | 0.998887 | @@ -0,0 +1,1607 @@
+#!/usr/bin/env python%0A#---------------------------------------------------------------------------%0A# Copyright 2013 Kitware Inc.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a c... | |
8956ee3bd89b12da20ebb1946d41c4133467ae79 | Add py-pure-eval (#19180) | var/spack/repos/builtin/packages/py-pure-eval/package.py | var/spack/repos/builtin/packages/py-pure-eval/package.py | Python | 0.000002 | @@ -0,0 +1,754 @@
+# 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 PyPureEval(PythonPackage):%0A %22%22%22This is a Python ... | |
6d1eda812d57c6c251fb037b005103172de886af | Update __init__.py | erpnext/__init__.py | erpnext/__init__.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import frappe
__version__ = '7.1.0-beta'
def get_default_company(user=None):
'''Get default company for user'''
from frappe.defaults import get_user_default_as_list
if not user:
user = frappe.session.user
companies = get_user_default_as_list(user... | Python | 0.000072 | @@ -93,16 +93,12 @@
'7.
-1.0-beta
+0.63
'%0A%0Ad
|
f0bd64992b05b0e7edd4b1ac6e99e1cd9db213d6 | Create search.py | search.py | search.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
c74a9943bbd9e7908ba884e0fea5b3390e8d668e | add migration | wastd/observations/migrations/0004_auto_20160905_1943.py | wastd/observations/migrations/0004_auto_20160905_1943.py | Python | 0.000001 | @@ -0,0 +1,3490 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.9 on 2016-09-05 11:43%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport wastd.observations.models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('observations', '... | |
9115628cf10e194f1975e01142d8ae08ab5c4b06 | Add test for pandas dataframe loading | joommf/test_odtreader.py | joommf/test_odtreader.py | Python | 0.000001 | @@ -0,0 +1,1206 @@
+def test_odtreader_dynamics_example():%0A from joommf.sim import Sim%0A from joommf.mesh import Mesh%0A from joommf.energies.exchange import Exchange%0A from joommf.energies.demag import Demag%0A from joommf.energies.zeeman import FixedZeeman%0A from joommf.drivers import evolver%0... | |
64d8f45e1868fd73415e8f1fe6acc21868d45fa7 | Add rfreceiver mode selector | catkin/src/appctl/scripts/rfreceiver_mode_select.py | catkin/src/appctl/scripts/rfreceiver_mode_select.py | Python | 0 | @@ -0,0 +1,943 @@
+#!/usr/bin/env python%0A%0A%22%22%22%0AThis node listens for keyfob button presses and changes the mode accordingly.%0A%22%22%22%0A%0Aimport rospy%0Afrom appctl.msg import Mode%0Afrom std_msgs.msg import Byte%0A%0A%0Aclass ButtonHandler:%0A def __init__(self, modes, mode_pub):%0A self.modes... | |
9e58f5507ba0a128c696bdec218d244df27feb87 | add list_graspability script | jsk_arc2017_common/scripts/list_graspability.py | jsk_arc2017_common/scripts/list_graspability.py | Python | 0.000001 | @@ -0,0 +1,303 @@
+#!/usr/bin/env python%0A%0Aimport jsk_arc2017_common%0A%0Agraspability = jsk_arc2017_common.get_object_graspability()%0Afor obj_id, obj in enumerate(graspability):%0A print('%7B:02%7D: %7B%7D'.format(obj_id+1, obj))%0A for style in graspability%5Bobj%5D:%0A print(' %7B%7D: %7B%7D'.for... | |
bdc04453938366e28ff91b6e16c536eca84d8bef | add summary generator | summary.py | summary.py | Python | 0.000001 | @@ -0,0 +1,2994 @@
+#!/usr/bin/env python%0A%0Aimport os%0Aimport json%0Aimport argparse%0Afrom argparse import ArgumentDefaultsHelpFormatter%0A%0Afrom time import gmtime, strftime, mktime%0Aimport datetime%0A%0A%0Aclass DatetimeConverter(object):%0A TIME_STR_FORMAT = '%25Y-%25m-%25dT%25H:%25M:%25S'%0A%0A @static... | |
d75c519eb4c3b276f04ba58277d03801c8568ff0 | Create 4.py | solutions/4.py | solutions/4.py | Python | 0.000001 | @@ -0,0 +1,448 @@
+# A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 %C3%97 99.%0A# Find the largest palindrome made from the product of two 3-digit numbers.%0A%0Adef main():%0A max =0%0A for i in range(999,900,-1):%0A for j in... | |
21ddecb7804501476d35290b0b0cb2b7311728ab | add hello world tornado | server.py | server.py | Python | 0.999999 | @@ -0,0 +1,400 @@
+import tornado.ioloop%0Aimport tornado.web%0A%0A%0Aclass MainHandler(tornado.web.RequestHandler):%0A def data_received(self, chunk):%0A pass%0A%0A def get(self):%0A self.write(%22Hello, world%22)%0A%0A%0Adef make_app():%0A return tornado.web.Application(%5B%0A (r%22/%22,... | |
19cfaf8534626e5c6b5193da40a17cc092b24758 | Use tuple instead of a list for DEFAULT_VIEWPORT_VIRTUAL_TAGS | taskwiki/constants.py | taskwiki/constants.py | DEFAULT_VIEWPORT_VIRTUAL_TAGS = ["-DELETED", "-PARENT"]
DEFAULT_SORT_ORDER = "due+,pri-,project+"
| Python | 0.000366 | @@ -29,9 +29,9 @@
S =
-%5B
+(
%22-DE
@@ -51,9 +51,9 @@
ENT%22
-%5D
+)
%0ADEF
|
d93dada0fe434cd736d11b9cfb1635146130f24a | Add 031 | 031/main.py | 031/main.py | Python | 0.00051 | @@ -0,0 +1,718 @@
+# Integers avoid having to rely on decimal.Decimal%0A# to handle rounding errors%0ACOINS = 1, 2, 5, 10, 20, 50, 100, 200%0ATARGET = 200%0A%0A%0Avisited = set()%0Asolutions = %5B%5D%0Astack = %5B(0, (0,) * len(COINS))%5D%0A%0Awhile stack:%0A total, state = stack.pop()%0A for cn, coin in enumerat... | |
eaace54d5e7d8d2ebad42cf31cf071a9cf9d3e50 | test case for creating a new story | umklapp/test.py | umklapp/test.py | Python | 0.00035 | @@ -0,0 +1,584 @@
+from django.test import TestCase%0Afrom django.test.utils import override_settings%0A%0Afrom umklapp.models import *%0A%0Aclass UmklappTestCase(TestCase):%0A def addUsers(self):%0A self.users = %5B%5D%0A for i in range(0,7):%0A u = User.objects.create_user(%0A ... | |
d20e468a32d1f476196525848688ae64845c4dce | Add Python solution | sg-ski.py | sg-ski.py | Python | 0.000444 | @@ -0,0 +1,2694 @@
+#!/usr/bin/env python%0A%0Aimport sys%0A%0Adef parse_map_file(path):%0A map_grid = %5B%5D%0A with open(path, 'r') as f:%0A width, height = map(int, f.readline().split())%0A for line in f:%0A row = map(int, line.split())%0A map_grid.append(row)%0A assert h... | |
78e0135169d2c53b0b99c7811109eb1da040f14d | add bin2h.py | tools/bin2h.py | tools/bin2h.py | Python | 0 | @@ -0,0 +1,814 @@
+#!/usr/bin/env python%0A# vim: set expandtab ts=4 sw=4 tw=100:%0A%0Aimport sys%0Afrom optparse import OptionParser%0A%0Aparser = OptionParser()%0Aparser.add_option(%22-b%22, %22--before%22, dest=%22before%22, action=%22append%22,%0A help=%22text to put before, may be specified more t... | |
a9fb2000638a2fb5d9944254c0d3583f53d2f44c | Exclude MatrixIndexSelectionImageFilter from the filter coverage test - the image test it requires is not available in WrapITK. | Wrapping/WrapITK/Python/Tests/filterCoverage.py | Wrapping/WrapITK/Python/Tests/filterCoverage.py | #!/usr/bin/env python
import sys, re, itk, os
from sys import argv
# python 2.3 compatibility
if sys.version < '2.4' :
# set compatibility
import sets
set = sets.Set
def sorted(iterable, cmp=None, key=None, reverse=False) :
i = list(iterable)
if key :
d = {}
for v in ite... | Python | 0 | @@ -3036,16 +3036,53 @@
ilter%22,%0A
+ %22MatrixIndexSelectionImageFilter%22,%0A
%5D)%0A%0A%0A# g
|
cf8a0105e0c4fc6af04ede6c7ae4fe4f4dac048e | add migrations | accelerator/migrations/0103_update_startupupdate_model.py | accelerator/migrations/0103_update_startupupdate_model.py | Python | 0 | @@ -0,0 +1,3522 @@
+# Generated by Django 2.2.28 on 2022-05-09 11:20%0A%0Afrom django.db import (%0A migrations,%0A models,%0A)%0A%0A%0Aclass Migration(migrations.Migration):%0A dependencies = %5B%0A ('accelerator', '0102_update_program_model'),%0A %5D%0A%0A operations = %5B%0A migrations.A... | |
7014c5affa780044fd46911287d883024bae3fae | Create ipy_custom_hbox.py | basics/layout/ipy_custom_hbox.py | basics/layout/ipy_custom_hbox.py | Python | 0.000003 | @@ -0,0 +1,947 @@
+%0Afrom PySide import QtCore%0Afrom PySide import QtGui%0A%0Aclass MyHBoxLayout(QtGui.QHBoxLayout):%0A def __init__(self, *args, **kwargs):%0A super(MyHBoxLayout, self).__init__(*args, **kwargs)%0A %0A @property%0A def margins(self):%0A return self.contentsMargins()%0A %0... | |
17067d5d25c5ce755ba86505ffcf1dd6fd572deb | Initialize version.py | version.py | version.py | Python | 0.000004 | @@ -0,0 +1,54 @@
+%22%22%22python-tutorials version.%22%22%22%0A__version__ = '1.0.1'%0A
| |
c95ef4dc0771098e3589721851865f012b652136 | add requirements unit test | awx/main/tests/unit/test_python_requirements.py | awx/main/tests/unit/test_python_requirements.py | Python | 0 | @@ -0,0 +1,1448 @@
+from pip.operations import freeze%0Afrom django.conf import settings%0A%0Adef test_req():%0A def check_is_in(src, dests):%0A if src not in dests:%0A src2 = %5Bsrc%5B0%5D.replace('_', '-'), src%5B1%5D%5D%0A if src2 not in dests:%0A print(%22%25s not in%2... | |
1c27ff1533b48bd06debc438369f20f2d86cab0d | Include `Accept: application/json` to satisfy openshift API requirements | ofcourse/cli/openshift_utils.py | ofcourse/cli/openshift_utils.py | """
Author: Ryan Brown <sb@ryansb.com>
License: Apache 2.0
"""
import logging
import os
import pkg_resources
import re
import six
import socket
import uuid
import requests
import time
import oshift
from six.moves import StringIO
import dulwich.porcelain as git
class NotFound(BaseException):
pass
openshift_fil... | Python | 0 | @@ -4027,24 +4027,72 @@
%0A %7D,%0A
+ headers=%7B'Accept': 'application/json'%7D,%0A
)%0A if
|
5f47cf46c82d9a48a9efe5ad11c6c3a55896da12 | Implement abstract class for csc and csr matrix | cupy/sparse/compressed.py | cupy/sparse/compressed.py | Python | 0.000047 | @@ -0,0 +1,2488 @@
+from cupy import cusparse%0Afrom cupy.sparse import base%0Afrom cupy.sparse import data as sparse_data%0A%0A%0Aclass _compressed_sparse_matrix(sparse_data._data_matrix):%0A%0A def __init__(self, arg1, shape=None, dtype=None, copy=False):%0A if isinstance(arg1, tuple) and len(arg1) == 3:%0A... | |
36333c275f4d3a66c8f14383c3ada5a42a197bea | Add module for displaying RAM usage | bumblebee/modules/memory.py | bumblebee/modules/memory.py | Python | 0 | @@ -0,0 +1,854 @@
+import bumblebee.module%0Aimport psutil%0A%0Adef fmt(num, suffix='B'):%0A for unit in %5B %22%22, %22Ki%22, %22Mi%22, %22Gi%22 %5D:%0A if num %3C 1024.0:%0A return %22%7B:.2f%7D%7B%7D%7B%7D%22.format(num, unit, suffix)%0A num /= 1024.0%0A return %22%7B:05.2f%25%7D%7B%7D... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.