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 |
|---|---|---|---|---|---|---|---|
d0789d6b47a7186077927d8b8b0f812c597e26bc | Add check_keys.py | check_keys.py | check_keys.py | Python | 0.000007 | @@ -0,0 +1,656 @@
+from hr.app import *%0A%0A%0Awith open('results.txt', 'w') as f:%0A for key in APIKey.query.all():%0A try:%0A auth = xmlapi.auth(keyID=key.key, vCode=key.code)%0A result = auth.account.APIKeyInfo()%0A if not result.key.accessMask == app.config%5B'API_KEY_MAS... | |
301e6b9b997c53aec8f63184153c949e8d6a1983 | Create __init__.py | iq2mongo/__init__.py | iq2mongo/__init__.py | Python | 0.000429 | @@ -0,0 +1,40 @@
+from iq2mongo import Iqfeedhistoricdata%0A
| |
58d03ad95d2f02a693869faa1081091d6999cd93 | Fix PEP8 in maketest | src/etc/maketest.py | src/etc/maketest.py | # Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or ht... | Python | 0.000042 | @@ -496,18 +496,47 @@
rt sys%0A%0A
-#
+%0Adef normalize_path(v):%0A %22%22%22
msys1/ms
@@ -591,17 +591,19 @@
2%60 into%0A
-#
+
%60c:%5Crea
@@ -662,17 +662,19 @@
thinks%0A
-#
+
the val
@@ -694,17 +694,19 @@
paths.%0A
-#
+
(if the
@@ -758,17 +758,19 @@
path%60.)%0A
-#
+
this ca
@@ -833,17 ... |
22be0d463a7e4f8795c9b14e761bb2f84ef3ce50 | add UDPCollector | src/collectors/udp/udp.py | src/collectors/udp/udp.py | Python | 0.000001 | @@ -0,0 +1,1661 @@
+# coding=utf-8%0A%0A%22%22%22%0AThe UDPCollector class collects metrics on UDP stats (surprise!)%0AIt's a copy of the TCPCollector with minor adjustments%0A%0A#### Dependencies%0A%0A * /proc/net/snmp%0A%0A%22%22%22%0A%0Aimport diamond.collector%0Aimport os%0A%0A%0Aclass UDPCollector(diamond.collecto... | |
f54a014fa420699f3c161f90b6392075a0134807 | move .ready() to the right place | src/hal/user_comps/pyvcp.py | src/hal/user_comps/pyvcp.py | #!/usr/bin/env python
# This is a component of emc
# Copyright 2007 Anders Wallin <anders.wallin@helsinki.fi>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of... | Python | 0.000003 | @@ -1268,40 +1268,40 @@
py
-vcp0.mainloop()%0A pycomp.ready
+comp.ready()%0A pyvcp0.mainloop
()%0A%0A
|
148068d99477b5f61a91362a22d56dc3e7ca2dcd | Change where uploads go | meh/vermin/migrations/0002_auto_20150505_0439.py | meh/vermin/migrations/0002_auto_20150505_0439.py | Python | 0 | @@ -0,0 +1,416 @@
+# -*- 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 ('vermin', '0001_initial'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%0A ... | |
2ddaadff2033517def793af5bfc0bae122789e6a | add users.py, which plugs a hole in the dev authentication process | rdfdatabank/config/users.py | rdfdatabank/config/users.py | Python | 0 | @@ -0,0 +1,220 @@
+_USERS = %7B'admin': %7B'owner': '*', 'first_name': 'Databank', 'last_name': 'Admin', 'role': 'admin'%7D, 'sandbox_user': %7B'owner': %5B'sandbox'%5D, 'role': 'user', 'name': 'Sandbox user', 'description': 'User for silo Sandbox'%7D%7D%0A
| |
a1be18c495802ab07147b30c2455445817a42fa6 | Test for __unicode__ behavior | learningresources/tests/test_models.py | learningresources/tests/test_models.py | Python | 0.001126 | @@ -0,0 +1,489 @@
+%22%22%22%0ATests for learningresources models%0A%22%22%22%0Afrom __future__ import unicode_literals%0A%0Afrom django.test.testcases import TestCase%0A%0Afrom learningresources.models import LearningResourceType%0A%0A%0Aclass TestModels(TestCase):%0A %22%22%22Tests for learningresources models%22%... | |
24357efc8b44d916d9d43e262bb7b323cc650e81 | Create get_ip_send_email.py | get_ip_send_email.py | get_ip_send_email.py | Python | 0.000009 | @@ -0,0 +1,2374 @@
+#!/usr/bin/python%0A#-*-coding:utf8-*-%0A%0A__author__ = 'laixintao'%0A%0Aimport socket%0Aimport fcntl%0Aimport time%0Aimport struct%0Aimport smtplib%0Aimport urllib%0Afrom email.mime.multipart import MIMEMultipart%0Afrom email.mime.text import MIMEText%0Afrom email.mime.image import MIMEImage%0Aimp... | |
5a38a989591202fae42da75fde73f486634376e3 | Create 7kyu_simple_fun_new_numeral_system.py | Solutions/7kyu/7kyu_simple_fun_new_numeral_system.py | Solutions/7kyu/7kyu_simple_fun_new_numeral_system.py | Python | 0.000176 | @@ -0,0 +1,178 @@
+from string import ascii_uppercase as AU%0A%0Adef new_numeral_system(number):%0A idx = AU.index(number)%0A return %5B%22%7B%7D + %7B%7D%22.format(AU%5Bi%5D, AU%5Bidx-i%5D) for i in range((idx//2)+1)%5D %0A
| |
6174804ab17b621ad010c6ddd3b07f7728d24120 | add script | etc/bsrg.py | etc/bsrg.py | Python | 0.000001 | @@ -0,0 +1,1190 @@
+#!/usr/bin/env python%0A%0A''' Adds a bogus read group to a readgroup-less BAM file '''%0A%0Aimport os%0Aimport sys%0Aimport pysam%0Afrom uuid import uuid4%0A%0A%0Adef modhead(header, rgid, fn):%0A if 'RG' in header:%0A sys.stderr.write(%22RG found in header, this script is not what you wa... | |
9ffe40aaf5ece521020258c4b31fbdb514e02b69 | Add utility function for get latest Build | manager/utilities.py | manager/utilities.py | Python | 0 | @@ -0,0 +1,278 @@
+from typing import Optional%0A%0Afrom manager.models import Package, Build%0A%0A%0Adef get_latest_build(package: Package) -%3E Optional%5BBuild%5D:%0A try:%0A return Build.objects.filter(package=package, status=Build.SUCCESS).order_by('-id')%5B0%5D%0A except IndexError:%0A return ... | |
0b55d97573fcd196a318b3c901f6dcac1b0a4eef | Create a placeholder for pyauto test scripts. | chrome/test/functional/test_basic.py | chrome/test/functional/test_basic.py | Python | 0.000012 | @@ -0,0 +1,387 @@
+#!/usr/bin/python%0A# Copyright (c) 2010 The Chromium Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0Aimport unittest%0A%0Afrom pyauto import PyUITest%0A%0A%0Aclass SimpleTest(PyUITest):%0A%0A def testCanOpe... | |
ffdfc05affc88226fda08c4d1924a9c509f4b53e | add GBM detector and datatype attrs | sunpy/net/dataretriever/attrs/gbm.py | sunpy/net/dataretriever/attrs/gbm.py | Python | 0 | @@ -0,0 +1,213 @@
+from sunpy.net.attr import SimpleAttr%0A%0A__all__ = %5B'Detector'%5D%0A%0Aclass Detector(SimpleAttr):%0A%09%22%22%22%0A%09Detector number for FERMI GBM%0A%09%22%22%22%0A%0A%0Aclass Datatype(SimpleAttr):%0A%09%22%22%22%0A%09Data type of GBM - either CSPEC or CTIME%0A%09%22%22%22
| |
6906f574fad033f0b68fe7a5a35f4fcef1207ee0 | Load the source from a highlighted URL into a new window | Get_Webpage_Source.py | Get_Webpage_Source.py | Python | 0.000001 | @@ -0,0 +1,403 @@
+import sublime%0Aimport sublime_plugin%0Aimport urllib%0A%0Aclass GetWebpageSourceCommand(sublime_plugin.TextCommand):%0A def run(self, edit):%0A url = self.view.substr(self.view.sel()%5B0%5D)%0A%0A if len(url) == 0:%0A return%0A%0A output = %22%22%0A%0A r = urllib.request.urlopen(u... | |
93d80604003e1b3b21498df01f7647e7cea69a5f | Add basic WinEvent object tests. | cybox/test/objects/win_event_test.py | cybox/test/objects/win_event_test.py | Python | 0 | @@ -0,0 +1,688 @@
+# Copyright (c) 2015, The MITRE Corporation. All rights reserved.%0A# See LICENSE.txt for complete terms.%0A%0Aimport unittest%0A%0Afrom cybox.objects.win_event_object import WinEvent%0Afrom cybox.test.objects import ObjectTestCase%0A%0A%0Aclass TestWinThread(ObjectTestCase, unittest.TestCase):%0A ... | |
79a8b46b8eaa84e13b10616764bee626ec6f4c34 | Update __init__.py | tendrl/commons/jobs/__init__.py | tendrl/commons/jobs/__init__.py | import json
import traceback
import etcd
import gevent.event
from tendrl.commons.event import Event
from tendrl.commons.flows.exceptions import FlowExecutionFailedError
from tendrl.commons.message import Message, ExceptionMessage
from tendrl.commons.objects.job import Job
class JobConsumerThread(gevent.greenlet.Gr... | Python | 0.000072 | @@ -8760,23 +8760,25 @@
ssage%22:
-%22error%22
+e.message
,%0A
@@ -10177,26 +10177,18 @@
e%22:
-%22Job /queue empty%22
+ex.message
,%0A
|
6c36729ec7d9f3345f0adb0c5deba13bd62262c6 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/6e84074d5cbda4900ea3f6cf29333e9f0140a661. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "d5b707f0e4997a401fd14b4a94e4f670e03e502e"
TFRT_SHA256 = "24a0e9963489cb9f5443e9e4a670... | Python | 0 | @@ -228,133 +228,133 @@
= %22
-d5b707f0e4997a401fd14b4a94e4f670e03e502e%22%0A TFRT_SHA256 = %2224a0e9963489cb9f5443e9e4a670b0c9217fa032eac090275b2c353570d638df
+6e84074d5cbda4900ea3f6cf29333e9f0140a661%22%0A TFRT_SHA256 = %226764720c5901c26c6b92b5b16a1274a3184a7c169726ec3cbaa442242e432181
%22%0A%0A
|
05afa4481112f4cc890cfe3d6372044397b774c7 | Create set-timeZone-AsiaJakarta.py | timezone/set-timeZone-AsiaJakarta.py | timezone/set-timeZone-AsiaJakarta.py | Python | 0.000001 | @@ -0,0 +1,195 @@
+%3E%3E%3E import os, time%0A%3E%3E%3E os.environ%5B'TZ'%5D = 'Asia/Jakarta'%0A%3E%3E%3E time.tzset()%0A%3E%3E%3E time.strftime('%25X %25x %25Z')%0A'12:26:07 10/15/15 WIB'%0A%3E%3E%3E print str(datetime.datetime.now()).split()%5B0%5D%0A2015-10-15%0A%3E%3E%3E %0A
| |
4c71d31fc4adaec4a21f766530f459c911e03492 | add 0001 | Jaccorot/0001/0001.py | Jaccorot/0001/0001.py | Python | 0.999999 | @@ -0,0 +1,484 @@
+#!/usr/local/bin/python%0A#coding=utf-8%0A%0A#%E7%AC%AC 0001 %E9%A2%98%EF%BC%9A%E5%81%9A%E4%B8%BA Apple Store App %E7%8B%AC%E7%AB%8B%E5%BC%80%E5%8F%91%E8%80%85%EF%BC%8C%E4%BD%A0%E8%A6%81%E6%90%9E%E9%99%90%E6%97%B6%E4%BF%83%E9%94%80%EF%BC%8C%E4%B8%BA%E4%BD%A0%E7%9A%84%E5%BA%94%E7%94%A8%E7%94%9F%E6%88%... | |
ea64c4f44d5c386f9d9b43a8f122987b374b10d3 | Update the bot to use our new Yo emote | moxie/butterfield.py | moxie/butterfield.py | import os
import json
import asyncio
from butterfield.utils import at_bot
from aiodocker import Docker
from aiocore import EventService
WEB_ROOT = os.environ.get("MOXIE_WEB_URL", "http://localhost:8888")
class LogService(EventService):
"""
Provide basic text logging using print()
"""
identifier = "mo... | Python | 0 | @@ -1348,15 +1348,25 @@
r()
-== %22yo%22
+in (%22yo%22, %22:yo:%22)
:%0A
@@ -1429,16 +1429,19 @@
%5D, %22
-Yo
%3C@%7B%7D%3E
+: :yo:
%22.fo
|
89d4c1420805a6f2e491f1ab250722cdcf950bd8 | Work towards integration NDTable <-> Minivect | ndtable/engine/mv.py | ndtable/engine/mv.py | Python | 0 | @@ -0,0 +1,2489 @@
+import sys%0Aimport time%0A%0Aimport numpy as np%0A%0Afrom minivect import miniast%0Afrom minivect import specializers%0Afrom minivect import minitypes%0Afrom minivect.ctypes_conversion import get_data_pointer, %5C%0A get_pointer, convert_to_ctypes%0Afrom ndtable.datashape.coretypes import var_ge... | |
7665aaa458861eda661e7cc1b4828b68fcd15ba6 | Add newrelic install. | fabfile.py | fabfile.py | from fabric.api import *
from fabric.contrib.files import *
from fabric.colors import red
def deploy(branch='master'):
"Deploy the specified branch to the remote host."
root_dir = '/home/www-data'
code_dir = '%s/django_app' % root_dir
virtualenv_name = 'django_venv'
virtualenv_dir = '%s/%s' % (ro... | Python | 0 | @@ -57,128 +57,9 @@
t *%0A
-from fabric.colors import red%0A%0A%0Adef deploy(branch='master'):%0A %22Deploy the specified branch to the remote host.%22%0A%0A
+%0A
root
@@ -82,20 +82,16 @@
w-data'%0A
-
code_dir
@@ -120,20 +120,16 @@
oot_dir%0A
-
virtuale
@@ -152,20 +152,16 @@
o_venv'%0A
-
virt... |
1146ab654c8b0d6f982f19bafed91f18edb877f3 | Add tests for the `dirty_unzip` rule | tests/rules/test_dirty_unzip.py | tests/rules/test_dirty_unzip.py | Python | 0.000002 | @@ -0,0 +1,1184 @@
+import os%0Aimport pytest%0Aimport zipfile%0Afrom thefuck.rules.dirty_unzip import match, get_new_command, side_effect%0Afrom tests.utils import Command%0A%0A%0A@pytest.fixture%0Adef zip_error(tmpdir):%0A path = os.path.join(str(tmpdir), 'foo.zip')%0A%0A def reset(path):%0A with zipfile... | |
fce66429cb361e9f113b3ec69031502128d192fb | Create OGR_PointIteration.py | OGR_PointIteration.py | OGR_PointIteration.py | Python | 0 | @@ -0,0 +1,353 @@
+from osgeo import ogr%0Aimport os%0A%0Ashapefile = %22//mnt//hgfs//Biondo//GINF//Florestas_Parana//pr_300_f22.shp%22%0Adriver = ogr.GetDriverByName(%22ESRI Shapefile%22)%0AdataSource = driver.Open(shapefile, 0)%0Alayer = dataSource.GetLayer()%0A%0Afor feature in layer:%0A geom = feature.GetGeometr... | |
d3922992a4048dfff356ed91196c9c4d4d62bb08 | Create testcase.py | testcase.py | testcase.py | Python | 0.000052 | @@ -0,0 +1,467 @@
+import unittest%0Afrom cal import Calculator%0A%0A%0Aclass TddInPythonExample(unittest.TestCase):%0A %0A def test_calculator_add_method_returns_correct_result(self):%0A %09%0A calc = Calculator()%0A result = calc.add(2,2)%0A self.assertEqual(4, result)%0A def test_calcul... | |
f83250d04fc4f98e97abcdc705046e5b412fc62e | add solution for Set Matrix Zeroes | src/setMatrixZeroes.py | src/setMatrixZeroes.py | Python | 0.000001 | @@ -0,0 +1,1020 @@
+class Solution:%0A # @param matrix, a list of lists of integers%0A # RETURN NOTHING, MODIFY matrix IN PLACE.%0A%0A def setZeroes(self, matrix):%0A if not matrix:%0A return%0A n = len(matrix)%0A if n == 0:%0A return%0A m = len(matrix%5B0%5D)%... | |
3926420273dce58076a8ba148e87f5ef268a2846 | add ie6 specific Focus.focus function | library/__ie6__/pyjamas/ui/Focus.py | library/__ie6__/pyjamas/ui/Focus.py | Python | 0.000001 | @@ -0,0 +1,357 @@
+# emulate behaviour of other browsers%0Adef focus(elem):%0A JS(%22%22%22%0A try %7B%0A elem.focus();%0A %7D catch (e) %7B%0A // Only trap the exception if the attempt was mostly legit%0A if (!elem %7C%7C !elem.focus) %7B%0A // Rethrow t... | |
41c56301c289b394afd69a75d77a00b140de3560 | Fix log security risk | htpc/log.py | htpc/log.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Logging
"""
import os
import cherrypy
import htpc
import logging
import logging.handlers
import sys
from settings import Setting
import colorama
class Log:
""" Root class """
def __init__(self):
""" Initialize the logger """
self.logfile = os.... | Python | 0.000006 | @@ -169,24 +169,74 @@
ort Setting%0A
+from cherrypy.lib.auth2 import require, member_of%0A
import color
@@ -2260,24 +2260,39 @@
py.expose()%0A
+ @require()%0A
def inde
@@ -2418,32 +2418,47 @@
errypy.expose()%0A
+ @require()%0A
@cherrypy.to
@@ -3126,32 +3126,65 @@
ools.json_out()%0A
+ @require(me... |
b219f44c754aafb959217ecf4199c8dc23a41ab1 | Create __init__.py | vnpy/app/risk_manager/ui/__init__.py | vnpy/app/risk_manager/ui/__init__.py | Python | 0.000429 | @@ -0,0 +1,32 @@
+from .widget import RiskManager%0A
| |
b92f204174e8d14fe4912631f5bc1305d7cd9550 | add choose.py; hardly anything in it | choose.py | choose.py | Python | 0.000001 | @@ -0,0 +1,152 @@
+def main(): #get input and if input is bingo return true%0A x = raw_input(%22Type a word: %22)%0A return bool(x == %22bingo%22 or x == %22Bingo%22)%0A%0Aprint main()%0A
| |
8188a8327b6269cdb2ae84fd97b19eac50914731 | add time module | allib/time.py | allib/time.py | Python | 0.000002 | @@ -0,0 +1,861 @@
+import math%0A%0A%0Adef format_timedelta(timedelta, short=True):%0A %22%22%22%0A Format a timedelta into a human-readable string.%0A %22%22%22%0A seconds = abs(timedelta.total_seconds())%0A days = max(0, math.floor(seconds / (3600 * 24)))%0A seconds -= 3600 * 24 * days%0A hours =... | |
178d4f3c13fa4baba4a0cb3bcadfa983ee1246ae | Add zenodo harvester | scrapi/harvesters/zenodo.py | scrapi/harvesters/zenodo.py | Python | 0.999345 | @@ -0,0 +1,529 @@
+'''%0AHarvester for the ASU Digital Repository for the SHARE project%0A%0AExample API call: https://zenodo.org/oai2d?verb=ListRecords&metadataPrefix=oai_dc%0A'''%0A%0Afrom __future__ import unicode_literals%0Afrom scrapi.base import OAIHarvester%0A%0A%0Aclass ZenodoHarvester(OAIHarvester):%0A shor... | |
0749111442c638569b6e42a11adee70e71e50813 | Add an helper class to write pexpect-based test cases Over time, we should improve this class and port all pexpect based testing over to using this | test/lldbpexpect.py | test/lldbpexpect.py | Python | 0.000011 | @@ -0,0 +1,1368 @@
+import lldb%0Afrom lldbtest import *%0Aimport lldbutil%0Aimport os%0Aimport unittest2%0Aimport sys%0Aimport pexpect%0A%0Aclass PExpectTest(TestBase):%0A %0A mydir = TestBase.compute_mydir(__file__)%0A%0A def setUp(self):%0A # Call super's setUp().%0A TestBase.setUp(self)%0A%0A... | |
305c3e0ce2705dd23e00ec801f5588ec1dbcc3a8 | Add py solution for 167. Two Sum II - Input array is sorted | py/two-sum-ii-input-array-is-sorted.py | py/two-sum-ii-input-array-is-sorted.py | Python | 0.999997 | @@ -0,0 +1,469 @@
+class Solution(object):%0A def twoSum(self, numbers, target):%0A %22%22%22%0A :type numbers: List%5Bint%5D%0A :type target: int%0A :rtype: List%5Bint%5D%0A %22%22%22%0A head, tail = 0, len(numbers) - 1%0A while head %3C tail:%0A s = numbe... | |
b41fc9f56fbeef66612647605b8cbc144e93e66a | add example on how to run parallel func | pdf_lib/lib_build.py | pdf_lib/lib_build.py | Python | 0 | @@ -0,0 +1,470 @@
+# script to execute database building%0A%0Afrom pdf_lib.parallel_func import (save_data, learninglib_build,%0A map_learninglib)%0Afrom ipyparallel import Client%0A%0Arc = Client()%0Adview = rc%5B:%5D%0A%0Adef run_build(cif_dir):%0A fn_list = sorted(%5Bf for f in o... | |
a7342cf25b850d310b0607f46a86037b26a8ecc4 | Create to_html.py | to_html.py | to_html.py | Python | 0.000001 | @@ -0,0 +1,766 @@
+import pandas as pd%0A%0Ain_file = 'https://raw.githubusercontent.com/ryanswanstrom/awesome-datascience-colleges/master/data_science_colleges.csv'%0A%0A## Read in the file%0Adf = pd.read_csv(in_file)%0A%0A# get a full degree name%0Adf%5B'DEGREE_FULL'%5D = df%5B%5B'DEGREE'%5D%5D.apply(lambda x:%0A ('... | |
3bf0a1c0752be428d3259a6639be205f019751d5 | Add lc0056_merge_intervals.py | lc0056_merge_intervals.py | lc0056_merge_intervals.py | Python | 0.000005 | @@ -0,0 +1,666 @@
+%22%22%22Leetcode 56. Merge Intervals%0AMedium%0A%0AURL: https://leetcode.com/problems/merge-intervals/%0A%0AGiven a collection of intervals, merge all overlapping intervals.%0A%0AExample 1:%0AInput: %5B%5B1,3%5D,%5B2,6%5D,%5B8,10%5D,%5B15,18%5D%5D%0AOutput: %5B%5B1,6%5D,%5B8,10%5D,%5B15,18%5D%5D%0AE... | |
f8e24bf955eb70535b989aad6ab8666ddd013da1 | Add in first py.test tests. | tests/test_basic.py | tests/test_basic.py | Python | 0 | @@ -0,0 +1,803 @@
+import pytest%0Aimport subprocess%0Aimport os%0Aimport sys%0A%0Aprefix = '.'%0Afor i in range(0,3):%0A if os.path.exists(os.path.join(prefix, 'pyiso.py')):%0A sys.path.insert(0, prefix)%0A break%0A else:%0A prefix = '../' + prefix%0A%0Aimport pyiso%0A%0Adef test_nofiles(tmp... | |
a76db8ed7113b337890be7d76299e071d25b1df9 | fix pfa loading (missing import) | psg/psg/util/file_like_buffer.py | psg/psg/util/file_like_buffer.py | #!/usr/bin/python
## This file is part of psg, PostScript Generator.
##
## Copyright 2006 by Diedrich Vorberg <diedrich@tux4web.de>
##
## All Rights Reserved
##
## For more Information on orm see the README file.
##
## This program is free software; you can redistribute it and/or modify
## it under the ... | Python | 0 | @@ -2405,19 +2405,17 @@
%0A%0D%0Afrom
-psg
+.
.excepti
@@ -2431,31 +2431,8 @@
t *%0D
-%0A##from .misc import *%0D
%0A%0D%0A#
@@ -5241,32 +5241,73 @@
_to(self, fp):%0D%0A
+ from .misc import copy_linewise%0D%0A
copy_lin
|
8a2891aa7b4aaf68655654f19998fe3dbc25db38 | Create tree_de.py | tree_de.py | tree_de.py | Python | 0.000003 | @@ -0,0 +1,1193 @@
+class nod(object):%0A def __init__(self ,elem):%0A self.elem=elem%0A self.le=None%0A self.ri=None%0A def setle(self ,le):%0A self.le=le%0A def getle(self):%0A return self.le%0A def setri(self ,ri):%0A self.ri=ri%0A def getri(self):%0A r... | |
9c6f0cf829f4f0c7ff71ad65bed36269425dae13 | Add test for zoom backend | social_core/tests/backends/test_zoom.py | social_core/tests/backends/test_zoom.py | Python | 0 | @@ -0,0 +1,1960 @@
+import json%0A%0Afrom .oauth import OAuth2Test%0A%0A%0Aclass ZoomOAuth2Test(OAuth2Test):%0A backend_path = 'social_core.backends.zoom.ZoomOAuth2'%0A user_data_url = 'https://api.zoom.us/v2/users/me'%0A expected_username = 'foobar'%0A access_token_body = json.dumps(%7B%0A 'access_t... | |
6824c741c455339eaaff5481f6e84c42fe1e26cf | Copy of main.py from fergal, reworked | susanplay/mainSusan.py | susanplay/mainSusan.py | Python | 0 | @@ -0,0 +1,1937 @@
+%0A%22%22%22%0AThis is a template top level script.%0A%0APlease don't edit this file. Instead, copy it to%0Ayouname_main.py, then run and edit that file.%0A%0A%22%22%22%0A%0Aimport dave.pipeline.pipeline as dpp%0Aimport dave.pipeline.clipboard as clipboard%0A%0Adef main():%0A %22%22%22A bare bone... | |
a4a956899008102b993d2268fbf6ae92d191ee6a | Test suite for Wikipedia triggers | ifttt/ifttt-tests.py | ifttt/ifttt-tests.py | Python | 0 | @@ -0,0 +1,908 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0A Wikipedia channel for IFTTT%0A ~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%0A Copyright 2015 Ori Livneh %3Cori@wikimedia.org%3E%0A Stephen LaPorte %3Cstephen.laporte@gmail.com%3E%0A Alangi Derick %3Calangiderick@gmail.com%3E%0A%0A Licensed... | |
4a8c3043962efa7e2a443a10a0ad13d025699730 | Add script to extract useful lsf job information | support/get_lsf_job_info.py | support/get_lsf_job_info.py | Python | 0 | @@ -0,0 +1,1451 @@
+import os%0Aimport sys%0Afrom subprocess import Popen, PIPE%0A%0A# --------------------------------------------------------------------------------------------------%0A%0Adef get_job_run_time(lsf_output_file, time='s'):%0A%09%22%22%22%0A%09%22%22%22%0A%0A%09fp = open(lsf_output_file, 'r')%0A%09proce... | |
52d947daa8ea6642472660d0c16c2b05e34bea41 | Add migration file for the model of CoC record | src/users/migrations/0010_cocrecord.py | src/users/migrations/0010_cocrecord.py | Python | 0 | @@ -0,0 +1,822 @@
+# Generated by Django 3.0.2 on 2020-02-23 11:12%0A%0Afrom django.conf import settings%0Aimport django.core.validators%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('users', '0009_auto... | |
bf55611be1b4c3799ab3e14bdcc1b46e96cffe24 | Add try_f test | tests/util-tests.py | tests/util-tests.py | Python | 0.000005 | @@ -0,0 +1,630 @@
+import unittest, sys, os%0Asys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), %22..%22))%0Aimport framework.util as util%0A%0Aclass UtilTests (unittest.TestCase):%0A def test_try_f(self):%0A self.assertEqual(util.try_f(int, %2210%22, -1), 10, %22Did not convert string ... | |
b7bc68872a45396358ce20a215e3a3a2c3734b8a | Add pretend ram module to try out the progress bar | py3status/modules/pretend_ram.py | py3status/modules/pretend_ram.py | Python | 0 | @@ -0,0 +1,1492 @@
+# -*- coding: utf-8 -*-%0A%0Afrom __future__ import division%0Aimport random%0A%0A%0Aclass Py3status:%0A %22%22%22%0A %22%22%22%0A format = %22%7Bbar%7D%22%0A thresholds = %5B(0, %22good%22), (40, %22degraded%22), (75, %22bad%22)%5D%0A cache_timeout = 1%0A middle_char = '%7C'%0A ... | |
f45fcf799c725a5206e5de4940cd35773ab9a697 | Add ../third_party/harfbuzz to all.gyp. Review URL: http://codereview.chromium.org/63063 | build/all.gyp | build/all.gyp | # Copyright (c) 2009 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.
{
'variables': {
'chromium_code': 1,
'conditions': [
['OS!="win"', {
'all_gyps%': 1,
},{ # else OS=="win"
'all_gyp... | Python | 0.000001 | @@ -1300,32 +1300,86 @@
ependencies': %5B%0A
+ '../third_party/harfbuzz/harfbuzz.gyp:*',%0A
'../
|
10b0b790ca503bcabf203e6cdf8cd3ebc0bcfa5a | Create plot_log.py | plot_log.py | plot_log.py | Python | 0 | @@ -0,0 +1,999 @@
+import re%0Aimport matplotlib.pyplot as plt%0A%0Aif __name__=='__main__':%0A file = open('./logs/log.txt','r')%0A accuracy = %5B%5D%0A epochs = %5B%5D%0A loss = %5B%5D%0A for line in file:%0A test_accuracy = re.search('%22test_accuracy%22: (%5B0%5D%5C.%5B0-9%5D+)*', line)%0A ... | |
0a557c13dcd55023dc52549d7ca04943bc98ac58 | bump soledad version requirement to >=0.6 | service/setup.py | service/setup.py | #!/usr/bin/env python
#
# Copyright (c) 2014 ThoughtWorks, Inc.
#
# Pixelated is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
... | Python | 0 | @@ -2820,23 +2820,21 @@
d.common
-==0.5.2
+%3E=0.6
',%0A
@@ -2862,15 +2862,13 @@
ient
-==0.5.2
+%3E=0.6
',%0A
|
abc155280052ab2f216342acd7933db3e090d94e | Add some basic tests for flow_exports | test/test_export_flow.py | test/test_export_flow.py | Python | 0 | @@ -0,0 +1,423 @@
+import netlib.tutils%0Afrom libmproxy import flow_export%0Afrom . import tutils%0A%0Areq_get = netlib.tutils.treq(%0A method='GET',%0A headers=None,%0A content=None,%0A)%0A%0Areq_post = netlib.tutils.treq(%0A method='POST',%0A headers=None,%0A)%0A%0A%0Adef test_request_simple():%0A ... | |
027b1e35a1808b010b30c596b9e98ede72b8c4e4 | add yamladd | yamladd.py | yamladd.py | Python | 0.999999 | @@ -0,0 +1,601 @@
+#!/usr/bin/env python2%0A%0Aimport argparse%0Aimport yaml%0Aimport sys%0A%0Aparser = argparse.ArgumentParser(%0A description='Insert a key-value pair into each mapping '%0A 'in a YAML sequence of mappings')%0Aparser.add_argument('key', help='Add this key')%0Aparser.add_argument('value',... | |
5c0ef34788202abefbc36f80899f9b9b54ba17be | Add a fabric file to test the generated output | fabfile.py | fabfile.py | Python | 0.000001 | @@ -0,0 +1,504 @@
+# -*- coding: utf-8 -*%0A%0A%22%22%22%0ASimple fabric file to test oinspect output%0A%22%22%22%0A%0Afrom __future__ import print_function%0A%0Aimport webbrowser%0A%0Aimport oinspect.sphinxify as oi%0A%0Adef test_basic():%0A %22%22%22Test with an empty context%22%22%22%0A docstring = 'A test'%0A... | |
6cfd5b46b9208d4e47482739732266c598e514df | add test script | test_new_image_loader.py | test_new_image_loader.py | Python | 0.000001 | @@ -0,0 +1,950 @@
+import os%0Aos.environ%5B'MXNET_CPU_WORKER_NTHREADS'%5D = '1'%0Aos.environ%5B'OMP_NUM_THREADS'%5D = '1'%0Aimport time%0Aimport numpy as np%0Aimport multiprocessing as mp%0Aimport mxnet as mx%0Afrom mxnet import gluon as gl%0Afrom mxnet.gluon.data.vision import transforms%0A%0Aif __name__ == '__main__... | |
55e616b9e7d4f4820574d14692ea1f4d5abb6edf | add repository for sparks 1.21. | fabfile.py | fabfile.py | # -*- coding: utf-8 -*-
"""
1flow fabfile, which relies on sparks.
Example calls:
# migrate() must have the *named* `args` argument,
# else it will conflicts with the implicit `remote_configuration`.
fab local sdf.migrate:args='redisboard --fake'
# Thus, this won't work:
... | Python | 0 | @@ -988,18 +988,16 @@
ject
-
= 'onefl
@@ -1015,18 +1015,16 @@
tualenv
-
= '1flow
@@ -1626,16 +1626,66 @@
7b2GMC'%0A
+env.repository = 'olive@dev1flow.net:1flow.git'%0A
%0A%0A@task%0A
|
8d017a1f54bfff98f8f571c69d1e19ddbe8abdde | Add processify decorator | tools/processify.py | tools/processify.py | Python | 0.000015 | @@ -0,0 +1,1463 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0A%22%22%22Taken from https://gist.github.com/schlamar/2311116%22%22%22%0A%0Afrom __future__ import division, print_function%0A%0Aimport sys%0Aimport traceback%0Afrom functools import wraps%0Afrom multiprocessing import Process, Queue%0A%0A%0Adef processify(... | |
c5da3ee962a05c05d55fd98149c1095a57f03e36 | Add tests for task types for shot route | test/shots/test_task_types_for_shot.py | test/shots/test_task_types_for_shot.py | Python | 0.000001 | @@ -0,0 +1,935 @@
+from test.base import ApiDBTestCase%0A%0A%0Aclass ShotTaskTypesTestCase(ApiDBTestCase):%0A%0A def setUp(self):%0A super(ShotTaskTypesTestCase, self).setUp()%0A self.generate_fixture_project_status()%0A self.generate_fixture_project()%0A self.generate_fixture_entity_type... | |
554243dd90d6a96e5782f2b3e7ed5a72254fdf5b | Add tests. | test/test_jobs/test_export_userdata.py | test/test_jobs/test_export_userdata.py | Python | 0 | @@ -0,0 +1,3103 @@
+# -*- coding: utf8 -*-%0A# This file is part of PYBOSSA.%0A#%0A# Copyright (C) 2018 Scifabric LTD.%0A#%0A# PYBOSSA is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as published by%0A# the Free Software Foundation, either version ... | |
ff68543ba0ebe15b5847dfbc0f2d45221b1f3634 | add inflexible fast tests | tests/fast_test_suite.py | tests/fast_test_suite.py | Python | 0.000567 | @@ -0,0 +1,1500 @@
+import unittest%0Afrom test_evaluation_metrics import EvaluationMetricsTestCase%0Afrom test_appliance_trace import ApplianceTraceTestCase%0Afrom test_appliance_instance import ApplianceInstanceTestCase%0Afrom test_appliance_set import ApplianceSetTestCase%0Afrom test_appliance_type import ApplianceT... | |
fc74bf1ee86b667221d25c296c305d2d2e478e23 | add inflexible fast tests | tests/fast_test_suite.py | tests/fast_test_suite.py | Python | 0.001224 | @@ -0,0 +1,1500 @@
+import unittest%0Afrom test_evaluation_metrics import EvaluationMetricsTestCase%0Afrom test_appliance_trace import ApplianceTraceTestCase%0Afrom test_appliance_instance import ApplianceInstanceTestCase%0Afrom test_appliance_set import ApplianceSetTestCase%0Afrom test_appliance_type import ApplianceT... | |
de15489a27c28c6cb5bf35c325ebdd6e4dad5d2c | Create log.py | lib/log.py | lib/log.py | Python | 0.000002 | @@ -0,0 +1,5 @@
+test%0A
| |
21b8c5317af4ff129f72fa949e32a57eae0df7d4 | Create categoryManager.py | app/utils/categoryManager.py | app/utils/categoryManager.py | Python | 0.000001 | @@ -0,0 +1,3336 @@
+#!/usr/bin/env python2%0A# -*- coding: utf-8 -*-%0A%22%22%22%0ACategory manager utility.%0A%0AManage values in the Category table and manage links between Category%0Aand Profiles.%0A%22%22%22%0Aimport argparse%0Aimport os%0Aimport sys%0A# Allow imports to be done when executing this file directly.%0... | |
a9976160ad297953ecb91ff38fe904a993eba784 | Remove _clean | dajax/core.py | dajax/core.py | from django.utils import simplejson as json
class Dajax(object):
def __init__(self):
self.calls = []
def json(self):
return json.dumps(self.calls)
def alert(self, message):
self.calls.append({'cmd': 'alert', 'val': self._clean(message)})
def assign(self, id, attribute, valu... | Python | 0.000066 | @@ -253,28 +253,15 @@
l':
-self._clean(
message
-)
%7D)%0A%0A
@@ -380,34 +380,21 @@
'val':
-self._clean(
value
-)
%7D)%0A%0A
@@ -560,34 +560,21 @@
'val':
-self._clean(
value
-)
%7D)%0A%0A
@@ -743,34 +743,21 @@
'val':
-self._clean(
value
-)
%7D)%0A%0A
@@ -872,34 +872,21 @@
'val':
-self.... |
5db1ac3c73ebba56f478c8ee75d725032c5ab34e | Create gui.py | client/gui.py | client/gui.py | Python | 0.000001 | @@ -0,0 +1 @@
+%0A
| |
26b0c71b43c19984121c3f474b0836981950c468 | Add 0014 file | Drake-Z/0014/0014.py | Drake-Z/0014/0014.py | Python | 0 | @@ -0,0 +1,1331 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A'''%E7%AC%AC 0014 %E9%A2%98%EF%BC%9A %E7%BA%AF%E6%96%87%E6%9C%AC%E6%96%87%E4%BB%B6 student.txt%E4%B8%BA%E5%AD%A6%E7%94%9F%E4%BF%A1%E6%81%AF, %E9%87%8C%E9%9D%A2%E7%9A%84%E5%86%85%E5%AE%B9%EF%BC%88%E5%8C%85%E6%8B%AC%E8%8A%B1%E6%8B%AC%E5%8F%B7%EF%BC... | |
3f6b36d96e7e718ff7fb9d98a8211448f6b0d7e9 | Add upgrade script | scripts/upgrade_appservice_db.py | scripts/upgrade_appservice_db.py | Python | 0.000001 | @@ -0,0 +1,925 @@
+import argparse%0Aimport json%0Aimport sqlite3%0A%0A%0Adef main(dbname):%0A con = sqlite3.connect(dbname)%0A cur = con.cursor()%0A cur.execute(%22SELECT id, regex FROM application_services_regex%22)%0A for row in cur.fetchall():%0A try:%0A print %22checking %25s...%22 %2... | |
b56ef794a0690d29757d3934d3611018bb4f7b66 | Remove atexit()-debugger shutdown from lldb_batchmode.py | src/etc/lldb_batchmode.py | src/etc/lldb_batchmode.py | # Copyright 2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://... | Python | 0 | @@ -1379,87 +1379,8 @@
it%0A%0A
-# Terminate the debugger%0Aatexit.register(lambda: lldb.SBDebugger.Terminate())%0A%0A
# Se
|
fe757d0f17c57f6748ca28e678bb22a9f36271de | Add cd magic test | metakernel/magics/tests/test_cd_magic.py | metakernel/magics/tests/test_cd_magic.py | Python | 0.000001 | @@ -0,0 +1,200 @@
+%0Aimport os%0Afrom metakernel.tests.utils import get_kernel%0A%0A%0Adef test_cd_magic():%0A kernel = get_kernel()%0A kernel.do_execute(%22%25cd ~%22)%0A assert os.getcwd() == os.path.expanduser('~'), os.getcwd()%0A
| |
09a02900174044b9ab3f7cddfe9314c8bdf669b4 | fix errors | pokemongo_bot/event_handlers/telegram_handler.py | pokemongo_bot/event_handlers/telegram_handler.py | # -*- coding: utf-8 -*-
from pokemongo_bot.event_manager import EventHandler
from telegram.error import NetworkError, Unauthorized
from pokemongo_bot.base_dir import _base_dir
import json
import os
import time
import telegram
import thread
import re
DEBUG_ON = False
class FileIOException(Exception):
pass
class T... | Python | 0.000014 | @@ -74,62 +74,8 @@
ler%0A
-from telegram.error import NetworkError, Unauthorized%0A
from
@@ -4426,16 +4426,31 @@
except
+telegram.error.
NetworkE
@@ -4504,16 +4504,31 @@
except
+telegram.error.
Unauthor
|
daef27939bed715d8a7d1f27fbfb4a193fb2de73 | add multiprocessing for cpu-load | src/python/multiprocessing/predict.py | src/python/multiprocessing/predict.py | Python | 0 | @@ -0,0 +1,1634 @@
+# -*- coding:utf-8 -*-%0A%0Aimport os%0Aimport sys%0Afrom math import ceil%0Aimport time%0Aimport signal%0Aos.environ%5B'OMP_NUM_THREADS'%5D = '1'%0Aimport numpy as np%0Aimport multiprocessing as mp%0A%0AMATRIX_SIZE = (20000, 20000)%0A#MATRIX_SIZE = (2000, 2000)%0Apool = None%0AEXIT_FLAG = False%0A%... | |
067668ee5879ba80cd29c9ae0ddee2a9be15fc31 | Create weather.py | weather.py | weather.py | Python | 0.000699 | @@ -0,0 +1,1698 @@
+%0Afrom bs4 import BeautifulSoup%0A%0A%0A# In%5B27%5D:%0A%0Aimport urllib2%0A%0A%0A# In%5B28%5D:%0A%0Af = open('weather_1.txt', 'w')%0Af.write(%22Date%22 + '%5Ct' + %22Temp%22 +'%5Ct' + %22precp%22 +'%5Cn')%0A%0A%0A# In%5B29%5D:%0A%0Afor y in range(2013, 2014):%0A for m in range(1, 13):%0A for d... | |
bdc9a6525e75014c727eeaf0aeb8b21a5b2290ca | Create wildchr.py | wildchr.py | wildchr.py | Python | 0.00008 | @@ -0,0 +1,504 @@
+def match(str1,str2):%0A print '_'%0A if str1=='*' and str2=='' :%0A return True%0A if str1=='' and str2=='' :%0A return True%0A %0A if str1=='' or str2=='' :%0A return False%0A if str1%5B0%5D ==str2%5B0%5D :%0A return match(str1%5B1:%5D,str2%5B1:%5D)%0A ... | |
0942d2ccf68b88db2616f9839c1ca1ebfacb8ad9 | Migrate in domain model changes | migration/versions/013_dataset_serp.py | migration/versions/013_dataset_serp.py | Python | 0 | @@ -0,0 +1,346 @@
+from sqlalchemy import *%0Afrom migrate import *%0A%0Ameta = MetaData()%0A%0Adef upgrade(migrate_engine):%0A meta.bind = migrate_engine%0A dataset = Table('dataset', meta, autoload=True)%0A%0A serp_title = Column('serp_title', Unicode())%0A serp_title.create(dataset)%0A%0A serp_teaser ... | |
c3743e6ba9f38388c6705f59b7991d4ed75d849e | Add helper module | helper.py | helper.py | Python | 0.000001 | @@ -0,0 +1,174 @@
+from itertools import tee%0A%0A%0Adef pairwise(itr):%0A a, b = tee(itr) # two version of itr%0A next(b, None) # b goes ahead one step%0A return zip(a, b) # return iterator%0A%0A
| |
53f4477776e922455c4a9180ac587ccfe5a3f589 | add Matplotlib1DWidget | src/pymor/gui/matplotlib.py | src/pymor/gui/matplotlib.py | Python | 0 | @@ -0,0 +1,1364 @@
+# This file is part of the pyMor project (http://www.pymor.org).%0A# Copyright Holders: Felix Albrecht, Rene Milk, Stephan Rave%0A# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)%0A%0Afrom __future__ import absolute_import, division, print_function%0A%0Aimport math as m%... | |
19efe3a61f182c285c8437e356556148bcb4d9ff | rename method to save metadata | castra/core.py | castra/core.py | import tempfile
import bloscpack
import pickle
from bisect import bisect
import os
import pandas as pd
def escape(text):
return str(text)
class Castra(object):
def __init__(self, columns, dtypes, index_dtype, path=None):
if path is None:
path = tempfile.mkdtemp(prefix='castra-')
... | Python | 0.000001 | @@ -596,21 +596,13 @@
def
-ensure_static
+flush
_met
|
572bc25db9d6a2f8e46728fae2149981c91d28c8 | fix pep8 indentation | castra/core.py | castra/core.py | import tempfile
import bloscpack
import blosc
import pickle
import os
from os import mkdir
from os.path import exists, isdir, join
import pandas as pd
import numpy as np
from pandas import msgpack
import shutil
def escape(text):
return str(text)
def _safe_mkdir(path):
if not exists(path):
mkdir(path... | Python | 0.000004 | @@ -1628,16 +1628,36 @@
pe='O',%0A
+
|
9961234594b2581707978c20a51b838ba4b70627 | Add lan_ping.py | lan_ping.py | lan_ping.py | Python | 0.999743 | @@ -0,0 +1,1430 @@
+#!/usr/bin/env python%0A# -*- coding:utf8 -*-%0A%0Aimport Queue%0Aimport threading%0Aimport subprocess%0Aimport re%0Aimport sys%0A%0Alock = threading.Lock()%0ADEFAULT_THREAD_NUM = 100%0A%0A%0Adef get_ips(ip):%0A a = re.match(r'(.*%5Cd+)%5C.(%5Cd+)-(%5Cd+)', ip)%0A if not a:%0A raise Exc... | |
b768281bf3b0e069312b64e738c12064cf4bd185 | add missing model migration | features/tags/migrations/0002_auto_20170116_2047.py | features/tags/migrations/0002_auto_20170116_2047.py | Python | 0.000002 | @@ -0,0 +1,394 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.5 on 2017-01-16 19:47%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('tags', '0001_initial'),%0A %5D%0A%0A operations = %5B... | |
b38ddb6c279da63d98e64476b4edc6b4c02f02d6 | add numeric sample | numeric.py | numeric.py | Python | 0.000005 | @@ -0,0 +1,100 @@
+# -*- coding: utf-8 -*-%0A%0Aprint(0b11)%0Aprint(0o17)%0Aprint(0xb)%0A%0A# int('2.1') # Error%0A%0Aprint(type(0xb))%0A
| |
86d7f74be733cd334142e43165cae8aa0de58cf3 | finding largest prime factor of a number | src/lasgest_prime_factor.py | src/lasgest_prime_factor.py | Python | 0.999563 | @@ -0,0 +1,166 @@
+#!/usr/bin/env python%0Aimport math%0Anum=input();%0AlastPrime=0;%0Afor i in range(2,int(math.sqrt(num))+1):%0A%09while(num%25i==0):%0A%09%09num=num/i;%0A%09%09lastPrime=i;%0A%0Aprint lastPrime%09%09%0A
| |
8d22023a065992f2f218920229df0d8de8feb463 | improve naming/organization | lib/oe/test_types.py | lib/oe/test_types.py | import unittest
from oe.maketype import create, factory
class TestTypes(unittest.TestCase):
def assertIsInstance(self, obj, cls):
return self.assertTrue(isinstance(obj, cls))
def assertIsNot(self, obj, other):
return self.assertFalse(obj is other)
def assertFactoryCreated(self, value, typ... | Python | 0 | @@ -334,19 +334,19 @@
-obj
+cls
= facto
@@ -379,19 +379,19 @@
rtIsNot(
-obj
+cls
, None)%0A
@@ -450,19 +450,19 @@
flags),
-obj
+cls
)%0A%0Aclass
@@ -503,23 +503,23 @@
ef test_
-boolean
+invalid
(self):%0A
@@ -723,24 +723,16 @@
ef test_
-boolean_
true(sel
@@ -746,37 +746,36 @@
self.assert
-Equ... |
961d8b3a27ed88f09f6bc59b71003f60efd9e601 | Create bloomberg_spider.py | bloomberg_spider.py | bloomberg_spider.py | Python | 0.001714 | @@ -0,0 +1,564 @@
+import scrapy%0A%0Aclass BloombergSpider(scrapy.Spider):%0A name = 'bloomberg'%0A start_urls = %5B%0A 'http://www.bloomberg.com/quote/AAPL:US',%0A 'http://www.bloomberg.com/quote/GOOGL:US',%0A 'http://www.bloomberg.com/quote/AMZN:US',%0A %5D%0A%0A def parse(self, resp... | |
aa050504a47f92738831153eee3d04a217ade9b7 | Add rapmap script | workflow-KSHV_RNA-Seq_RapMap.py | workflow-KSHV_RNA-Seq_RapMap.py | Python | 0 | @@ -0,0 +1,1569 @@
+#!/usr/bin/env python%0A%0A# Standard packages%0Aimport sys%0Aimport argparse%0A%0A# Third-party packages%0Afrom toil.job import Job%0A%0A# Package methods%0Afrom ddb import configuration%0Afrom ddb_ngsflow import gatk%0Afrom ddb_ngsflow import pipeline%0Afrom ddb_ngsflow.rna import rapmap%0A%0A%0Ai... | |
11a69bd2fe6e7eb9e2372dc8a21dd3c41b0ab2ef | Add iow_util.py | webapp/graphite/iow_util.py | webapp/graphite/iow_util.py | Python | 0.000103 | @@ -0,0 +1,160 @@
+from django.conf import settings%0A%0Adef check_tenant(tenant):%0A if tenant not in settings.TENANT_LIST:%0A return settings.TENANT_LIST%5B0%5D%0A return tenant%0A
| |
29a6ac8b0744e8569928dbdf3648485f0fe78ae7 | add register handlers | bot.py | bot.py |
from telegram import Updater, InlineQueryResultPhoto
from game_manager import GameManager
import card as c
from credentials import TOKEN
gm = GameManager()
u = Updater(TOKEN)
dp = u.dispatcher
def new_game(bot, update):
chat_id = update.message.chat_id
link = gm.generate_invite_link(u.bot.getMe().username,... | Python | 0.000001 | @@ -688,21 +688,19 @@
ue the /
-start
+new
command
@@ -1388,8 +1388,155 @@
lt.id))%0A
+%0Adp.addTelegramInlineHandler(inline)%0Adp.addTelegramCommandHandler('start', start)%0Adp.addTelegramCommandHandler('new', new_game)%0A%0Au.start_polling()%0A
|
938fa9463b4cf248593ae1917bd6d7f9413a183a | add a modle to send serial data | Python/servercode/simchipcomputer.py | Python/servercode/simchipcomputer.py | Python | 0 | @@ -0,0 +1,634 @@
+# coding=UTF-8%0Afrom time import sleep, ctime%0Aimport serial%0Aimport threading%0Aport='com4';%0Abaudrate=9600;%0AMyserial = serial.Serial(port,baudrate); %0Adef Handle(Text124):%0A%09while True:%0A%09%09count = Myserial.inWaiting() %0A%09%09if count != 0:%0A%09%09%09recv = Myserial.read(count)%0A... | |
8f2c2e566281507dfded1bae855ba0236694aac0 | Add a few tests. | test/system_test.py | test/system_test.py | Python | 0.000001 | @@ -0,0 +1,1849 @@
+# -*- coding: utf-8 -*-%0A# Copyright (C) 2015 Bj%C3%B6rn Edstr%C3%B6m %3Cbe@bjrn.se%3E%0A%0Aimport signify%0Aimport unittest%0A%0A%0Aclass SignifyTest(unittest.TestCase):%0A%0A KAT = %5B%0A %7B%0A 'pub': %22%22%22untrusted comment: bjorntest public key%0ARWQ100QRGZoxU+Oy1g7Ko+8... | |
9fe3701edb29b5aa4bdb4f363fbdbd16f50d62c6 | Add slugs to models in test. | mzalendo/core/tests/test_persons.py | mzalendo/core/tests/test_persons.py | import re
import datetime
from django.conf import settings
from django.core import mail
from django_webtest import WebTest
from django.test.client import Client
from django.test import TestCase
from django.contrib.auth.models import User
from core import models
import mzalendo.scorecards.models
class PersonTest(Web... | Python | 0 | @@ -1501,24 +1501,16 @@
ith'%5D )%0A
-
%0Aclass P
@@ -2781,16 +2781,39 @@
name='
+MP',%0A slug='
mp',%0A
@@ -3031,16 +3031,47 @@
Place%22,%0A
+ slug='bobs_place',%0A
|
37d23e16f091f462f83708959cfff73d8811eb47 | build docker image for SPM | neurodocker/interfaces/tests/test_spm.py | neurodocker/interfaces/tests/test_spm.py | Python | 0 | @@ -0,0 +1,1354 @@
+%22%22%22Tests for neurodocker.interfaces.SPM%22%22%22%0A# Author: Jakub Kaczmarzyk %3Cjakubk@mit.edu%3E%0Afrom __future__ import absolute_import, division, print_function%0Afrom io import BytesIO%0A%0Aimport pytest%0A%0Afrom neurodocker.docker_api import Dockerfile, DockerImage, DockerContainer%0Af... | |
51faed84f4d56fe3455a6568bdadbc9b16196175 | Add day 5 part 1. | day5-1.py | day5-1.py | Python | 0.000041 | @@ -0,0 +1,483 @@
+%22%22%22Module to find the passowrd on a bunny door.%22%22%22%0A%0A%0Aimport hashlib%0A%0A%0Adef main():%0A %22%22%22Run the main function.%22%22%22%0A id = 'cxdnnyjw'%0A password = %5B%5D%0A begin = '00000'%0A index = 0%0A%0A while len(password) %3C 8:%0A test = id + str(in... | |
b18fc3912682d39ba5a4addfab963e50736e689c | test libressl when there is no libressl | tests/hazmat/bindings/test_openssl.py | tests/hazmat/bindings/test_openssl.py | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import os
import pytest
from cryptography.hazmat.bindings.openssl.bindi... | Python | 0.000053 | @@ -333,16 +333,432 @@
nding%0A%0A%0A
+def skip_if_libre_ssl(openssl_version):%0A if b'LibreSSL' in openssl_version:%0A pytest.skip(%22LibreSSL hard-codes RAND_bytes to use arc4random.%22)%0A%0A%0Aclass TestLibreSkip(object):%0A def test_skip_no(self):%0A assert skip_if_libre_ssl(b%22OpenSSL 0.9.8z... |
d813448c1b9a16d58c8d24d27267893b39c4b908 | Add calc_coolfunc_profile.py: calculate cooling function proifle | bin/calc_coolfunc_profile.py | bin/calc_coolfunc_profile.py | Python | 0.000001 | @@ -0,0 +1,2142 @@
+#!/usr/bin/env python3%0A#%0A# Copyright (c) 2017 Weitian LI %3Cliweitianux@live.com%3E%0A# MIT license%0A%0A%22%22%22%0ACalculate the cooling function profile with respect to the input%0Atemperature profile by interpolating the previously calculated%0Acooling function table.%0A%0AIn this way, the c... | |
18bc9e0fb7c084e56e77b54b69fca5471d04be5f | add missing Devince migration | devices/migrations/0007_device_used_in_rm_default.py | devices/migrations/0007_device_used_in_rm_default.py | Python | 0.999274 | @@ -0,0 +1,558 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.13 on 2018-06-28 19:59%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 ('devices', '0006... | |
28dda425039716b23a22f8f61889d10c96467e17 | Add site context processor | app/context_processors.py | app/context_processors.py | Python | 0.000001 | @@ -0,0 +1,180 @@
+from django.contrib.sites.models import Site%0A%0A%0Adef request_site(request):%0A %22%22%22Current site instalnce processor%22%22%22%0A return %7B%0A 'SITE': Site.objects.get_current(),%0A %7D%0A
| |
7ea4d3d9117f0586749dad3ce1ff3a038c40ffa8 | Add missing file | openprescribing/openprescribing/slack.py | openprescribing/openprescribing/slack.py | Python | 0.000006 | @@ -0,0 +1,599 @@
+import os%0A%0Aimport requests%0A%0A%0Adef notify_slack(message):%0A %22%22%22Posts the message to #general%0A %22%22%22%0A # Set the webhook_url to the one provided by Slack when you create%0A # the webhook at%0A # https://my.slack.com/services/new/incoming-webhook/%0A webhook_url ... | |
764a4396300fa5c50c7c129bc24ce1cfdd597c03 | add foo.py | foo.py | foo.py | Python | 0.998168 | @@ -0,0 +1,317 @@
+# -*- coding: utf-8 -*-%0A# Project pxchar%0A%0Aimport sys%0Aimport os.path%0Afrom PIL import Image%0A%0A# %E5%88%9D%E6%9C%9F%E5%8C%96%0Adef init():%0A pass;%0A%0A# %E3%83%86%E3%82%AD%E3%82%B9%E3%83%88%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%92%E4%B8%80%E6%96%87%E5%AD%97%E3%81%9A%E3%81%A4%E8%AA%... | |
82199c60097599f5273c97fee649473a8a069ec8 | Add missing migration | democracy/migrations/0023_add_comment_location_and_images.py | democracy/migrations/0023_add_comment_location_and_images.py | Python | 0.0002 | @@ -0,0 +1,3443 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.6 on 2016-09-15 12:32%0Afrom __future__ import unicode_literals%0A%0Afrom django.conf import settings%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0Aimport django.utils.timezone%0Aimport djgeojson.fields%0A%0A%0Acla... | |
e6b52bbb4353ef797a83ead2a8dd2037f284cbb1 | Update create_manufacturer_records.py | erpnext/patches/v6_16/create_manufacturer_records.py | erpnext/patches/v6_16/create_manufacturer_records.py | # Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr
def execute():
frappe.reload_doctype("Manufacturer")
frappe.reload_doctype("Item")
for d in frappe.db.... | Python | 0.000001 | @@ -243,15 +243,31 @@
_doc
-type(%22M
+(%22stock%22, %22doctype%22, %22m
anuf
@@ -697,8 +697,9 @@
n.save()
+%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.