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 |
|---|---|---|---|---|---|---|---|
5fd7164238281c23ea89999687bde7b6b2d179ce | Create bisect_search.py | bisect_search.py | bisect_search.py | Python | 0 | @@ -0,0 +1,286 @@
+x=int(raw_input('Enter your integer number(!not negative!):'))%0Aepsilon=0.01%0Alow=0.0%0Ahigh=x%0Aans=(high+low)/2.0%0Awhile abs(ans**2-x)%3E=epsilon:%0A if ans**2 %3C x:%0A low=ans%0A else:%0A high=ans%0A ans=(high+low)/2.0%0A %0Aprint (str(ans) + ' is close to square root of... | |
0e642c373a67997041664e51d0c867b1af4583fb | add missing file from last commit | dev/apitest/operational-send.py | dev/apitest/operational-send.py | Python | 0 | @@ -0,0 +1,686 @@
+#!/usr/bin/env python%0A%0Aimport os%0Aimport sys%0Aimport time%0A%0A# When the parent dies we are seeing continual newlines, so we only access so many before stopping%0Acounter = 1%0A%0Awhile True:%0A%09try:%0A%09%09time.sleep(1)%0A%09%09if counter %25 2:%0A%09%09%09print 'operational adm %22this is... | |
51947adcc02d6a5ae20494f577e6402f2f263fcf | Add the arrayfns compatibility library -- not finished. | numpy/oldnumeric/arrayfns.py | numpy/oldnumeric/arrayfns.py | Python | 0.000069 | @@ -0,0 +1,2055 @@
+%22%22%22Backward compatible with arrayfns from Numeric%0A%22%22%22%0A%0A__all__ = %5B'array_set', 'construct3', 'digitize', 'error', 'find_mask', 'histogram', 'index_sort',%0A 'interp', 'nz', 'reverse', 'span', 'to_corners', 'zmin_zmax'%5D%0A%0Aimport numpy as nx%0Afrom numpy import asarr... | |
ffb77316a1ea7c2677484eed998a1822f0d92d7b | version 5 | scripts/cambioCrimen.py | scripts/cambioCrimen.py | Python | 0 | @@ -0,0 +1,2037 @@
+#!/usr/bin/env python%0Aimport csv%0Afrom os import listdir%0Afrom os import walk%0Aimport os,sys%0Afrom datetime import datetime, date, time, timedelta%0Aimport calendar%0A# -*- coding: utf-8%0A#Variable para la ruta al directorio%0Apath = '/s3mnt3/procesed/' %0A#Lista vacia para incluir los archiv... | |
f52e033c433cba6de6611b123b1c075f34fe96bf | add tools/simple_gen.py | tools/simple_gen.py | tools/simple_gen.py | Python | 0.000001 | @@ -0,0 +1,639 @@
+# simple_gen.py from_column to_column file%0Aimport sys%0Aimport re%0A%0Adef bsdconv01(dt):%0A%09dt=dt.strip().lstrip(%220%22).upper()%0A%09if len(dt) & 1:%0A%09%09return %22010%22+dt%0A%09else:%0A%09%09return %2201%22+dt%0A%0Astp = re.compile(r%22%5E(U%5C+%7C0X)%22)%0Asep = re.compile(r%22%5Cs+%22)%... | |
003378314b8e11f6b67d155348708964ec184292 | add XML validation utility | sbin/validate_xml.py | sbin/validate_xml.py | Python | 0 | @@ -0,0 +1,1779 @@
+#!/usr/bin/python%0A# -*- coding: ISO-8859-15 -*-%0A# =================================================================%0A#%0A# $Id$%0A#%0A# Authors: Angelos Tzotsos %3Ctzotsos@gmail.com%3E%0A#%0A# Copyright (c) 2011 Angelos Tzotsos%0A#%0A# Permission is hereby granted, free of charge, to any person... | |
1aaf19e369033c9baf198b0ab1ee43067dd2669d | Add Base Bot | bots/base_bot.py | bots/base_bot.py | Python | 0 | @@ -0,0 +1,242 @@
+import choppycamp.constants as constants%0A%0A%0Aclass BaseBot(object):%0A def __init__(self, name, map_, enemy):%0A self.name = name%0A self.map = map_%0A self.enemy = enemy%0A%0A def act(self, map_):%0A return constants.DANCE%0A
| |
d0f92caf504e78a3fd7257ac9fab1fbd9c039212 | Add simple tests for DAP validator wrappers. | distarray/tests/test_testing.py | distarray/tests/test_testing.py | Python | 0 | @@ -0,0 +1,1682 @@
+# encoding: utf-8%0A# ---------------------------------------------------------------------------%0A# Copyright (C) 2008-2014, IPython Development Team and Enthought, Inc.%0A# Distributed under the terms of the BSD License. See COPYING.rst.%0A# ----------------------------------------------------... | |
d38b276168c2d0597ce87e6756c846a47bd9f3fb | use the right web.base.url | addons/mail/update.py | addons/mail/update.py | # -*- coding: utf-8 -*-
import datetime
import logging
import sys
import urllib
import urllib2
import pooler
import release
from osv import osv, fields
from tools.translate import _
from tools.safe_eval import safe_eval
from tools.config import config
from tools import misc
_logger = logging.getLogger(__name__)
"""
... | Python | 0 | @@ -546,32 +546,38 @@
ef get_sys_logs(
+self,
cr, uid):%0A %22%22
@@ -570,16 +570,16 @@
, uid):%0A
-
%22%22%22%0A
@@ -1648,26 +1648,16 @@
e_url =
-safe_eval(
self.poo
@@ -1728,17 +1728,16 @@
'False')
-)
%0A msg
@@ -2428,16 +2428,17 @@
y_url%22)%0A
+%0A
uo =
@@ -3156,16 +3156,22 @@
ys_logs(
+s... |
987f8325b32c468ab2aa134bed35314e0170def1 | implement most of repl module | modules/repl.py | modules/repl.py | Python | 0.000001 | @@ -0,0 +1,1212 @@
+import code%0Aimport sys%0A%0Afrom util.nick import nickeq, nicklower%0A%0Aclass Repl(code.InteractiveConsole):%0A%09def __init__(self, circa, channel):%0A%09%09code.InteractiveConsole.__init__(self, %7B%22circa%22: circa%7D)%0A%09%09self.circa = circa%0A%09%09self.channel = channel%0A%09%09self.buf... | |
89d25a460fd805a53bdfbced459c78a24f3b7da0 | Add yamtbx.ipython command | yamtbx/command_line/yamtbx_ipython.py | yamtbx/command_line/yamtbx_ipython.py | Python | 0.99882 | @@ -0,0 +1,148 @@
+# LIBTBX_SET_DISPATCHER_NAME yamtbx.ipython%0Aimport sys%0Afrom IPython import start_ipython%0Aif __name__ == '__main__':%0A sys.exit(start_ipython())%0A
| |
3f7e08443e6c5a00b9df9831fad0a13f7c516dd0 | add simple test for login | opmuse/test/test_security.py | opmuse/test/test_security.py | Python | 0 | @@ -0,0 +1,456 @@
+from . import setup_db, teardown_db%0Afrom nose.tools import with_setup%0Afrom opmuse.security import User, hash_password%0A%0A%0A@with_setup(setup_db, teardown_db)%0Aclass TestSecurity:%0A def test_login(self):%0A user = self.session.query(User).filter_by(login=%22admin%22).one()%0A%0A ... | |
6dfa189bdab536ecfa2c14e4893017363923ee6a | Implement Naive Bayes Classifier builder method | bayes.py | bayes.py | Python | 0.000001 | @@ -0,0 +1,714 @@
+import numpy as np%0Aimport cv2%0A%0A# pos and neg are positive and negative instances%0A# each is a list of files of nparray dumps,%0A# nparray of BoW histograms; shape = (n, 101)%0A# of the class to be trained for%0Adef build_trained_classifier(pos_files, neg_files):%0A total = len(pos_files) + ... | |
e90fb0e3ca17f15a5058a3f1d1e08be376b1863b | Add Asset Instance model | zou/app/models/asset_instance.py | zou/app/models/asset_instance.py | Python | 0 | @@ -0,0 +1,629 @@
+from sqlalchemy_utils import UUIDType%0A%0Afrom zou.app import db%0Afrom zou.app.models.serializer import SerializerMixin%0Afrom zou.app.models.base import BaseMixin%0A%0A%0Aclass AssetInstance(db.Model, BaseMixin, SerializerMixin):%0A asset_id = db.Column(UUIDType(binary=False), db.ForeignKey('en... | |
6b215d2dd3c6915b4d1c5a46b2a890b14cae7d75 | Add test for Issue #1537 | spacy/tests/regression/test_issue1537.py | spacy/tests/regression/test_issue1537.py | Python | 0 | @@ -0,0 +1,922 @@
+'''Test Span.as_doc() doesn't segfault'''%0Afrom ...tokens import Doc %0Afrom ...vocab import Vocab%0Afrom ... import load as load_spacy%0A%0A%0Adef test_issue1537():%0A string = 'The sky is blue . The man is pink . The dog is purple .'%0A doc = Doc(Vocab(), words=string.split())%0A doc%5B0%... | |
358ea3780ea5cbb165357f8089c4aa23aab7de73 | test route53. | tests/test_route53.py | tests/test_route53.py | Python | 0 | @@ -0,0 +1,1078 @@
+from __future__ import (absolute_import, print_function, unicode_literals)%0Afrom acli.output.route53 import (output_route53_list, output_route53_info)%0Afrom acli.services.route53 import (route53_list, route53_info)%0Afrom acli.config import Config%0Afrom moto import mock_route53%0A%0Aimport pytest... | |
b6b239cf16849890434a31755f3f3d2b8e510a95 | add benchmark comparing to SQLAlchemy, only 12x faster for simple select :) | benchmark.py | benchmark.py | Python | 0 | @@ -0,0 +1,1232 @@
+import time%0A%0Afrom sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey%0Afrom sqlalchemy.sql import select%0A%0Afrom norm import SELECT%0A%0Ametadata = MetaData()%0Ausers = Table(%0A 'users', metadata,%0A Column('id', Integer, primary_key=True),%0A Column('name', Strin... | |
28801ac8f38e8560c17b2da57559762ecd5e06ca | copy babel.plural doctests as unit tests | tests/test_plural.py | tests/test_plural.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | Python | 0 | @@ -551,100 +551,1722 @@
l%0A%0A%0A
-def suite():%0A suite = unittest.TestSuite()%0A suite.addTest(doctest.DocTestSuite(plural)
+class test_plural_rule():%0A rule = plural.PluralRule(%7B'one': 'n is 1'%7D)%0A assert rule(1) == 'one'%0A assert rule(2) == 'other'%0A%0A rule = plural.PluralRule(%7B'one'... |
e3636bd897fbd7af4aab5b501269a55a89de29a0 | Add public view tests | tests/test_public.py | tests/test_public.py | Python | 0 | @@ -0,0 +1,606 @@
+# -*- coding: utf-8 -*-%0A%22%22%22Test the public routes.%22%22%22%0A%0Afrom corral.app import create_app%0A%0A%0Adef test_root():%0A app = create_app()%0A app.config%5B'AUTH_KEY'%5D = 'secretpassword'%0A%0A with app.test_client() as c:%0A rv = c.get('/')%0A assert b'%3Ch1%3EL... | |
71b6246dda3e4812490a5c2936eac44e063806c0 | Add tests for sonify submodule | tests/test_sonify.py | tests/test_sonify.py | Python | 0.000001 | @@ -0,0 +1,1691 @@
+%22%22%22 Unit tests for sonification methods %22%22%22%0A%0Aimport mir_eval%0Aimport numpy as np%0A%0A%0Adef test_clicks():%0A # Test output length for a variety of parameter settings%0A for times in %5Bnp.array(%5B1.%5D), np.arange(10)*1.%5D:%0A for fs in %5B8000, 44100%5D:%0A ... | |
5cd73c0c2307e6e93680a749991f81b0767a9d47 | Add missing ppapi_cpp_objects dependency to pdf | pdf/pdf.gyp | pdf/pdf.gyp | {
'variables': {
'chromium_code': 1,
'pdf_engine%': 0, # 0 PDFium
},
'targets': [
{
'target_name': 'pdf',
'type': 'static_library',
'dependencies': [
'../base/base.gyp:base',
'../components/components.gyp:ui_zoom',
'../content/content.gyp:content_common',
... | Python | 0.000002 | @@ -340,16 +340,64 @@
p:net',%0A
+ '../ppapi/ppapi.gyp:ppapi_cpp_objects',%0A
|
0050d1ca6f0fa15462231cf5531d494277c1f8ca | move events from claw to claw-scripts | scripts/events.py | scripts/events.py | Python | 0.000001 | @@ -0,0 +1,1775 @@
+#! /usr/bin/env claw%0A########%0A# Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A#... | |
c3fd15307b20a891ef194221c51ec1897355fd29 | Use built-in print() instead of print statement | tools/install_venv.py | tools/install_venv.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# flake8: noqa
# Copyright 2010 OpenStack, LLC
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Ve... | Python | 0.000101 | @@ -1781,21 +1781,22 @@
print
-
+(
help
+)
%0A%0A%0Adef m
|
c76775b244ccd07a73ec0d894f5e940ae673dd73 | implement ordereddict | src/ovirtsdk/utils/ordereddict.py | src/ovirtsdk/utils/ordereddict.py | Python | 0.000023 | @@ -0,0 +1,2227 @@
+%0Afrom UserDict import UserDict%0Aimport thread%0A%0Aclass OrderedDict(UserDict):%0A %22%22%22A dictionary preserving insert order%22%22%22%0A def __init__(self, dict=None):%0A self._keys = %5B%5D%0A UserDict.__init__(self, dict)%0A self.__plock = thread.allocate_lock()%0... | |
1f225b06eed8e7c3266c9d9c48e7b5e86ee677a0 | Test ssh | run_time2.py | run_time2.py | Python | 0.000002 | @@ -0,0 +1,104 @@
+import cProfile%0A%0AcProfile.run(%22core_alg.process_from_file('/Users/cat/data/maxmal-cliques/turan30_10')%22)
| |
f46361d1009665e87543b56d69212b04b9b14993 | Add scripts which Define a function to compute color histogram features | VehicleDetectionTracking/histo_colors.py | VehicleDetectionTracking/histo_colors.py | Python | 0.000006 | @@ -0,0 +1,1821 @@
+# Code given by Udacity, complete by Andres Guijarro%0A# Purpose: Define a function to compute color histogram features%0A%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0Aimport matplotlib.image as mpimg%0A%0Aimage = mpimg.imread('cutout1.jpg')%0A%0A# Define a function to compute color hist... | |
428670421c60305c7c89579fe81419bfc0a920fa | Create facebook.py | ACR/components/facebook.py | ACR/components/facebook.py | Python | 0 | @@ -0,0 +1,2465 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A# Asyncode Runtime - enabling non-tech people to develop internet software.%0A# Copyright (C) 2014-2015 Asyncode Ltd.%0A%0A# PROPRIETARY component%0A%0Afrom ACR.components import *%0Afrom ACR.utils import generateID, replaceVars%0Afrom ACR.utils.i... | |
ff19fd40ea90da1b47bdaa26522f0a30ca18e73f | make all mysql tables explicitly innodb | nova/db/sqlalchemy/migrate_repo/versions/086_set_engine_mysql_innodb.py | nova/db/sqlalchemy/migrate_repo/versions/086_set_engine_mysql_innodb.py | Python | 0.000001 | @@ -0,0 +1,2454 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4%0A%0A# Copyright 2011 OpenStack LLC.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http:... | |
19297efacbc15434e13854aff9c204520ce45179 | Create example_uncertainty.py | examples/example_uncertainty.py | examples/example_uncertainty.py | Python | 0.00005 | @@ -0,0 +1,1248 @@
+import matplotlib.pyplot as plt%0Aimport pandas as pd%0A%0Aimport pastas as ps%0A%0Aps.set_log_level(%22ERROR%22)%0A%0A# read observations and create the time series model%0Aobs = pd.read_csv(%22data/head_nb1.csv%22, index_col=0, parse_dates=True,%0A squeeze=True)%0Aml = ps.Model(ob... | |
9b099f9b9fb51d5bc1983e68f8267b2fca0ddfec | Create close.py | close.py | close.py | Python | 0 | @@ -0,0 +1,508 @@
+## Open a serial connection with Arduino.%0Aimport time%0Aimport serial%0Aser = serial.Serial(%22COM9%22, 9600) # Open serial port that Arduino is using%0Atime.sleep(3) # Wait 3 seconds for Arduino to reset%0Aprint ser # Print serial config%0A%0A%0Apr... | |
b303eccd4b3ec902f90c0e4bfb18314b37dd763b | print using future example | examples/python2/basic/print.py | examples/python2/basic/print.py | Python | 0.000009 | @@ -0,0 +1,143 @@
+#!/usr/bin/env python%0A%0A# to change to python 3 print syntax (reommended!)%0Afrom __future__ import print_function%0A%0Aprint('o' 'n' %22e%22)%0A# %3E%3E%3E one%0A%0A
| |
b643ab99586d4a4f0aa6da285b1c7a50259f516c | tox test fix: nose runner should not return 1 in case of error since all runners always return 0 | python/helpers/pycharm/noserunner.py | python/helpers/pycharm/noserunner.py | import sys
import os
helpers_dir = os.getenv("PYCHARM_HELPERS_DIR", sys.path[0])
if sys.path[0] != helpers_dir:
sys.path.insert(0, helpers_dir)
from nose_utils import TeamcityPlugin
from pycharm_run_utils import debug, import_system_module
from pycharm_run_utils import adjust_sys_path
adjust_sys_path(False)
sh... | Python | 0.998344 | @@ -2326,16 +2326,28 @@
g=config
+, exit=False
)%0A%0Aif __
|
7eb21d4cb05dd26835e10cb17ff1ef399b228067 | Add api tests | app/tests/test_api.py | app/tests/test_api.py | Python | 0.000001 | @@ -0,0 +1,1362 @@
+import unittest%0A%0Afrom app import app, state%0A%0A%0Aclass TestAPI(unittest.TestCase):%0A %0A def setUp(self):%0A self.app = app.test_client()%0A%0A def tearDown(self):%0A state.stop_program()%0A%0A def test_start_all(self):%0A programs= %5B%22ascii_text%22, %22ch... | |
a2e18f9b10e5e6bbcad6c13cdc5c76047d319fc2 | Add fake limited composite example | python/tests/test_pv_composite_wavelet.py | python/tests/test_pv_composite_wavelet.py | Python | 0.000001 | @@ -0,0 +1,2142 @@
+# -----------------------------------------------------------------------------%0A# User configuration%0A# -----------------------------------------------------------------------------%0AoutputDir = '/Users/seb/Desktop/float-image/'%0A# ---------------------------------------------------------------... | |
3e85c471765f03151d0f6d11680b16c6eccedbec | Add Django admin for browsers, browser versions | webplatformcompat/admin.py | webplatformcompat/admin.py | Python | 0 | @@ -0,0 +1,341 @@
+from django.contrib import admin%0Afrom simple_history.admin import SimpleHistoryAdmin%0A%0Afrom .models import Browser, BrowserVersion%0A%0A%0Aclass BrowserAdmin(SimpleHistoryAdmin):%0A pass%0A%0A%0Aclass BrowserVersionAdmin(SimpleHistoryAdmin):%0A pass%0A%0A%0Aadmin.site.register(Browser, Bro... | |
70a377088a2a589cb1433a508fc6ecec3c053c18 | Revert "websockets: continue listening for messages after parsing completion" | tornado/websocket.py | tornado/websocket.py | #!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# 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 a... | Python | 0.000002 | @@ -5125,47 +5125,8 @@
e%22))
-%0A self.receive_message(callback)
%0A%0A
|
503179f2ed6416a719c1caea90a7882519bedfa9 | Add py23 compat layer | Lib/fontTools/misc/py23.py | Lib/fontTools/misc/py23.py | Python | 0 | @@ -0,0 +1,304 @@
+%22%22%22Python 2/3 compat layer.%22%22%22%0A%0Atry:%0A%09basestring%0Aexcept NameError:%0A%09basestring = str%0A%0Atry:%0A%09unicode%0Aexcept NameError:%0A%09unicode = str%0A%0Atry:%0A%09unichr%0A%09bytechr = chr%0Aexcept:%0A%09unichr = chr%0A%09def bytechr(n):%0A%09%09return bytes(%5Bn%5D)%0A%0Atry... | |
5fa27287c37dd77ebcabf7759e4bb96693b86d8d | Create Africa2010_A.py | GoogleCodeJam/Africa2010_A.py | GoogleCodeJam/Africa2010_A.py | Python | 0.000001 | @@ -0,0 +1,322 @@
+def solve(i, d):%0A C, I, prices = d%0A C = int(C)%0A prices = list(map(int, prices.split()))%0A for p1, P1 in enumerate(prices%5B:-1%5D):%0A remains = C-P1%0A left = prices%5Bp1+1:%5D%0A if remains in left:%0A result = %5Bp1+1, p1+left.index(remains)+2%5D%... | |
e1e7922efac2b7fdfab7555baaf784edb345c222 | Add circle sort implementation (#5548) | sorts/circle_sort.py | sorts/circle_sort.py | Python | 0 | @@ -0,0 +1,2306 @@
+%22%22%22%0AThis is a Python implementation of the circle sort algorithm%0A%0AFor doctests run following command:%0Apython3 -m doctest -v circle_sort.py%0A%0AFor manual testing run:%0Apython3 circle_sort.py%0A%22%22%22%0A%0A%0Adef circle_sort(collection: list) -%3E list:%0A %22%22%22A pure Python... | |
fff27fd33a4139c7d22b086364ab483819081adf | Create costs.py | costs.py | costs.py | Python | 0.000001 | @@ -0,0 +1,1076 @@
+#!/usr/bin/env python%0Aimport re%0Aimport sys%0Aimport json%0A%0A%0Adef get_stdin():%0A stdin_lines = %5B%5D%0A for line in sys.stdin:%0A stdin_lines.append(line)%0A return ''.join(stdin_lines)%0A%0A%0Adef get_domains(text):%0A # NOTE(evanscottgray) YES I KNOW THAT THIS IS NOT PE... | |
0899700549466f27748b8ac907c0d582aaad5556 | add the python file to test cntk and GPU | test_cntk.py | test_cntk.py | Python | 0.000001 | @@ -0,0 +1,2793 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Wed May 31 22:46:43 2017%0A%0A@author: Lingyu%0A%22%22%22%0A%0Afrom cntk.device import try_set_default_device, gpu%0Aprint('Use GPU: %7B%7D'.format(try_set_default_device(gpu(0))))%0A%0Aimport numpy as np%0Aimport cntk as C%0Afrom cntk.learners import... | |
aa7211e22aeade9fc462914492dae235eb68f2eb | Implement 2-class categorical -> Bernoulli converter | bayespy/inference/vmp/nodes/bernoulli.py | bayespy/inference/vmp/nodes/bernoulli.py | ######################################################################
# Copyright (C) 2014 Jaakko Luttinen
#
# This file is licensed under Version 3.0 of the GNU General Public
# License. See LICENSE for a text of the license.
######################################################################
####################... | Python | 0 | @@ -3370,8 +3370,1572 @@
rint(p)%0A
+%0A%0Afrom .deterministic import Deterministic%0Afrom .categorical import Categorical, CategoricalMoments%0A%0Aclass CategoricalToBernoulli(Deterministic):%0A %22%22%22%0A A node for converting 2-class categorical moments to Bernoulli moments.%0A %22%22%22%0A%0A %0A ... |
3bb2528bf4de7dd2cb01754627b6f932c322ffa6 | Add --noinput to start | src/sentry/management/commands/start.py | src/sentry/management/commands/start.py | """
sentry.management.commands.start
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError
from optparse ... | Python | 0 | @@ -839,24 +839,235 @@
ault=None),%0A
+ make_option('--noinput',%0A action='store_true',%0A dest='noinput',%0A default=False,%0A help='Tells Django to NOT prompt the user for input of any kind.',%0A ),%0A
)%0A%0A d
@@ -1951,16 +1951,48 @@
bosity=0
+, n... |
6a2bd578cc22231bce66a4d110b4ff1536743097 | Add index to the `created_at` column in `published_award_financial_assistance` and the `updated_at` column in `detached_award_procurement` | dataactcore/migrations/versions/7597deb348fb_fabs_created_at_and_fpds_updated_at_.py | dataactcore/migrations/versions/7597deb348fb_fabs_created_at_and_fpds_updated_at_.py | Python | 0 | @@ -0,0 +1,1251 @@
+%22%22%22FABS created_at and FPDS updated_at indexes%0A%0ARevision ID: 7597deb348fb%0ARevises: b168f0cdc5a8%0ACreate Date: 2018-02-06 16:08:20.985202%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '7597deb348fb'%0Adown_revision = 'b168f0cdc5a8'%0Abranch_labels = None%0Adep... | |
847aef794f77ed036c77d7334263434a7d4c0084 | Add pad.py: pad file to given size using given byte. | tools/pad.py | tools/pad.py | Python | 0 | @@ -0,0 +1,1419 @@
+#!/usr/bin/python3%0A#%0A# Read a file from standard input and if it's size is less the specified size%0A# pad it writing the result to standard output.%0A#%0A# Example:%0A# echo -n 'abc' %7C ./pad.py 16 0x50 %7C hexdump -C%0A# 00000000 61 62 63 50 50 50 50 50 50 50 50 50 50 50 50 50 %7Cabc... | |
80889986cd4742d7c63be46447b0097eac5bd745 | Update letter-case-permutation.py | Python/letter-case-permutation.py | Python/letter-case-permutation.py | # Time: O(n * 2^n)
# Space: O(n * 2^n)
# Given a string S, we can transform every letter individually to be lowercase
# or uppercase to create another string. Return a list of all possible strings we could create.
#
# Examples:
# Input: S = "a1b2"
# Output: ["a1b2", "a1B2", "A1b2", "A1B2"]
#
# Input: S = "3z4"
# Out... | Python | 0.000003 | @@ -810,10 +810,9 @@
ult%5B
--1
+i
%5D.ap
@@ -818,19 +818,19 @@
ppend(c.
-upp
+low
er())%0A
@@ -846,33 +846,34 @@
result%5B
-i
+-1
%5D.append(c.lower
@@ -859,35 +859,35 @@
lt%5B-1%5D.append(c.
-low
+upp
er())%0A
|
9c17b5eada0c9830c6b6a9a8fe20bfe2ec6e8728 | Create conflict_test.py | conflict_test.py | conflict_test.py | Python | 0 | @@ -0,0 +1,698 @@
+%22%22%22The point of this exercise is to create a merging conflict.%0AAccomplish this by deleting the line containing the if statement%0Aabove your name. Only modify the one if statement with your name%22%22%22%0A%0A%0A## BEFORE%0A## if(%22name%22):%0A## print %22name%22%0A##%0A## AFTER%0A## ... | |
8e98b8d884b53eaeb43c03548a32520e34fb340e | Add pID | peas/PID.py | peas/PID.py | Python | 0.000022 | @@ -0,0 +1,2683 @@
+from datetime import datetime%0A%0A%0Aclass PID:%0A%0A '''%0A Pseudocode from Wikipedia:%0A%0A previous_error = 0%0A integral = 0%0A start:%0A error = setpoint - measured_value%0A integral = integral + error*dt%0A derivative = (error - previous_error)/dt%0A output ... | |
29d0797540461f8c021ecad6e5d1e724dcc3e378 | Make a simple infinite while loop to run tests. | tardis/tests/tests_slow/runner.py | tardis/tests/tests_slow/runner.py | Python | 0 | @@ -0,0 +1,218 @@
+import time%0Aimport subprocess%0A%0A%0Aif __name__ == %22__main__%22:%0A while True:%0A subprocess.call(%5B%0A %22python%22, %22setup.py%22, %22test%22, %22--test-path=tardis/tests/test_util.py%22,%0A %5D)%0A time.sleep(20)%0A
| |
ff3d5c6e35560f7377c373d0179557b1a7f070a9 | Fix logic on alt user tenant/password check. | tempest/tests/compute/__init__.py | tempest/tests/compute/__init__.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack, LLC
# All Rights Reserved.
#
# 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/... | Python | 0.000165 | @@ -2726,16 +2726,20 @@
word or
+not
user2_te
|
1e88cd0cd034520eb4987a9b80b5aa48acebd181 | Increase heartbeat timeout to 45 seconds, due to latency of heartbeat commands, caused by holding globallock for long periods | rackattack/physical/alloc/allocation.py | rackattack/physical/alloc/allocation.py | from rackattack.common import globallock
from rackattack.common import hoststatemachine
from rackattack.common import timer
import time
import logging
import tempfile
class Allocation:
_HEARTBEAT_TIMEOUT = 15
_LIMBO_AFTER_DEATH_DURATION = 60
def __init__(self, index, requirements, allocationInfo, allocat... | Python | 0 | @@ -209,9 +209,9 @@
T =
-1
+4
5%0A
|
04cebfba4c7ee5bf4b05bab811a944724224e3c3 | add 0000 file | Drake-Z/0000/0000.py | Drake-Z/0000/0000.py | Python | 0.000001 | @@ -0,0 +1,680 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A'%E7%AC%AC 0000 %E9%A2%98%EF%BC%9A%E5%B0%86%E4%BD%A0%E7%9A%84 QQ %E5%A4%B4%E5%83%8F%EF%BC%88%E6%88%96%E8%80%85%E5%BE%AE%E5%8D%9A%E5%A4%B4%E5%83%8F%EF%BC%89%E5%8F%B3%E4%B8%8A%E8%A7%92%E5%8A%A0%E4%B8%8A%E7%BA%A2%E8%89%B2%E7%9A%84%E6%95%B0%E5%AD%97%E... | |
a11ac7235e448aeed145cc7b98e43180e1428155 | Create __openerp__.py | __openerp__.py | __openerp__.py | Python | 0 | @@ -0,0 +1,612 @@
+%7B%0A 'name': 'Website MegaMenu %5BBootstrap%5D',%0A 'description': 'This module will implement MegaMenu functionality to improve on the default built-in Odoo menu for use with both the E-commerce and CMS modules.',%0A 'category': 'Website',%0A 'version': '1.0',%0A 'author': 'Luke Bra... | |
962cfc6be2aaedcfaefe927a39b31847ca433b14 | obtain TWO digit country codes | country_codes.py | country_codes.py | Python | 0.999999 | @@ -0,0 +1,301 @@
+from pygal.maps.world import COUNTRIES%0A%0Adef get_country_code(country_name):%0A %22%22%22Return the pygal 2-digit country code for the given country%22%22%22%0A for code, name in COUNTRIES.items():%0A if name == country_name:%0A return code%0A #if country wasn't found re... | |
4045b41e74a7d5c7c001c386bd488306aa04017e | Fix test function name. | sklearn/cluster/tests/test_hierarchical.py | sklearn/cluster/tests/test_hierarchical.py | """
Several basic tests for hierarchical clustering procedures
Author : Vincent Michel, 2010
"""
import numpy as np
from scipy.cluster import hierarchy
from nose.tools import assert_true
from sklearn.cluster import Ward, WardAgglomeration, ward_tree
from sklearn.cluster.hierarchical import _hc_cut
from sklearn.featu... | Python | 0.000047 | @@ -4340,19 +4340,23 @@
_fixing_
-bug
+non_lil
():%0A
|
9013f072a8b82ab65ad2c599fe331f7835ebee47 | Test users app URL patterns | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py | Python | 0 | @@ -0,0 +1,1716 @@
+from django.core.urlresolvers import reverse, resolve%0A%0Afrom test_plus.test import TestCase%0A%0A%0Aclass TestUserURLs(TestCase):%0A %22%22%22Test URL patterns for users app.%22%22%22%0A%0A def setUp(self):%0A self.user = self.make_user()%0A%0A def test_list_reverse(self):%0A ... | |
c960f88cc1f8c15bf20a426d8e1e5f2b34799a13 | Create calc.py | plugins/calc.py | plugins/calc.py | Python | 0.000007 | @@ -0,0 +1,519 @@
+@bot.message_handler(commands=%5B'calc'%5D)%0Adef clac(m):%0A userid = m.from_user.id%0A banlist = redisserver.sismember('zigzag_banlist', '%7B%7D'.format(userid))%0A if banlist:%0A return%0A if len(m.text.split()) %3C 2:%0A bot.reply_to(m, %22How can i calculate null?%22)%0A return%0A ... | |
96e1b85370f363c9ddda01c6052a94d6a78e2528 | Add VoltageTrace class in traces module | uconnrcmpy/traces.py | uconnrcmpy/traces.py | Python | 0 | @@ -0,0 +1,1422 @@
+%22%22%22All of the kinds of traces in UConnRCMPy%22%22%22%0A%0A# System imports%0A%0A# Third-party imports%0Aimport numpy as np%0Afrom scipy import signal as sig%0A%0A# Local imports%0A%0A%0Aclass VoltageTrace(object):%0A %22%22%22Class for the voltage trace of an experiment%22%22%22%0A%0A de... | |
e24cc0ded12c0a0afd48b2c5f115c71b61ba476f | Add back n-per-state | Mixtape/commands/pullmeans.py | Mixtape/commands/pullmeans.py | '''Get structures at the center of each state in an HMM
'''
# Author: Robert McGibbon <rmcgibbo@gmail.com>
# Contributors:
# Copyright (c) 2014, Stanford University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following con... | Python | 0.999218 | @@ -2698,32 +2698,219 @@
select from''')%0A
+ group.add_argument('--n-per-state', type=int, required=True, help='''Select the%0A %60n-per-state%60 most representative structures from each state. default=1''',%0A default=1)%0A
group.add_ar
@@ -4064,19 +4064,19 @@
index'%5D.
-app
+ext
end(sort
@@... |
0b5dfb1c421998884afd59a37da3c8eaef389471 | Create makedict.py | projects/ansible/makedict.py | projects/ansible/makedict.py | Python | 0.000002 | @@ -0,0 +1,1249 @@
+from collections import defaultdict%0A%0Aclass FilterModule(object):%0A def filters(self):%0A return %7B %0A 'createmylist': self.createlistfunction%0A %7D%0A %0A def createlistfunction(self, instancelist, clustervars, hostvars_tmp,playhost_tmp, startindex, endi... | |
9d48ac6d4d9f48d7b51e67bfe351c20ba0d259c7 | add class to show all item_req, inherits from ItemsListWidget | trunk/editor/itemreqlistwidget.py | trunk/editor/itemreqlistwidget.py | Python | 0 | @@ -0,0 +1,718 @@
+#!/usr/bin/env python%0A%0Afrom itemslistwidget import ItemsListWidget%0A%0Aclass ItemReqListWidget(ItemsListWidget):%0A%0A %22%22%22%0A classe utilizzata per la visualizzazione degli item_req%0A %22%22%22%0A%0A def changeSelection(self, row, column):%0A selection = self.table.sele... | |
4c2125a440d06963aa5ea52d805bd021efcafb17 | Add : dash class to be the interface between the Flask views and the localization/parsing APIs. | core/dash.py | core/dash.py | Python | 0 | @@ -0,0 +1,962 @@
+from parser import Parser%0Afrom geoloc import Geoloc%0A%0A%0Aclass Dasher(object):%0A %22%22%22%0A Dasher class definition.%0A%0A Simply the middleware between the raw datalog and the view functions.%0A Takes the raw lists of usefull info and does all the counting and preparing%0A for... | |
8b0b42dcf0402fff4dee1b7a452977e25776a514 | Create Search_for_a_range.py | Array/Search_for_a_range.py | Array/Search_for_a_range.py | Python | 0.000003 | @@ -0,0 +1,1394 @@
+Given a sorted array of integers, find the starting and ending position of a given target value.%0A%0AYour algorithm's runtime complexity must be in the order of O(log n).%0A%0AIf the target is not found in the array, return %5B-1, -1%5D.%0A%0AFor example,%0AGiven %5B5, 7, 7, 8, 8, 10%5D and target ... | |
8627d56a9312b1a464ee8207e631c37cb26e6b6a | Delete src/oldmem. | util/make_release.py | util/make_release.py | #!/usr/bin/env python
# Copyright (c) 2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyrigh... | Python | 0 | @@ -4107,42 +4107,8 @@
h')%0A
-rmtree(release_dir, 'src/oldmem')%0A
rmtr
|
ff7755dbf7e5eee1dfaee60eb061479cca823cff | Create portscan.py | portscan.py | portscan.py | Python | 0.000001 | @@ -0,0 +1,1433 @@
+#!/usr/bin/python%0A%0Aimport os%0Aimport sys%0Aimport socket%0Aimport string%0Aimport multiprocessing%0Afrom multiprocessing import Lock%0A%0Adef PORTscanner(IP, PORT, proc, lock):%0A %0A openPorts = %5B%5D%0A socket.setdefaulttimeout(2)%0A sock = socket.socket(socket.AF_INET, socket.SO... | |
e92c9e3d62341aa92b040e6e28ee5990187d0e2c | ensure triggers are lowercase | forms.py | forms.py | Python | 0.999946 | @@ -0,0 +1,399 @@
+#!/usr/bin/env python%0A# vim: ai ts=4 sts=4 et sw=4%0A%0Afrom django import forms%0Afrom models import *%0A%0Aclass TreeForm(forms.ModelForms):%0A%09class Meta:%0A%09%09model = Tree%0A%0A%09def clean_alias(self):%0A%09%09data = self.cleaned_data%5B%22trigger%22%5D%0A%09%09return data.lower()%0A%0Acl... | |
18facb30efeffb88e3b96d1d899f249bfd00f776 | Create problem4.py | problem4.py | problem4.py | Python | 0.000009 | @@ -0,0 +1,390 @@
+# Pretty brute force-ish way of attacking this problem.%0A# Just wanted to keep it simple stupid, plus python can handle it ;)%0A# Answer: 906609%0Adef problem4():%0A results = %5B%5D%0A for i in reversed(range(999)):%0A for j in reversed(range(999)):%0A result = str(i*j)%0A if result ... | |
e7685951e1d271b07df0e4a0681a2404806f4028 | Add (simple) test cases for Stock API | InvenTree/stock/test_api.py | InvenTree/stock/test_api.py | Python | 0 | @@ -0,0 +1,2246 @@
+from rest_framework.test import APITestCase%0Afrom rest_framework import status%0Afrom django.urls import reverse%0Afrom django.contrib.auth import get_user_model%0A%0Afrom .models import StockLocation, StockItem%0A%0A%0Aclass StockLocationTest(APITestCase):%0A %22%22%22 %0A Series of API test... | |
a676dfce887129c196d94bb3289c7bab8081368b | Remove get_internal_type and let the parent class handle it. | push_notifications/fields.py | push_notifications/fields.py | import re
import struct
from django import forms
from django.core.validators import RegexValidator
from django.db import models, connection
from django.utils.six import with_metaclass
from django.utils.translation import ugettext_lazy as _
__all__ = ["HexadecimalField", "HexIntegerField"]
hex_re = re.compile(r"^0x[0... | Python | 0 | @@ -1460,72 +1460,8 @@
n)%0A%0A
-%09def get_internal_type(self):%0A%09%09return self.__class__.__name__%0A%0A
%09def
|
4c5f51e49ed5bfa12e0c784457c46f8d0e1cb041 | Update regression test | spacy/tests/regression/test_issue636.py | spacy/tests/regression/test_issue636.py | Python | 0.000001 | @@ -0,0 +1,424 @@
+# coding: utf8%0Afrom __future__ import unicode_literals%0A%0Afrom ...tokens.doc import Doc%0Aimport pytest%0A%0A%0A@pytest.mark.xfail%0A@pytest.mark.models%0A@pytest.mark.parametrize('text', %5B%22I cant do this.%22%5D)%0Adef test_issue636(EN, text):%0A %22%22%22Test that to_bytes and from_bytes ... | |
06877818a354face257852bfc03eef8d70cd0b0a | add VIN query example | examples/query_vin.py | examples/query_vin.py | Python | 0.000008 | @@ -0,0 +1,1827 @@
+#!/usr/bin/env python%0Adef msg(x):%0A print %22S:%22,x.encode(%22hex%22)%0A if len(x) %3C= 7:%0A ret = chr(len(x)) + x%0A else:%0A assert False%0A return ret.ljust(8, %22%5Cx00%22)%0A%0Adef isotp_send(panda, x, addr, bus=0):%0A if len(x) %3C= 7:%0A panda.can_send(addr, msg(x), bus)%0A... | |
b36ade70a8f7b2f0b4d67f107d11202f7a6ddbed | Bump version number for pypi release. | exception_notifier.py | exception_notifier.py | """Mail uncaught exceptions to developers.
"""
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import smtplib
import socket
import traceback
import cgitb
import sys
import os
import os.path
# Stolen from six: https://bitbucket.org/gutworth/six
# Useful for very coarse version diffe... | Python | 0 | @@ -484,16 +484,18 @@
= '0.3.1
+.1
'%0A%0A_log_
|
5c142d7e7a311013dd940a6d6900b5d9984dc0fe | Create dynamic image & draw some text on it | python/dynamic_image_meme.py | python/dynamic_image_meme.py | Python | 0 | @@ -0,0 +1,886 @@
+import requests%0Aimport json%0A%0A# Dynamically create a 300x300 PNG image with a yellow background and draw some text on the center of it later.%0A# Refer to https://pixlab.io/#/cmd?id=newimage && https://pixlab.io/#/cmd?id=drawtext for additional information.%0A%0Areq = requests.get('https://api.p... | |
88877163201ce32d28633b833e1ec17cd3429650 | Add script for cleaning up old SMS/MMS text messages | python/misc/clean-sms-mms.py | python/misc/clean-sms-mms.py | Python | 0.000001 | @@ -0,0 +1,1184 @@
+#!/usr/bin/env python3%0A%0A''' Deletes old messages from a backup file created by Titanium Backup Pro%0A'''%0A%0Aimport datetime%0Aimport lxml.etree%0Aimport shutil%0Aimport sys%0A%0AMAXIMUM_MESSAGE_AGE_IN_DAYS = 365%0A%0Aif len(sys.argv) %3C 2:%0A sys.exit('USAGE: %25s /path/to/com.keramidas.vi... | |
c8ec6825e8e5cbf465b06f426324d481249c61d6 | Create octree.py | pysrc/octree.py | pysrc/octree.py | Python | 0.000005 | @@ -0,0 +1,817 @@
+class Address(object):%0A def __init__(self, x, y, z, depth):%0A self.x = x%0A self.y = y%0A self.z = z%0A self.depth = depth%0A %0A def get_address_at_depth(depth):%0A mask = 1 %3C%3C depth%0A x_bit = (mask & self.x) %3E%3E depth%0A y_bit... | |
ba907a0c12c5bf90fa796d36fe18218df12281ae | Add GDB pretty-printer for short_vector<T,N> | printers.py | printers.py | Python | 0.000001 | @@ -0,0 +1,948 @@
+import gdb%0Aimport re%0A %0Aclass ShortVectorPrinter:%0A def __init__(self, val):%0A self.val = val%0A%0A def to_string(self):%0A size = int(self.val%5B'_size'%5D)%0A N = int(self.val.type.template_argument(1))%0A cap = N if size %3C= N else int(self.val%5B'_capacit... | |
abee38d119cf49388081d01dc2484b58775333a8 | fix image URLs | record_fixer.py | record_fixer.py | Python | 0.999962 | @@ -0,0 +1,1398 @@
+#!/usr/bin/python%0A# This fixes some of the image URLs in records.pickle.%0Aimport record%0Aimport re%0Aimport cPickle%0Ars = record.AllRecords()%0A%0Afor idx, r in enumerate(rs):%0A url = r.photo_url%0A%0A # Some images have thumbnails but are missing the full photo URL.%0A # Convert%0A # h... | |
6892653c0573a6a55f359cce6c1796053ef65cbf | Use unscoped token to fetch authorized projects. Fixes bug 927939. | horizon/horizon/middleware.py | horizon/horizon/middleware.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | Python | 0.000001 | @@ -1767,16 +1767,142 @@
try:%0A
+ token = request.session.get(%22unscoped_token%22,%0A request.user.token)%0A
@@ -1998,37 +1998,24 @@
-request.user.
token,%0A
|
ca30516df8037cfb0745f84481f7ada936447a8a | Support of old profile names | vkfeed/pages/main.py | vkfeed/pages/main.py | # -*- coding: utf-8 -*-
'''Generates the main page.'''
import re
from google.appengine.ext import webapp
import vkfeed.util
class MainPage(webapp.RequestHandler):
'''Generates the main page.'''
def get(self):
'''Processes a GET request.'''
self.response.out.write(vkfeed.util.render_temp... | Python | 0 | @@ -601,16 +601,17 @@
-zA-Z0-9
+.
_-%5D%7B5,%7D)
|
880c3fc365cffa23f0d060afae6608d057af0fee | fix examples | flexget/plugins/input/betaseries_list.py | flexget/plugins/input/betaseries_list.py | """Input plugin for www.betaseries.com"""
from __future__ import unicode_literals, division, absolute_import
from flexget.plugin import register_plugin
import logging
from flexget.utils import requests
from hashlib import md5
from flexget.utils.cached_input import cached
from flexget.entry import Entry
log = logging.... | Python | 0 | @@ -677,32 +677,37 @@
betaseries
+_list
:%0A user
@@ -887,32 +887,37 @@
betaseries
+_list
:%0A user
@@ -1149,24 +1149,29 @@
betaseries
+_list
:%0A
|
c413b0fcf972580fc32822d1a5c3b96efeabc00f | Update trakt_remove.py | flexget/plugins/services/trakt_remove.py | flexget/plugins/services/trakt_remove.py | from __future__ import unicode_literals, division, absolute_import
import logging
import hashlib
from requests import RequestException
from flexget.plugin import register_plugin
from flexget.utils import json
log = logging.getLogger('trakt_remove')
class TraktRemove(object):
"""Marks all accepted TV episodes o... | Python | 0 | @@ -3105,52 +3105,8 @@
%7B%7D%0A
- movie%5B'type'%5D = 'movie'%0A
@@ -3201,16 +3201,16 @@
lookups%0A
+
@@ -3814,16 +3814,267 @@
series%0A
+ if url_params%5B'list'%5D == 'watchlist': %0A found.setdefault('movies', %7B%7D).setdefault('movie... |
e67eb99442732339c8aee8a856ceb135fd8ff85d | move to python, mainly for json comparison | scripts/test.py | scripts/test.py | Python | 0 | @@ -0,0 +1,1514 @@
+#!/usr/bin/env python%0A%0Aimport requests%0Aimport json%0A%0Abase_url='http://127.0.0.1:8000/court/'%0Acourt_file='../data/sample_court.json'%0Aoauth_token='foobar'%0A%0Awith open('../data/sample_court.json') as f:%0A sample_court_json = f.read()%0A%0Aheaders = %7B'Authorization': 'Bearer '+oaut... | |
4dfd34f002c613ab0f73f07fe4cae30e2ef9be6f | add a simple export tool for JSON performance scenarios | tools/run_tests/performance/scenario_config_exporter.py | tools/run_tests/performance/scenario_config_exporter.py | Python | 0 | @@ -0,0 +1,2510 @@
+#!/usr/bin/env python3%0A%0A# Copyright 2020 The gRPC Authors%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENS... | |
6dd7e2da8c87a663fe1fa68df4b727f2c12c4b21 | Create emailer.py | emailer.py | emailer.py | Python | 0.000002 | @@ -0,0 +1,1973 @@
+import threading%0Aimport boto, time%0A%0A#Fill this array with a DB or CSV%0Aemails = %5B'success@simulator.amazonses.com','success@simulator.amazonses.com','success@simulator.amazonses.com','success@simulator.amazonses.com','success@simulator.amazonses.com'%5D%0A%0Aclass SES():%0A client = None... | |
eec91552f05ca02fa8a8b9ad05bc732c5c099719 | Update postgresql.py | src/bots/outputs/postgresql/postgresql.py | src/bots/outputs/postgresql/postgresql.py | import sys
import psycopg2
from lib.bot import *
from lib.utils import *
from lib.event import *
class PostgreSQLBot(Bot):
def init(self):
try:
self.logger.debug("Connecting to PostgreSQL")
self.con = psycopg2.connect(
database=self.parameters.dat... | Python | 0.000001 | @@ -1116,22 +1116,22 @@
s = len(
-VALUES
+values
) * %22%25s,
|
9a0c4225b542c2406e63f692a96222b2a8bd9940 | Use get_page_models instead of get_page_types in replace_text command | wagtail/wagtailcore/management/commands/replace_text.py | wagtail/wagtailcore/management/commands/replace_text.py | from django.core.management.base import BaseCommand
from django.db import models
from modelcluster.models import get_all_child_relations
from wagtail.wagtailcore.models import PageRevision, get_page_types
def replace_in_model(model, from_text, to_text):
text_field_names = [field.name for field in model._meta.fi... | Python | 0.000002 | @@ -194,20 +194,21 @@
et_page_
-type
+model
s%0A%0A%0Adef
@@ -1108,28 +1108,26 @@
for
-content_type
+page_class
in get_
@@ -1131,20 +1131,21 @@
et_page_
-type
+model
s():%0A
@@ -1191,77 +1191,37 @@
%22 %25
-content_type.name)%0A page_class = content_type.model_class(
+page_class._meta.verbo... |
dfcab560e684afc1463896c98b7a7eeffedf127d | Add oed command. | src/commands/oxford-english-dictionary.py | src/commands/oxford-english-dictionary.py | Python | 0.000003 | @@ -0,0 +1,665 @@
+#%0A# Copyright (c) 2014 Joshua Hughes %3Ckivhift@gmail.com%3E%0A#%0Aimport urllib%0Aimport webbrowser%0A%0Aimport qmk%0A%0Aclass OEDCommand(qmk.Command):%0A '''Look up the given argument using Oxford's dictionary search. A new tab%0A will be opened with the results.'''%0A def __init__(self... | |
6080a7475daef38037b8e8462a7a734380179e3f | Add script to find out click annotations missing help text | scripts/ensure_click_help.py | scripts/ensure_click_help.py | Python | 0 | @@ -0,0 +1,1661 @@
+import ast%0Aimport argparse%0Aimport sys%0A%0A%0Adef stringify_name(name: ast.AST):%0A if isinstance(name, ast.Attribute):%0A return f%22%7Bstringify_name(name.value)%7D.%7Bstringify_name(name.attr)%7D%22%0A if isinstance(name, ast.Name):%0A return name.id%0A if isinstance(na... | |
55e247b407cf677c68c564f60a5cd2d5885e1a25 | add new package (#24929) | var/spack/repos/builtin/packages/py-pydocstyle/package.py | var/spack/repos/builtin/packages/py-pydocstyle/package.py | Python | 0 | @@ -0,0 +1,823 @@
+# Copyright 2013-2021 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 PyPydocstyle(PythonPackage):%0A %22%22%22Python docstrin... | |
d570a0f32375cc4719bb6815da25a5b3168f2313 | Add execute script | execute.py | execute.py | Python | 0.000003 | @@ -0,0 +1,587 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Afrom __future__ import absolute_import%0A%0Afrom hookit import *%0A%0Adef consume_event(event):%0A event.dispatched = True%0A event.save()%0A return event%0A%0A%0Adef process_events(events):%0A for event in events:%0A print event... | |
b838c9eb504f4510537d66d504c9d4d2e1a81de5 | add tools for extracting some info | extract.py | extract.py | Python | 0 | @@ -0,0 +1,516 @@
+#!/usr/bin/env python%0A%0Ahandler = open(%22pinpow1800MW.out%22, %22r+%22)%0Alines = handler.readlines()%0A%0Aoutput = open(%22data.out%22, %22w+%22)%0A%0Awriting = False%0A%0Afor line in lines:%0A# print line%0A if %22Material powers%22 in line:%0A writing = True%0A elif %22--------... | |
3154563f5b21b8728d6ed9eadd1ed031cd223131 | Update classifier | scilearn.py | scilearn.py | Python | 0.000012 | @@ -0,0 +1,715 @@
+from sklearn import tree%0Aimport json%0A%0Adata = 0%0Awith open('./training_data/data.txt') as json_data:%0A data = json.load(json_data)%0A%09%0Atargets = 0%0Awith open('./training_data/targets.txt') as json_data:%0A targets = json.load(json_data)%0A%0Aprint(data)%0Aclf = tree.DecisionTreeClas... | |
7a5a0729f533b027b1e907fdfb3986066887af68 | Update helper text. | funnel/forms/space.py | funnel/forms/space.py | # -*- coding: utf-8 -*-
import re
from coaster.utils import sorted_timezones
from wtforms.widgets import CheckboxInput, ListWidget
from wtforms.ext.sqlalchemy.fields import QuerySelectMultipleField
from baseframe import _, __
import baseframe.forms as forms
from baseframe.forms.sqlalchemy import AvailableName, QuerySe... | Python | 0 | @@ -3628,44 +3628,31 @@
_(u%22
-Checkin team can scan badge to
+Team members can
check
+
in u
@@ -3656,18 +3656,21 @@
n users
-to
+at an
event%22)
@@ -5223,18 +5223,18 @@
tion=u%22U
-rl
+RL
of back
|
a142472b86044395e428abea2fa5ff28b892d1fb | Create attr-utils module; create attribute memoization helper | attr_utils.py | attr_utils.py | Python | 0 | @@ -0,0 +1,254 @@
+def _set_attr( obj, attr_name, value_to_set ):%0A setattr( obj, attr_name, value_to_set )%0A return getattr( obj, attr_name )%0A%0Adef _memoize_attr( obj, attr_name, value_to_set ):%0A return getattr( obj, attr_name, _set_attr( obj, attr_name, value_to_set ) )%0A
| |
c563972de0260201300ef2e9b97746d20f02b824 | add quadruplets.py | Algo-1/week2/3-Quadruplets/quadruplets.py | Algo-1/week2/3-Quadruplets/quadruplets.py | Python | 0.999413 | @@ -0,0 +1,698 @@
+# Returns the number of quadruplets that sum to zero.%0A# a - %5Bint%5D%0A# b - %5Bint%5D%0A# d - %5Bint%5D%0A# c - %5Bint%5D%0A%0A%0A# a + b == -(c + d)%0A# sort%0A# binary search%0A%0A%0Adef zero_quadruplets_count(a, b, c, d):%0A left_sums = %5B%5D%0A right_sums = %5B%5D%0A result = 0%0A%0... | |
74e261b0f68426cd9d82e7b8f832d0f9913dd4ae | Test for apikeys, was missing in bd40e3122bf448946c4ea505c28b4a947b26d5e1 | amivapi/tests/test_apikeys.py | amivapi/tests/test_apikeys.py | Python | 0.000016 | @@ -0,0 +1,483 @@
+from amivapi.tests import util%0A%0A%0Aclass APIKeyTest(util.WebTest):%0A%0A def test_get_users_with_apikey(self):%0A apikey = u%22dsfsjkdfsdhkfhsdkfjhsdfjh%22%0A self.app.config%5B'APIKEYS'%5D%5Bapikey%5D = %7B%0A 'name': 'Testkey',%0A 'users': %7B'GET': 1%7D,%... | |
72ffe438270fb54a1ce163faff6d2083079c77e2 | Add unit test of utils module. | anydo/lib/tests/test_utils.py | anydo/lib/tests/test_utils.py | Python | 0 | @@ -0,0 +1,947 @@
+# -*- coding: utf-8 -*-%0Aimport unittest%0Aimport re%0Aimport sys%0Aimport os.path%0Asys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))%0Afrom anydo.lib import utils%0A%0A%0Aclass UtilsTests(unittest.TestCase):%0A def setUp(self):%0A self.pattern = re.compile('(%5E(%5B%5Cw-%5D+... | |
75ca02b335c4aa20cbb139e68c660e1242800cc0 | Add the init method to the user model. | model/user.py | model/user.py | Python | 0 | @@ -0,0 +1,168 @@
+#!/usr/bin/env python%0A# coding=utf-8%0A%0Aclass UserModel(Query): %0A%09def __init__(self, db):%0A%09%09self.db = db%0A%09%09self.table_name = 'user'%0A%09%09super(UserModel, self).__init__()%0A%0A%0A
| |
d065ee15d2c189e2b0885d111aaaa109ca02ab99 | add stupid image extract program | src/image_extract.py | src/image_extract.py | Python | 0.000009 | @@ -0,0 +1,1693 @@
+#!/usr/bin/env python%0A###############################################################################%0A # Copyright (c) 2015 Jamis Hoo%0A # Distributed under the MIT license %0A # (See accompanying file LICENSE or copy at http://opensource.org/licenses/MIT)%0A # %0A # Project: %0A # Filenam... | |
36a2f0de9f525ea030e4cc805b8ccc7eb29c8098 | Add dependency function (not finished yet) | src/vimapt/library/vimapt/Dependency.py | src/vimapt/library/vimapt/Dependency.py | Python | 0 | @@ -0,0 +1,1009 @@
+import networkx as nx%0A%0A%0Aclass Dependency(object):%0A def __init__(self, package_name):%0A self.package_name = package_name%0A%0A self.dependency_graph = nx.DiGraph()%0A self.dependency_graph.add_node(self.package_name)%0A self.top_node_name = self.package_name%0A... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.