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 |
|---|---|---|---|---|---|---|---|
1c2292dcd47865a3dbd3f7b9adf53433f6f34770 | Create new package. (#6215) | var/spack/repos/builtin/packages/r-timedate/package.py | var/spack/repos/builtin/packages/r-timedate/package.py | Python | 0.000002 | @@ -0,0 +1,1696 @@
+##############################################################################%0A# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
5ba4fce42892634213bede09759bbca1cd56e346 | add package py-brian2 (#3617) | var/spack/repos/builtin/packages/py-brian2/package.py | var/spack/repos/builtin/packages/py-brian2/package.py | Python | 0 | @@ -0,0 +1,2297 @@
+##############################################################################%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... | |
26525354e7bf2465a561a5172a0d9fef4205e77d | move column defs to singleton object | chart06columns.py | chart06columns.py | Python | 0.000048 | @@ -0,0 +1,2278 @@
+'''define columns in all reports produced by chart06'''%0Aimport numpy as np%0A%0A%0A# all possible column definition%0A_defs = %7B%0A 'median_absolute_error': %5B6, '%256d', (' ', 'MAE'), 'median absolute error'%5D,%0A 'model': %5B5, '%255s', (' ', 'model'),%0A 'model name (en = ... | |
32740172d4258a95145a5bb68be315fe1640db23 | Add alpha version of bootstraps script | bootstraps.py | bootstraps.py | Python | 0 | @@ -0,0 +1,1389 @@
+''' %0ADoes N times random stacks of X maps of large L in pixels.%0A%0AAt each stacks it gets the central temperature, makes a histogram for all %0Astacks, then fits a normal distribution for the histogram. %0A'''%0A%0AN = 100000%0AX = 10%0AL = 16%0A%0Aimport stacklib as sl%0Aimport numpy as np%0Afr... | |
89b10996cfe6e60870e55b7c759aa73448bfa4d8 | remove off curve pen | pens/removeOffcurvesPen.py | pens/removeOffcurvesPen.py | Python | 0.000001 | @@ -0,0 +1,1916 @@
+## use BasePen as base class%0Afrom fontTools.pens.basePen import BasePen%0A%0Aclass RemoveOffcurvesPen(BasePen):%0A %22%22%22%0A A simple pen drawing a contour without any offcurves.%0A %22%22%22%0A def __init__(self, glyphSet):%0A BasePen.__init__(self, glyphSet)%0A %0A ... | |
10952213496e8a1cbf80ba1eee7a0e968bdea14a | add missing test | corehq/ex-submodules/couchforms/tests/test_errors.py | corehq/ex-submodules/couchforms/tests/test_errors.py | Python | 0.000288 | @@ -0,0 +1,1810 @@
+from django.test import TestCase%0Afrom casexml.apps.case.exceptions import IllegalCaseId%0Afrom corehq.apps.receiverwrapper import submit_form_locally%0Afrom couchforms.models import XFormError%0A%0A%0Aclass CaseProcessingErrorsTest(TestCase):%0A def test_no_case_id(self):%0A %22%22%22%0A... | |
b7d31c8c3fc71a8c65937ab073341d56f2841b85 | Update PkgDistributionCreator.py | MTM_Installer/PkgDistributionCreator.py | MTM_Installer/PkgDistributionCreator.py | #!/usr/bin/env python
#
#
# 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 or agreed to in writing, softw... | Python | 0 | @@ -4776,20 +4776,89 @@
-root
+newtree = root.getroottree()%0A print(type(newtree))%0A newtree
.write('
@@ -4940,24 +4940,25 @@
bution.xml')
+
%0A %0A de
|
f120e2524f09ed462bca52dbc83863ba74291dd5 | Fix backend import. | tests/test_extension.py | tests/test_extension.py | import unittest
from mopidy_gmusic import GMusicExtension, backend as backend_lib
class ExtensionTest(unittest.TestCase):
def test_get_default_config(self):
ext = GMusicExtension()
config = ext.get_default_config()
self.assertIn('[gmusic]', config)
self.assertIn('enabled = true... | Python | 0 | @@ -53,23 +53,21 @@
ension,
-b
ac
-kend
+tor
as back
|
7e15f973f0ee898a0c06e50151ada675be46263d | add basic data, query method and method scaffolds | notifo/notifo.py | notifo/notifo.py | Python | 0.000004 | @@ -0,0 +1,2055 @@
+# encoding: utf-8%0A%0A%22%22%22 notifo.py - python wrapper for notifo.com %22%22%22%0A%0Aimport json%0Aimport urllib%0Aimport urllib2%0A%0Aclass Notifo:%0A %22%22%22 Class for wrapping notifo.com %22%22%22%0A def __init__(self, user, api_secret):%0A self.user = user%0A self.api_... | |
d40fb122d7083b9735728df15120ed682431be79 | Create script for generating analysis seeds. | scripts/make_fhes_seeds.py | scripts/make_fhes_seeds.py | Python | 0 | @@ -0,0 +1,1814 @@
+import yaml%0Aimport sys%0Aimport numpy as np%0Afrom astropy.table import Table%0Afrom astropy.coordinates import SkyCoord%0Afrom fermipy.catalog import *%0Afrom fermipy.utils import *%0A%0A%0Adef get_coord(name,tab):%0A%0A row = tab%5Btab%5B'Source_Name'%5D == name%5D%0A return SkyCoord(float... | |
9696acf13a6b25b1935b7fcaae5763db8e16e83a | Create MyoRemote.py | home/Alessandruino/MyoRemote.py | home/Alessandruino/MyoRemote.py | Python | 0 | @@ -0,0 +1,994 @@
+from com.thalmic.myo.enums import PoseType%0A%0Aremote = Runtime.start(%22remote%22,%22RemoteAdapter%22)%0Aremote.setDefaultPrefix(%22raspi%22)%0Aremote.connect(%22tcp://192.168.0.5:6767%22)%0A%0Aroll = 0.0%0A%0Asleep(2)%0A%0Apython.send(%22raspiarduino%22, %22connect%22,%22/dev/ttyUSB0%22)%0A%0Aslee... | |
6bd3869a2c2a6041e47da01ddaaa15b309bf90d7 | Add example checkerscript | checker/examples/dummyrunner.py | checker/examples/dummyrunner.py | Python | 0 | @@ -0,0 +1,865 @@
+#!/usr/bin/python3%0A%0Aimport sys%0Aimport time%0Aimport os%0Aimport codecs%0A%0Adef generate_flag(tick, payload=None):%0A if payload is None:%0A sys.stdout.write(%22FLAG %25d%5Cn%22 %25 (tick,))%0A else:%0A sys.stdout.write(%22FLAG %25d %25s%5Cn%22 %25 (tick, codecs.encode(os.ur... | |
3026c007a4f9cbb6befa1599c8a8390a96d8396b | test import checks | pychecker2/utest/import.py | pychecker2/utest/import.py | Python | 0 | @@ -0,0 +1,1506 @@
+from pychecker2.TestSupport import WarningTester%0Afrom pychecker2 import ImportChecks%0A%0Aclass ImportTestCase(WarningTester):%0A def testImportChecks(self):%0A self.silent('import sys; print sys.argv')%0A self.silent('import pychecker2; print pychecker2')%0A self.silent('i... | |
5219e970f1b09d8f2d41bf61a3b9f9803a8aed1d | Add database.py with working db find function | python-backend/database.py | python-backend/database.py | Python | 0.000001 | @@ -0,0 +1,530 @@
+from pymongo import MongoClient%0A%0Aclient = MongoClient()%0A%0Aclient = MongoClient('localhost', 27017)%0A%0A# %60community%60 database%0Adb = client.community;%0A%0A# Database find wrapper%0A%0Adef db_find( db_collection, db_query, find_one = False ):%0A%0A # Get collection%0A collection = db%5B... | |
2de5e121164eee707772fb1dfa1e8bef1ca3e80c | fix for built-in ssl (easier to build 32 bits export) | platform/x11/detect.py | platform/x11/detect.py |
import os
import sys
def is_active():
return True
def get_name():
return "X11"
def can_build():
if (os.name!="posix"):
return False
if sys.platform == "darwin":
return False # no x11 on mac for now
errorval=os.system("pkg-config --version > /dev/null")
if (errorval):
print("pkg-co... | Python | 0 | @@ -3037,32 +3037,62 @@
cflags --libs')%0A
+%09if (env(%22openssl%22%5D==%22yes%22):%0A%09
%09env.ParseConfig
|
271dca123ff9bb3004cbd2cfa366f606dd250f94 | Add test for configmap | tests/k8s/test_configmap.py | tests/k8s/test_configmap.py | Python | 0.000001 | @@ -0,0 +1,2359 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8%0A%0Aimport mock%0Aimport pytest%0A%0Afrom k8s.client import NotFound%0Afrom k8s.models.common import ObjectMeta%0Afrom k8s.models.configmap import ConfigMap%0A%0ANAME = %22my-name%22%0ANAMESPACE = %22my-namespace%22%0A%0A@pytest.mark.usefixtures(%22k8s_co... | |
db912d4097da45c2b14cce4f8f852cbc1e720750 | add test framework | tests/test_clientManager.py | tests/test_clientManager.py | Python | 0.000001 | @@ -0,0 +1,387 @@
+from unittest import TestCase%0A%0A%0Aclass TestClientManager(TestCase):%0A def test_add_http_client(self):%0A self.fail()%0A%0A def test_add_local_client(self):%0A self.fail()%0A%0A def test_restrictClient(self):%0A self.fail()%0A%0A def test_load_clients_from_config... | |
401a1aabde600336bd129cce8fb3884ed8945272 | Create HCS_interpreter.py | HCS_interpreter.py | HCS_interpreter.py | Python | 0.000001 | @@ -0,0 +1,490 @@
+#!/usr/bin/env python3%0A%0Afrom HCS import HCS%0A%0Adef interpret_loop():%0A hcs = HCS()%0A while True:%0A print(%22%3E%3E %22, end=%22%22)%0A try:%0A command = input()%0A except EOFError as e:%0A print()%0A return %0A if ... | |
d4a04d4a0fffd8dbb006d86504fc3593ae800cc6 | add bitly shorten function in proper directory | will/plugins/productivity/bitly.py | will/plugins/productivity/bitly.py | Python | 0 | @@ -0,0 +1,891 @@
+# coding: utf-8%0A%0A%0Aimport bitly_api # pip install bitly_api%0A%0Afrom will.plugin import WillPlugin%0Afrom will.decorators import (respond_to, periodic, hear, randomly, route,%0A rendered_template, require_settings)%0A%0Afrom will import settings%0A%0A%0A# BITLY_ACC... | |
6922ad3922d187a3e05d339a49449292a1d7efd6 | add Prototype pattern | prototype/Prototype.py | prototype/Prototype.py | Python | 0 | @@ -0,0 +1,1181 @@
+#%0A# Python Design Patterns: Prototype%0A# Author: Jakub Vojvoda %5Bgithub.com/JakubVojvoda%5D%0A# 2016%0A#%0A# Source code is licensed under MIT License%0A# (for more details see LICENSE)%0A# %0A%0Aimport sys%0Aimport copy%0A%0A#%0A# Prototype%0A# declares an interface for cloning itself%0A#%0Acla... | |
841487ab4d0e05fa6f0780cf39973072417ec701 | Complete cherry-pick of PR#95 | service/management/commands/start_celery.py | service/management/commands/start_celery.py | Python | 0 | @@ -0,0 +1,461 @@
+import os%0Afrom django.core.management.base import BaseCommand%0Afrom subprocess import call%0A%0Aclass Command(BaseCommand):%0A help = 'Custom manage.py command to start celery.'%0A%0A def handle(self, *args, **options):%0A logfile = %22celery_node.log%22%0A if not os.path.isfil... | |
896b7661b06b35ebcdae5cf53620fb1eb69ed07b | remove useless log | cobra/rule.py | cobra/rule.py | # -*- coding: utf-8 -*-
"""
rule
~~~~
Implements rule(languages/frameworks/vulnerabilities/rules)
:author: Feei <feei@feei.cn>
:homepage: https://github.com/wufeifei/cobra
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2017 Feei. All rights reserved
"""
impor... | Python | 0.000001 | @@ -3996,39 +3996,8 @@
%22%22%22%0A
- logger.critical(rules)%0A
|
d1ee86414d45c571571d75434b8c2256b0120732 | Add py solution for 563. Binary Tree Tilt | py/binary-tree-tilt.py | py/binary-tree-tilt.py | Python | 0.005643 | @@ -0,0 +1,624 @@
+# 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%0Aclass Solution(object):%0A def findTilt(self, root):%0A %22%22%22%0A :type root: TreeNode%0A ... | |
34bfea59b600f9dac457e2a16a812ce2fb768d15 | Add graph.py to collect runtime data on workers and tasks (#8) | chtc/graph.py | chtc/graph.py | Python | 0 | @@ -0,0 +1,1195 @@
+#!/usr/bin/env python%0Afrom __future__ import print_function%0A%0Aimport csv%0Aimport itertools%0Aimport time%0A%0Afrom distributed import Client%0A%0A%0ASTART_TIMEOUT = 900 # 15 min%0AMAX_COLLECT_TIME = 86400 # 1 day%0A%0A%0Adef running_task_list(cli):%0A return list(itertools.chain.from_iter... | |
925ff38344b5058ce196877e1fdcf79a1d1f6719 | Add basic test for checking messages are received correctly | ue4/tests/test_messaging.py | ue4/tests/test_messaging.py | Python | 0 | @@ -0,0 +1,378 @@
+import pytest%0A%0Afrom m2u.ue4 import connection%0A%0A%0Adef test_send_message_size():%0A %22%22%22Send a big message, larger than buffer size, so the server has to%0A read multiple chunks.%0A%0A %22%22%22%0A message = %22TestMessageSize %22 + (%22abcdefg%22 * 5000)%0A connection.conn... | |
ff700e5d6fc5e0c5062f687110563d7f0312a3f0 | Set up test suite to ensure server admin routes are added. | server/tests/test_admin.py | server/tests/test_admin.py | Python | 0 | @@ -0,0 +1,2368 @@
+%22%22%22General functional tests for the API endpoints.%22%22%22%0A%0A%0Afrom django.test import TestCase, Client%0A# from django.urls import reverse%0A%0Afrom rest_framework import status%0A%0Afrom server.models import ApiKey, User%0A# from api.v2.tests.tools import SalAPITestCase%0A%0A%0Aclass Ad... | |
1a06292cc1abe86c1d97dd948c0ba2744585ee8b | fix a test failure by adding @prevent_zombie decorator for create_time function on BSD | psutil/_psbsd.py | psutil/_psbsd.py | #!/usr/bin/env python
#
# $Id$
#
import os
import signal
import errno
import pwd
import grp
import _psutil_bsd
# import psutil exceptions we can override with our own
from error import *
# module level constants (gets pushed up to psutil module)
NoSuchProcess = _psutil_bsd.NoSuchProcess
NUM_CPUS = _psutil_bsd.get_n... | Python | 0.000004 | @@ -3148,37 +3148,16 @@
s(pid)%0A%0A
- @wrap_privileges%0A
@pre
@@ -3314,24 +3314,44 @@
_info(pid)%0A%0A
+ @prevent_zombie%0A
def get_
|
2913d840b63746669ac5695bd244abd6db24fe5a | Create script that prepares LaGeR strings for use with a machine learning training algorithms | lager_ml/lager_training_prep.py | lager_ml/lager_training_prep.py | Python | 0 | @@ -0,0 +1,1336 @@
+#!/usr/bin/env python3%0A%0A# This program prepares LaGeR strings for use with a machine learning training%0A# algorithm.%0A#%0A# It expands the string or set of strings to specific length (number of%0A# features), then generates variants for each of those. Finally, it converts%0A# the variants into... | |
352379690275e970693a06ed6981f530b6704354 | Add index to Task.status | migrations/versions/181adec926e2_add_status_index_to_task.py | migrations/versions/181adec926e2_add_status_index_to_task.py | Python | 0.000003 | @@ -0,0 +1,409 @@
+%22%22%22Add status index to task%0A%0ARevision ID: 181adec926e2%0ARevises: 43397e521791%0ACreate Date: 2016-10-03 17:41:44.038137%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '181adec926e2'%0Adown_revision = '43397e521791'%0A%0Afrom alembic import op%0A%0A%0Adef upgrade(... | |
6ccf99966461bd8545654084584d58093dac03d5 | Add missing version file | pyrle/version.py | pyrle/version.py | Python | 0.000002 | @@ -0,0 +1,23 @@
+__version__ = %220.0.17%22%0A
| |
f4e08d41d53cf74f8a53efeb7e238de6a98946cc | add script to find allreferenced hashes | add-ons/tools/get_referenced_hashes.py | add-ons/tools/get_referenced_hashes.py | Python | 0.000001 | @@ -0,0 +1,1805 @@
+#!/usr/bin/env python%0A%0Aimport sys%0Aimport cvmfs%0A%0Adef usage():%0A print sys.argv%5B0%5D + %22 %3Clocal repo name %7C remote repo url%3E %5Broot catalog%5D%22%0A print %22This script walks the catalogs and generates a list of all referenced content hashes.%22%0A%0A# get referenced hashe... | |
df852b2ee81756fa62a98e425e156530333bf5a1 | add migration to change order of participation choices | meinberlin/apps/plans/migrations/0033_change_order_participation_choices.py | meinberlin/apps/plans/migrations/0033_change_order_participation_choices.py | Python | 0 | @@ -0,0 +1,546 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.18 on 2019-01-28 13:27%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('meinberlin_plans', '0032_rename_topic_field'),%0A ... | |
c6f060a12a6d4952fef85ec58294c0014b10b6d1 | Remove the extra Networks url in ports details page's breadcrumb | openstack_dashboard/dashboards/admin/networks/ports/views.py | openstack_dashboard/dashboards/admin/networks/ports/views.py | # Copyright 2012 NEC Corporation
#
# 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 or ag... | Python | 0.001216 | @@ -3374,62 +3374,8 @@
= %5B%0A
- (_(%22Networks%22), self.get_redirect_url()),%0A
|
8b71de6988b65665d60c696daffb12ab78c35472 | allow passing of 'profile' argument to constructor | crosscat/IPClusterEngine.py | crosscat/IPClusterEngine.py | #
# Copyright (c) 2010-2013, MIT Probabilistic Computing Project
#
# Lead Developers: Dan Lovell and Jay Baxter
# Authors: Dan Lovell, Baxter Eaves, Jay Baxter, Vikash Mansinghka
# Research Leads: Vikash Mansinghka, Patrick Shafto
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may... | Python | 0.000001 | @@ -1382,16 +1382,30 @@
ilename,
+ profile=None,
seed=0,
@@ -1659,16 +1659,33 @@
ilename,
+ profile=profile,
sshkey=
|
92debba4bb0b0064b865a53b40476effa4d09c78 | Undo Framework example | pyside/demos/framework/undo/document.py | pyside/demos/framework/undo/document.py | Python | 0.000001 | @@ -0,0 +1,1839 @@
+from collections import namedtuple%0A%0Afrom PySide.QtGui import QWidget, QPalette, QPainter%0Afrom PySide.QtCore import Qt, QRect%0A%0A%0AShapeType = namedtuple('ShapeType', 'Rectangle Circle Triangle')(*range(3))%0A%0A%0Aclass Shape(object):%0A def __init__(self, type=ShapeType.Rectangle, color... | |
fe08242647962af0fdfab0ce34417b6a6079ed65 | add another import now missing | sympy/strategies/tests/test_traverse.py | sympy/strategies/tests/test_traverse.py | from sympy.strategies.traverse import (top_down, bottom_up, sall, top_down_once,
bottom_up_once, expr_fns, basic_fns)
from sympy import Basic, symbols, Symbol, S
zero_symbols = lambda x: S.Zero if isinstance(x, Symbol) else x
x,y,z = symbols('x,y,z')
def test_sall():
zero_onelevel = sall(zero_symbols)
... | Python | 0 | @@ -102,28 +102,61 @@
ce,
-expr_fns, basic
+basic_fns)%0Afrom sympy.strategies.util import expr
_fns
-)
%0Afro
|
0c29b431a0f5ce9115d7acdcaaabbd27546949c6 | Add test for contact success view. | chmvh_website/contact/tests/views/test_success_view.py | chmvh_website/contact/tests/views/test_success_view.py | Python | 0 | @@ -0,0 +1,606 @@
+from django.test import RequestFactory%0Afrom django.urls import reverse%0A%0Afrom contact.views import SuccessView%0A%0A%0Aclass TestSuccessView(object):%0A %22%22%22Test cases for the success view%22%22%22%0A url = reverse('contact:success')%0A%0A def test_get(self, rf: RequestFactory):%0A... | |
f66a60411b4e1cb30ac1fde78735ba38e99289cf | Create cfprefs.py | cfprefs.py | cfprefs.py | Python | 0 | @@ -0,0 +1,326 @@
+#!/usr/bin/python%0A%0Aimport CoreFoundation%0A%0Adomain = 'com.apple.appstore'%0Akey = 'restrict-store-require-admin-to-install'%0A%0Akey_value = CoreFoundation.CFPreferencesCopyAppValue(key, domain)%0Aprint 'Key Value = ', key_value%0A%0Akey_forced = CoreFoundation.CFPreferencesAppValueIsForced(key... | |
e5fecce2693056ac53f7d34d00801829ea1094c3 | add JPEG decoder CPU perf bench | tools/jpegdec_perf/reader_perf_multi.py | tools/jpegdec_perf/reader_perf_multi.py | Python | 0 | @@ -0,0 +1,1301 @@
+import cv2%0Aimport os%0Afrom turbojpeg import TurboJPEG, TJPF_GRAY, TJSAMP_GRAY, TJFLAG_PROGRESSIVE%0Aimport time%0Aimport threading%0A%0A# specifying library path explicitly%0A# jpeg = TurboJPEG(r'D:%5Cturbojpeg.dll')%0A# jpeg = TurboJPEG('/usr/lib64/libturbojpeg.so')%0A# jpeg = TurboJPEG('/usr/lo... | |
c650d64247d63d2af7a8168795e7edae5c9ef6ef | Add realtime chart plotting example | realtime-plot.py | realtime-plot.py | Python | 0 | @@ -0,0 +1,1495 @@
+import time, random%0Aimport math%0Afrom collections import deque%0A%0Astart = time.time()%0A%0Aclass RealtimePlot:%0A def __init__(self, axes, max_entries = 100):%0A self.axis_x = deque(maxlen=max_entries)%0A self.axis_y = deque(maxlen=max_entries)%0A self.axes = axes%0A ... | |
8ae82037dde45019cae8912f45a36cf3a362c444 | Revert "HAProxy uses milliseconds ..." | openstack/network/v2/health_monitor.py | openstack/network/v2/health_monitor.py | # 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 or agreed to in writing, software
# distributed under t... | Python | 0.000006 | @@ -1236,21 +1236,16 @@
ime, in
-milli
seconds,
@@ -2184,13 +2184,8 @@
of
-milli
seco
|
c3add04f098e81b20946abaa99e6f2d81055b168 | Lie algebras: Type A | sympy/liealgebras/type_A.py | sympy/liealgebras/type_A.py | Python | 0.998793 | @@ -0,0 +1,2362 @@
+from sympy.core import(Set, Dict, Tuple)%0Afrom cartan_type import CartanType_standard%0Afrom sympy.matrices import eye%0A%0A%0Aclass CartanType(Standard_Cartan):%0A%0A def __init__(self,n):%0A assert n %3E= 1%0A Standard_Cartan.__init__(self, %22A%22, n)%0A%0A%0A def dimension(s... | |
f7e4ca11c7bfc35bf0fd6becd2a5d5fdd2ca5ed5 | Add a script to split data with partitions. | src/main/python/partition_data.py | src/main/python/partition_data.py | Python | 0 | @@ -0,0 +1,1110 @@
+import csv;%0Aimport random;%0Aimport sys;%0A%0Ain_file = str(sys.argv%5B1%5D)%0Aout_file = str(sys.argv%5B2%5D)%0Anum_partitions = int(sys.argv%5B3%5D)%0A%0Aheader = %5B%5D;%0Apartitions = %5B%5D;%0Afor i in range(num_partitions):%0A partitions.append(%5B%5D)%0A%0A# Load all the training rows%0A... | |
dc76e7c085e7462d75567bf3d0228defb6bbbc58 | Add tests for converter | tests/test_csv_converter.py | tests/test_csv_converter.py | Python | 0 | @@ -0,0 +1,1199 @@
+import os%0Aimport sys%0Asys.path.insert(0, os.path.dirname(__file__))%0Asys.path.insert(1, os.path.dirname(%22..%22))%0A%0Aimport unittest%0Afrom csv_converter import CsvConverter%0A%0Aclass TestCsvConverter(unittest.TestCase):%0A%0A def test_parse_csv(self):%0A converter = CsvConverter(%... | |
645507ed9ec43b354880673fbc75afe169ef6697 | Add test capturing bad implementation of contains handler. | tests/unit/test_handlers.py | tests/unit/test_handlers.py | Python | 0 | @@ -0,0 +1,244 @@
+from pmxbot import core%0A%0Adef test_contains_always_match():%0A%09%22%22%22%0A%09Contains handler should always match if no rate is specified.%0A%09%22%22%22%0A%09handler = core.ContainsHandler(name='#', func=None)%0A%09assert handler.match('Tell me about #foo', channel='bar')%0A
| |
d61c42221774f36477b1288396f4e7e7337e905c | add data migration | formly/migrations/0012_fix_multi_text_answer_data.py | formly/migrations/0012_fix_multi_text_answer_data.py | Python | 0.000001 | @@ -0,0 +1,1279 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.6 on 2018-01-23 13:46%0Afrom __future__ import unicode_literals%0A%0Aimport json%0A%0Afrom django.db import migrations%0A%0Adef migrate_data(apps, schema_editor):%0A FieldResult = apps.get_model(%22formly%22, %22FieldResult%22)%0A # alias fo... | |
904e6757531ddf7b983cb30c0da8496d55eddb23 | Reimplement Stoneskin Gargoyle using Attr() | fireplace/cards/naxxramas/collectible.py | fireplace/cards/naxxramas/collectible.py | from ..utils import *
##
# Minions
# Zombie Chow
class FP1_001:
deathrattle = Heal(ENEMY_HERO, 5)
# Haunted Creeper
class FP1_002:
deathrattle = Summon(CONTROLLER, "FP1_002t"), Summon(CONTROLLER, "FP1_002t")
# Mad Scientist
class FP1_004:
deathrattle = ForcePlay(CONTROLLER, RANDOM(CONTROLLER_DECK + SECRET))
... | Python | 0 | @@ -1684,57 +1684,46 @@
.on(
-%0A%09%09lambda self, player: Heal(self, self.damage)%0A%09
+Heal(SELF, Attr(SELF, GameTag.DAMAGE))
)%0A%0A%0A
|
a1f864de0c5e71f0e9dc0ff4a23dc8101556832b | add new script | icart_mini_navigation/scripts/navigation_strategy.py | icart_mini_navigation/scripts/navigation_strategy.py | Python | 0.000001 | @@ -0,0 +1,1278 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Atry:%0A import roslib; roslib,load_manifest('rospeex_if')%0Aexcept:%0A pass%0A%0Aimport rospy%0Aimport re%0A%0Afrom rospeex_if import ROSpeexInterface%0Afrom std_msgs.msg import String%0A%0Asyscommand_pub = rospy.Publisher('syscommand', Stri... | |
b3e9075e819402f93f7dc2e29b61e3e621ab7355 | Add unit tests for avging imputations | impy/imputations/tests/test_averaging_imputations.py | impy/imputations/tests/test_averaging_imputations.py | Python | 0 | @@ -0,0 +1,1665 @@
+%22%22%22test_averaging_imputations.py%22%22%22%0Aimport unittest%0Aimport numpy as np%0Afrom impy.imputations import mean_imputation%0Afrom impy.imputations import mode_imputation%0Afrom impy.imputations import median_imputation%0Afrom impy.datasets import random_int%0A%0A%0Aclass TestAveraging(uni... | |
dd784f9035f66fd7d4febb8e43a09353821312b9 | add solution for Kth Largest Element in an Array | algorithms/KthLargestElementInAnArray/KthLargestElementInAnArray.py | algorithms/KthLargestElementInAnArray/KthLargestElementInAnArray.py | Python | 0 | @@ -0,0 +1,699 @@
+class Solution:%0A # @param %7Binteger%5B%5D%7D nums%0A # @param %7Binteger%7D k%0A # @return %7Binteger%7D%0A%0A def findKthLargest(self, nums, k):%0A k = len(nums) - k%0A%0A def quickselect(st, ed):%0A pivot = nums%5Bed%5D%0A pos = st%0A fo... | |
aa411ddcd62b824c0bfe8660c795b71e6e6929ea | add reset command. | axes/utils.py | axes/utils.py | Python | 0.001104 | @@ -0,0 +1,552 @@
+from axes.models import AccessAttempt%0A%0Adef reset(ip=None, silent=False):%0A if not ip:%0A attempts = AccessAttempt.objects.all()%0A if attempts:%0A for attempt in AccessAttempt.objects.all():%0A attempt.delete()%0A else:%0A if not silen... | |
ceb8a32637bc0fd9ab0517be7f025755e19ec2c7 | add leetcode Excel Sheet Column Number | leetcode/ExcelSheetColumnNumber/solution.py | leetcode/ExcelSheetColumnNumber/solution.py | Python | 0.000001 | @@ -0,0 +1,227 @@
+# -*- coding:utf-8 -*-%0Aclass Solution:%0A # @param s, a string%0A # @return an integer%0A def titleToNumber(self, s):%0A col = 0%0A for c in s:%0A col = col * 26 + ord(c) - ord('A') + 1%0A return col%0A
| |
cf7e9dfec0c0cdab913f98ff325210b552610219 | Add new runner, search! | salt/runners/search.py | salt/runners/search.py | Python | 0 | @@ -0,0 +1,312 @@
+'''%0ARunner frontend to search system%0A'''%0A%0A# Import salt libs%0Aimport salt.search%0Aimport salt.output%0A%0Adef query(term):%0A '''%0A Query the search system%0A '''%0A search = salt.search.Search(__opts__)%0A result = search.query(term)%0A salt.output.display_output(result,... | |
da704e95b010330efd350e7ed85e51f252b8a453 | add missing migration | aldryn_redirects/migrations/0002_on_delete_and_verbose_names.py | aldryn_redirects/migrations/0002_on_delete_and_verbose_names.py | Python | 0.000258 | @@ -0,0 +1,983 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.2 on 2016-02-22 08:03%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('aldryn_redirects'... | |
17ae9e25663d029af11236584b4c759c895ae830 | Improve and consolidate condition scripts of Lithium to support timeouts and regex via optparse. r=Jesse | util/fileIngredients.py | util/fileIngredients.py | Python | 0 | @@ -0,0 +1,1160 @@
+#!/usr/bin/env python%0A#%0A# This Source Code Form is subject to the terms of the Mozilla Public%0A# License, v. 2.0. If a copy of the MPL was not distributed with this file,%0A# You can obtain one at http://mozilla.org/MPL/2.0/.%0A%0Afrom __future__ import with_statement%0A%0Aimport re%0A%0Adef fi... | |
03baa59cea76ab85f661bfa3e8d910fd6a7ae82a | Remove leading slash in redirections | nikola/plugins/task/redirect.py | nikola/plugins/task/redirect.py | # -*- coding: utf-8 -*-
# Copyright © 2012-2016 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights t... | Python | 0.000001 | @@ -1811,16 +1811,28 @@
r%22%5D, src
+.lstrip('/')
)%0A
|
21ef2114975a315815d960fd1f28c5e4036fb935 | Update browsermark to use results.AddValue(..) | tools/perf/benchmarks/browsermark.py | tools/perf/benchmarks/browsermark.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.
"""Runs Browsermark CSS, DOM, WebGL, JS, resize and page load benchmarks.
Browsermark benchmark suite have five test groups:
a) CSS group: measures your bro... | Python | 0.000001 | @@ -1054,16 +1054,51 @@
page_set
+%0Afrom telemetry.value import scalar
%0A%0Aclass
@@ -1801,17 +1801,72 @@
ults.Add
-(
+Value(%0A scalar.ScalarValue(results.current_page,
'Score',
@@ -1882,16 +1882,17 @@
result)
+)
%0A%0A%0A@benc
|
8204a8b84cdcd515ea1dcf7ab67574b6db5baca6 | Add WS caller | web_services/ws_test.py | web_services/ws_test.py | Python | 0 | @@ -0,0 +1,898 @@
+import functools%0Aimport xmlrpclib%0AHOST = 'localhost'%0APORT = 8069%0ADB = 'odoo_curso'%0AUSER = 'admin'%0APASS = 'admin'%0AROOT = 'http://%25s:%25d/xmlrpc/' %25 (HOST,PORT)%0A%0A# 1. Login%0Auid = xmlrpclib.ServerProxy(ROOT + 'common').login(DB,USER,PASS)%0Aprint %22Logged in as %25s (uid:%25d)%2... | |
605fb4c6726d0c66bada870bffe526d493195b33 | Create USN.py | USN.py | USN.py | Python | 0.000003 | @@ -0,0 +1,108 @@
+#Spooky scary skeeletons send shiveers down your spine%0A%0A#You are a gunner in the Navy. Destroy the Commies.%0A
| |
129e548ac0be8ee3a60dd85aca9d095456b7d3a6 | Add new py-testresources package (#14031) | var/spack/repos/builtin/packages/py-testresources/package.py | var/spack/repos/builtin/packages/py-testresources/package.py | Python | 0 | @@ -0,0 +1,636 @@
+# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass PyTestresources(PythonPackage):%0A %22%22%22Testresource... | |
f8712c62ad069b815ff775bd758bdbf693bdbdb7 | Add some constants. | src/pyfuckery/constants.py | src/pyfuckery/constants.py | Python | 0.000001 | @@ -0,0 +1,401 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# XXX Update Docstring%0A%22%22%22%0ApyFuckery - constants.py%0ACreated on 2/12/17.%0A%0A%0A%22%22%22%0A# Stdlib%0Aimport logging%0Aimport re%0A# Third Party Code%0A# Custom Code%0Alog = logging.getLogger(__name__)%0A%0A%0A# Brainfuck tokens%0ASYM_PTR... | |
37190d6fba4d2a769ff2dcd154aa8cf1721f7026 | yea yea | gmm.py | gmm.py | Python | 0.999953 | @@ -0,0 +1,1547 @@
+%22%22%22Trains a GMM on formant data (e.g. from the Hillenbrand corpus).%0A%22%22%22%0A%0Aimport numpy as np%0Afrom sklearn.mixture import GMM%0Afrom sklearn import metrics%0Aimport pylab as pl%0Afrom collections import defaultdict%0A%0A%0A%0Adef parse(fname):%0A with open(fname) as f:%0A ... | |
c97e44697444b15686bd0a6b5158c90630958238 | Add LRU example | lru.py | lru.py | Python | 0 | @@ -0,0 +1,1739 @@
+from datetime import datetime%0A%0A%0Aclass LRUCacheItem(object):%0A %22%22%22Data structure of items stored in cache%22%22%22%0A def __init__(self, key, item):%0A self.key = key%0A self.item = item%0A self.timestamp = datetime.now()%0A%0A%0Aclass LRUCache(object):%0A %... | |
dd7ffbf97f9ae8426d7f60e465941f3f70bccdd6 | add file | new.py | new.py | Python | 0.000001 | @@ -0,0 +1,14 @@
+print(%22test%22)%0A
| |
494c8b88727dc958a7ba37f76d4c470837d26e1d | Define register files | reg.py | reg.py | Python | 0.000043 | @@ -0,0 +1,122 @@
+EXP = 'EXP'%0AVAL = 'VAL'%0AENV = 'ENV'%0AUNEV = 'UNEV'%0AFUNC = 'FUNC'%0AARGL = 'ARGL'%0ACONT = 'CONT'%0ACURR = 'CURR'%0A%0ASTACK = 'STACK'
| |
1c46aa8a03e577ddb3db55a11df3db70905110d2 | Add serial_logger.py | serial_logger.py | serial_logger.py | Python | 0.000021 | @@ -0,0 +1,846 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0A%0A# Log serial monitor data%0A# TO-DO: add options for serial device, baud rate%0A%0Aimport serial%0Aimport datetime%0Aser = serial.Serial('/dev/cu.usbmodemfa131', 9600)%0A%0Anow = datetime.datetime.now()%0A%0Adef get_date_string():%0A day = now.day%0A ... | |
0df0daf7f52015258c3607bb2822c1c77c5e8207 | add tensorflow sample | python/other/flow.py | python/other/flow.py | Python | 0 | @@ -0,0 +1,213 @@
+import tensorflow as tf%0A%0Aa = tf.constant(1, name=%22a%22)%0Ab = tf.constant(1, name=%22b%22)%0A%0Ac = a + b%0A%0Aprint(c)%0Agraph = tf.get_default_graph()%0Aprint(graph.as_graph_def())%0A%0Awith tf.Session() as sess:%0A print(sess.run(c))
| |
fdc900d5da48ae9aea1c7537e026dc2d46c62bc8 | add some reuseable aggregation code | shrunk/aggregations.py | shrunk/aggregations.py | Python | 0.000001 | @@ -0,0 +1,1148 @@
+%0Adef match_short_url(url):%0A return %7B%22$match%22: %7B%22short_url%22:url%7D%7D%0A%0Adef match_id(id):%0A return %7B%22$match%22: %7B%22short_url%22:url%7D%7D%0A%0A#monthly visits aggregations phases%0Agroup_ips=%7B%22$group%22: %7B%0A %22_id%22: %22$source_ip%22,%0A %22times%22: %7... | |
f9da8c4aa061223dac5147f6eaec6ad3419d1d6a | Add cli module to accept a language option | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/cli.py | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/cli.py | Python | 0.000001 | @@ -0,0 +1,458 @@
+import os%0Aos.environ%5B%22KIVY_NO_ARGS%22%5D = %221%22%0A%0Aimport click%0A%0Afrom %7B%7Bcookiecutter.repo_name%7D%7D.%7B%7Bcookiecutter.repo_name%7D%7D import %7B%7Bcookiecutter.app_class_name%7D%7D%0A%0A%0A@click.command()%0A@click.option(%0A '-l', '--language', help='Default language of the A... | |
195b74304fa1c5eab3bc2e16df1346c2f92916f8 | Test py | testnet/tests/configs_api_test.py | testnet/tests/configs_api_test.py | Python | 0 | @@ -0,0 +1,2623 @@
+#!/usr/bin/env python3%0A%0Aimport unittest%0Aimport datetime%0A%0Afrom exonum import ExonumApi, random_hex%0A%0Aclass ConfigsApi(ExonumApi):%0A %0A def new_config_propose(self, config, height, actual_from_height):%0A tx, c = self.send_transaction(%22config/propose%22, %7B%22config%22: ... | |
1ac0c90037923c06a337b7236b678d8ca2b45e5f | Fix unit test | tests/unit/engines/test_acgsou.py | tests/unit/engines/test_acgsou.py | from collections import defaultdict
import mock
from searx.engines import acgsou
from searx.testing import SearxTestCase
class TestAcgsouEngine(SearxTestCase):
def test_request(self):
query = 'test_query'
dic = defaultdict(dict)
dic['pageno'] = 1
params = acgsou.request(query, dic... | Python | 0.000005 | @@ -608,16 +608,31 @@
l = %22%22%22%0A
+ %3Chtml%3E%0A
%3Ctable i
@@ -721,17 +721,495 @@
-tablehead
+ %3Cth axis=%22string%22 class=%22l1 tableHeaderOver%22%3E%E5%8F%91%E5%B8%83%E6%97%B6%E9%97%B4%3C/th%3E%0A %3Cth axis=%22string%22 class=%22l2 tableHeaderOver%22%3E%E5%88%86%E7%B1%BB%3C/th%3E%0A ... |
641cf239ae5f4ddb64d81f5c977c1b14381ae805 | Add exec permission to download_build_install.py | third_party/instrumented_libraries/download_build_install.py | third_party/instrumented_libraries/download_build_install.py | #!/usr/bin/python
# 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.
"""Downloads, builds (with instrumentation) and installs shared libraries."""
import argparse
import os
import shutil
import subprocess
im... | Python | 0.000002 | |
aa720214722ca6ea445cf4ba38aa5f51ef7772b4 | add random user for notes | add_random_user.py | add_random_user.py | Python | 0 | @@ -0,0 +1,1089 @@
+#!/usr/bin/python%0D%0A#coding=utf-8%0D%0A%0D%0Aimport sys%0D%0A%0D%0Aimport MySQLdb%0D%0Afrom DBUtils.PooledDB import PooledDB%0D%0Aimport hashlib%0D%0Aimport time%0D%0Aimport random%0D%0A%0D%0Ag_dbPool = PooledDB(MySQLdb, 5, host='function-hz.com', user='notes', passwd='welc0me', db='db_notes', po... | |
05aa314ac9b5d38bb7a30e30aced9b27b2797888 | Add tests for non-async constructs | python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_syntax.py | python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_syntax.py | Python | 0.000006 | @@ -0,0 +1,876 @@
+# Add taintlib to PATH so it can be imported during runtime without any hassle%0Aimport sys; import os; sys.path.append(os.path.dirname(os.path.dirname((__file__))))%0Afrom taintlib import *%0A%0A# This has no runtime impact, but allows autocomplete to work%0Afrom typing import TYPE_CHECKING%0Aif TYP... | |
388c51ea5f83f718b885d784b566bc1873998c3a | add management command used to find all duplicate districts | custom/icds_reports/management/commands/find_duplicate_district_topojsons.py | custom/icds_reports/management/commands/find_duplicate_district_topojsons.py | Python | 0.000027 | @@ -0,0 +1,1053 @@
+from django.core.management import BaseCommand%0A%0Afrom custom.icds_reports.utils.topojson_util.topojson_util import get_topojson_file_for_level, %5C%0A get_district_topojson_data%0A%0A%0Aclass Command(BaseCommand):%0A help = %22Prints out any districts whose names are duplicated across state... | |
8634db8fe61f819cf24023514d94e4ebfc7e819f | Add Stats() class | auth0/v2/stats.py | auth0/v2/stats.py | Python | 0.000001 | @@ -0,0 +1,886 @@
+from .rest import RestClient%0A%0A%0Aclass Stats(object):%0A %22%22%22Auth0 stats endpoints%0A%0A Args:%0A domain (str): Your Auth0 domain, e.g: 'username.auth0.com'%0A%0A jwt_token (str): An API token created with your account's global%0A keys. You can create one by us... | |
c1fcf54b63de95c85a9505d83062d8b320b1cbdf | Add python cloudfront update_distribution example to replace ACM Certificate | python/example_code/cloudfront/update_distribution_certificate.py | python/example_code/cloudfront/update_distribution_certificate.py | Python | 0 | @@ -0,0 +1,2573 @@
+# Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22). You%0A# may not use this file except in compliance with the License. A copy of%0A# the License is located at%0A#%0A# http://aws.amazon.com/apache... | |
151293037b941aba874fb2641c1bf982e2143beb | Create solution.py | hackerrank/algorithms/implementation/medium/the_time_in_words/py/solution.py | hackerrank/algorithms/implementation/medium/the_time_in_words/py/solution.py | Python | 0.000018 | @@ -0,0 +1,1388 @@
+#!/bin/python3%0A%0Aimport sys%0A%0A%0Adef solution(hrs, min):%0A lookup = %7B%0A 0: 'zero',%0A 1: 'one',%0A 2: 'two',%0A 3: 'three',%0A 4: 'four',%0A 5: 'five',%0A 6: 'six',%0A 7: 'seven',%0A 8: 'eight',%0A 9: 'nine',%0A ... | |
8ba0fcfa893e007f1c6cc794a36bd3604498c380 | add rapiro.py | rapiroController.kivy/rapiro.py | rapiroController.kivy/rapiro.py | Python | 0.999586 | @@ -0,0 +1,1435 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0Aimport sys%0Aimport serial%0Aimport os%0Aimport time%0Aimport datetime%0Aimport threading%0A%0A_str = ''%0Aif os.name == 'posix':%0A com = serial.Serial('/dev/ttyAMA0', 57600, timeout = 0.05)%0Aelse:%0A com = sys.stdout%0A%0Adef a2dist(v):%0A ... | |
a2848885e85ad6d9685bb8ae35747300ed4b6b8b | Add a BaseTokenizer | spicedham/tokenizer.py | spicedham/tokenizer.py | Python | 0.000006 | @@ -0,0 +1,128 @@
+class BaseTokenizer(object):%0A%0A def __init__(self, config):%0A pass%0A%0A def tokenize(self, text):%0A return %5Btext%5D%0A
| |
75a882bf38c88d73e38d13fbb8b1499ff4ae4ea6 | Add migration for changing users added by OSF for meetings with emails for fullnames to their guid | scripts/remove_after_use/set_meetings_users_fullnames_to_guids.py | scripts/remove_after_use/set_meetings_users_fullnames_to_guids.py | Python | 0 | @@ -0,0 +1,675 @@
+import sys%0Aimport logging%0A%0Aimport django%0Afrom django.db import transaction%0Adjango.setup()%0A%0Afrom osf.models import OSFUser%0A%0Alogger = logging.getLogger(__name__)%0Alogging.basicConfig(level=logging.INFO)%0A%0Adef main():%0A dry_run = '--dry' in sys.argv%0A with transaction.atomi... | |
a6b35a9a94b2e4b32c2236258812b44e81184515 | Add management command for resyncing mobile worker location user data | corehq/apps/users/management/commands/fix_location_user_data.py | corehq/apps/users/management/commands/fix_location_user_data.py | Python | 0 | @@ -0,0 +1,1102 @@
+from corehq.apps.locations.models import Location%0Afrom corehq.apps.users.models import CommCareUser%0Afrom dimagi.utils.couch.database import iter_docs%0Afrom django.core.management.base import BaseCommand, CommandError%0A%0A%0Aclass Command(BaseCommand):%0A args = %22domain%22%0A help = %22... | |
a31ef338ef4029be92b0c578bdd12706a0f1c17d | Move zpool grains into salt.grains.zpool | salt/grains/zpool.py | salt/grains/zpool.py | Python | 0.001271 | @@ -0,0 +1,1923 @@
+# -*- coding: utf-8 -*-%0A'''%0AZFS grain provider%0A%0A:maintainer: Jorge Schrauwen %3Csjorge@blackdot.be%3E%0A:maturity: new%0A:depends: salt.utils, salt.module.cmdmod%0A:platform: illumos,freebsd,linux%0A%0A.. versionadded:: Oxygen%0A%0A'''%0Afrom __future__ import absolute_imp... | |
bb8a448e5e3f935f5ee4f8da9c78bcb651486c15 | Create ZigZagConversion_002.py | leetcode/006-ZigZag-Conversion/ZigZagConversion_002.py | leetcode/006-ZigZag-Conversion/ZigZagConversion_002.py | Python | 0.000001 | @@ -0,0 +1,545 @@
+class Solution:%0A # @param %7Bstring%7D s%0A # @param %7Binteger%7D numRows%0A # @return %7Bstring%7D%0A def convert(self, s, numRows):%0A if numRows %3C 2:%0A return s%0A halfsize = numRows - 1%0A size = 2 * halfsize%0A res = ''%0A for i in ... | |
95fcdd4f2f65a330adcb115b7ce6d6084efc6ae8 | Add examples. | examples/sampling/metropolis.py | examples/sampling/metropolis.py | Python | 0 | @@ -0,0 +1,580 @@
+#!/usr/bin/env python%0A%0Aimport numpy as np%0Afrom util import MetropolisSampler, log_gaussian%0Afrom matplotlib import pyplot as plt%0A%0A%0Adef __main__():%0A np.random.seed(4)%0A # Generate parameters%0A num_dims = 3%0A mu = np.random.normal(0, 3, num_dims)%0A cov = np.diag(np.ran... | |
415717bddb00ca650bef61a5c6054a7b47575b56 | Implement unit test for break. | jaspyx/tests/visitor/test_break.py | jaspyx/tests/visitor/test_break.py | Python | 0.000001 | @@ -0,0 +1,704 @@
+import ast%0Afrom jaspyx.ast_util import ast_store, ast_load%0Afrom jaspyx.tests.visitor.v8_helper import V8Helper%0A%0A%0Aclass TestBreak(V8Helper):%0A def test_break(self):%0A assert self.run(%0A %5B%0A ast.Assign(%0A %5Bast_store('i')%5D,%0A ... | |
48d493e1b0e85cab7b40ade34bfad29437880bd2 | add webdeugger to the documentation | doc/autobuild.py | doc/autobuild.py | '''
Script to generate Kivy API from source code.
Code is messy, but working.
Be careful if you change anything in !
'''
ignore_list = (
'kivy._event',
'kivy.factory_registers',
'kivy.graphics.buffer',
'kivy.graphics.vbo',
'kivy.graphics.vertex',
'kivy.lib.osc'
)
import os
import sys
from gl... | Python | 0 | @@ -947,58 +947,58 @@
ivy.
-modules.webdebugger%0Aimport kivy.network.urlrequest
+network.urlrequest%0Aimport kivy.modules.webdebugger
%0Aimp
|
607c84d56524389a150e940d89f6ecb52420e8f3 | plain, AC | leetcode/0162_find-peak-element.py | leetcode/0162_find-peak-element.py | Python | 0.998553 | @@ -0,0 +1,539 @@
+#%0A# @lc app=leetcode id=162 lang=python3%0A#%0A# %5B162%5D Find Peak Element%0A#%0A%0Afrom typing import List%0A%0A# @lc code=start%0AINT_MIN = - 2 ** 64 + 1%0A%0Aclass Solution:%0A def findPeakElement(self, nums: List%5Bint%5D) -%3E int:%0A if len(nums) == 1:%0A return 0%0A ... | |
6db056ed452dfe01e5b6b414d414dd02d8960cef | use new mesolve output format | examples/ex_landau_zener.py | examples/ex_landau_zener.py | #
# Textbook example: Landau-Zener transitions in a quantum two-level system.
#
from qutip import *
from pylab import *
import time
def hamiltonian_t(t, args):
""" evaluate the hamiltonian at time t. """
H0 = args[0]
H1 = args[1]
return H0 + t * H1
def qubit_integrate(delta, eps0, A, gamma1, gamma2, ... | Python | 0.000126 | @@ -1622,24 +1622,21 @@
'%5D%5D%0A
-expt_lis
+outpu
t = meso
@@ -1701,24 +1701,28 @@
return
-expt_lis
+output.expec
t%5B0%5D%0A
|
a1e451ab3525c5a0852782d1990f848b2329cb72 | add sinawb token | server/crawler/sinawb/TokenConstant.py | server/crawler/sinawb/TokenConstant.py | Python | 0.999782 | @@ -0,0 +1,322 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A%22%22%22%0AAuthor: AsherYang%0AEmail: ouyangfan1991@gmail.com%0ADate: 2017/9/22.%0ADesc: sinaWeibo appkey%0A@see: http://open.weibo.com/apps/2489615368/info/basic?action=review%0A%22%22%22%0A%0Adomain=%22https://api.weibo.com/2/%22%0Atoken=%22%22%0A... | |
1a9b6c7c58c5960df18335552780c3ca668dea5e | add evaluation script for ihm | evaluation/evalutate_ihm.py | evaluation/evalutate_ihm.py | Python | 0 | @@ -0,0 +1,1637 @@
+import sklearn.utils as sk_utils%0Afrom mimic3models import metrics%0Aimport numpy as np%0Aimport pandas as pd%0Aimport argparse%0A%0A%0Adef main():%0A parser = argparse.ArgumentParser()%0A parser.add_argument('prediction', type=str)%0A parser.add_argument('--test_listfile', type=str, defau... | |
e3c17a893ef4e0790af05cc238ac9038923b115a | Create docs directory for sphinx integration | docs/__init__.py | docs/__init__.py | Python | 0 | @@ -0,0 +1,59 @@
+#TODO:Create DOCS files for later integration using Sphinx%0A
| |
c206cfd940dd8ba58edb86f16691bcf50b6e5e30 | Add modgraph.py demo from Michael Hohn <mhhohn@lbl.gov> | tclpkg/gv/demo/modgraph.py | tclpkg/gv/demo/modgraph.py | Python | 0 | @@ -0,0 +1,960 @@
+#!/usr/bin/python%0A%0A# display the kernel module dependencies%0A%0A# author: Michael Hohn %3Cmhholn@lbl.gov%3E%0A# based on: modgraph.tcl by John Ellson %3Cellson@research.att.com%3E%0A%0Aimport sys%0A# sys.path.append('/usr/lib/graphviz/python')%0Asys.path.append('/usr/lib64/graphviz/python')%0Ai... | |
5c7a4547558e6f6959ae1878f56efef8716456c4 | add script to convert distances into probabilities | scripts/distance2probability.py | scripts/distance2probability.py | Python | 0.000006 | @@ -0,0 +1,2884 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0A%0A# The MIT License (MIT)%0A%0A# Copyright (c) 2014 Herv%C3%A9 BREDIN%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 Soft... | |
2197e16cf20bba5d373f4b7a250b8f1190be8ede | Add focus attribute example. | examples/focused-windows.py | examples/focused-windows.py | Python | 0 | @@ -0,0 +1,734 @@
+#!/usr/bin/env python3%0A%0Afrom argparse import ArgumentParser%0Aimport i3ipc%0A%0Ai3 = i3ipc.Connection()%0A%0Adef focused_windows():%0A tree = i3.get_tree()%0A%0A workspaces = tree.workspaces()%0A for workspace in workspaces:%0A container = workspace%0A%0A while container:%0A if not ... | |
e7146bbee86ea744d080f18a4f27def9cb26e33e | add corpus_test1.py to see how to parse music21 songs | experiments/corpus_test1.py | experiments/corpus_test1.py | Python | 0.000001 | @@ -0,0 +1,1585 @@
+#!/usr/bin/env python3%0A# Copyright 2016 Curtis Sand%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... | |
6ccdf23c67af632a46017d63b5f51d2c207be0ab | Add file | scheduled_bots/scripts/merge_duplicate_gene_proteins.py | scheduled_bots/scripts/merge_duplicate_gene_proteins.py | Python | 0.000002 | @@ -0,0 +1,1220 @@
+from tqdm import tqdm%0A%0Afrom wikidataintegrator.wdi_core import WDItemEngine, MergeError%0Afrom wikidataintegrator.wdi_login import WDLogin%0Afrom scheduled_bots.local import WDUSER, WDPASS%0A%0Alogin = WDLogin(WDUSER, WDPASS)%0As_protein = %22%22%22%0ASELECT DISTINCT ?item1 ?item2 ?value %7B%7B%... | |
495da73f305a2a0e79a28d251b5b93caea06656d | Add UglifyJS as a filter. | mediagenerator/filters/uglifier.py | mediagenerator/filters/uglifier.py | Python | 0 | @@ -0,0 +1,1416 @@
+from django.conf import settings%0Afrom django.utils.encoding import smart_str%0Afrom mediagenerator.generators.bundles.base import Filter%0A%0Aclass Uglifier(Filter):%0A def __init__(self, **kwargs):%0A super(Uglifier, self).__init__(**kwargs)%0A assert self.filetype == 'js', (%0A ... | |
660a3c5f3f8a4c63c21c27ce58c5639d37409ae1 | add thing to filter tracts | filter_tracts.py | filter_tracts.py | Python | 0 | @@ -0,0 +1,317 @@
+import json%0A%0Acalif_tracts_data = open('tracts.json')%0A%0Acalif_tracts = json.load(calif_tracts_data)%0A%0Asf_tracts = %5B%5D%0Afor r in calif_tracts%5B%22features%22%5D:%0A if r%5B%22properties%22%5D%5B%22COUNTY%22%5D == %22075%22:%0A sf_tracts.append(r)%0A%0Acalif_tracts_data.close()%... | |
e687dce8c8441728f1af6336497f7a131730db4f | Add untracked campaigns.py | framework/auth/campaigns.py | framework/auth/campaigns.py | Python | 0.000001 | @@ -0,0 +1,1000 @@
+import httplib as http%0A%0Afrom framework.exceptions import HTTPError%0A%0Afrom website import mails%0A%0AVALID_CAMPAIGNS = (%0A 'prereg',%0A)%0A%0AEMAIL_TEMPLATE_MAP = %7B%0A 'prereg': mails.CONFIRM_EMAIL_PREREG%0A%7D%0A%0Adef email_template_for_campaign(campaign, default=None):%0A if cam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.