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 |
|---|---|---|---|---|---|---|---|
4f6b1a4dae7701cc79a523e96fe812efaa54745b | Add optimizers tests | tests/auto/test_optimizers.py | tests/auto/test_optimizers.py | Python | 0 | @@ -0,0 +1,1918 @@
+from __future__ import print_function%0Aimport numpy as np%0Anp.random.seed(1337)%0A%0Afrom keras.utils.test_utils import get_test_data%0Afrom keras.optimizers import SGD, RMSprop, Adagrad, Adadelta, Adam%0Afrom keras.models import Sequential%0Afrom keras.layers.core import Dense, Activation%0Afrom ... | |
751b596482cdb473b1a7f9172501e25d00f15724 | Use default loop on TCP benchmark | tests/benchmark-tcp.py | tests/benchmark-tcp.py |
import sys
sys.path.insert(0, '../')
import signal
import threading
import pyuv
RESPONSE = "HTTP/1.1 200 OK\r\n" \
"Content-Type: text/plain\r\n" \
"Content-Length: 12\r\n" \
"\r\n" \
"hello world\n"
def on_client_shutdown(client):
client.close()
clients.remove(c... | Python | 0 | @@ -914,16 +914,29 @@
yuv.Loop
+.default_loop
()%0A%0Aasyn
|
6dbd81fb4b59e7394318cbd0b0f0fdb31fcd6dd2 | Add unit test to ensure we don't diff bare repos | tests/unit/states/test_git.py | tests/unit/states/test_git.py | Python | 0 | @@ -0,0 +1,2786 @@
+# -*- coding: utf-8 -*-%0A'''%0A :codeauthor: Erik Johnson %3Cerik@saltstack.com%3E%0A'''%0A%0A# Import Python libs%0Afrom __future__ import absolute_import%0Aimport logging%0Aimport os%0A%0A# Import Salt Testing Libs%0Afrom tests.support.helpers import with_tempdir%0Afrom tests.support.mixins im... | |
469eedab89d22a1051e9d3f6f7f6c94ba946fb37 | Add server tests for JOIN. | irctest/server_tests/test_channel_operations.py | irctest/server_tests/test_channel_operations.py | Python | 0 | @@ -0,0 +1,1986 @@
+%22%22%22%0ASection 3.2 of RFC 2812%0A%3Chttps://tools.ietf.org/html/rfc2812#section-3.2%3E%0A%22%22%22%0A%0Afrom irctest import cases%0Afrom irctest.irc_utils.message_parser import Message%0A%0Aclass JoinTestCase(cases.BaseServerTestCase):%0A def testJoin(self):%0A %22%22%22%E2%80%9CIf a ... | |
ede8282eed8c198fc728985515e886e5a67ba3e0 | To create appropriate Dir structure | MROCPdjangoForm/ocpipeline/createDirStruct.py | MROCPdjangoForm/ocpipeline/createDirStruct.py | Python | 0.998603 | @@ -0,0 +1,2294 @@
+import os%0Aimport argparse%0Afrom shutil import move, rmtree # For moving files%0A%0A'''%0AModule creates a directory structure as defined by a string userDefProjectDir & moves files in%0Atuple args to the userDefProjectDir%0A'''%0Adef createDirStruct(userDefProjectDir, uploadDirPath, endingDir, te... | |
21742da132aeb9b834b128f7a7d01b7a2173137a | Add a tcp_server which simulates graphite-relay | tcp_server.py | tcp_server.py | Python | 0.000005 | @@ -0,0 +1,1498 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A# vim:fenc=utf-8%0A#%0A%22%22%22%0AA very simple TCP server for simulating a graphite relay, copied-paste from%0APython documentation. Few things were adjusted to make pylint happy and print%0Aincoming data.%0A%22%22%22%0Aimport asyncio%0A%0A%0Aclas... | |
ef52b314eb5e15c34d8b034d7e6f7bdd727b6586 | Add sp500_extractor_v1 version that does not use BeautifulSoup. | Code/sp500_extractor_v1_no_bs.py | Code/sp500_extractor_v1_no_bs.py | Python | 0 | @@ -0,0 +1,1988 @@
+import csv%0Afrom lxml import html%0Aimport time%0Aimport requests%0A%0A%22%22%22%0AMake it work, make it right, make it fast%0A%0AExtract the tickers from the S&P 500 table on Wikipedia, process them into%0Aa list and save them into a CSV file.%0A%0A# Retrieve HTML from URL with requests%0Ahttp://d... | |
d98eebda6b3b0e42ac7ca34c6a1dd6cc8b05d342 | add functions and refactor fibonacci | quickTour/function.py | quickTour/function.py | Python | 0.00001 | @@ -0,0 +1,195 @@
+def fibonacci(n):%0A a,b = 0,1%0A%0A if(n==a):%0A return a%0A if(n==b):%0A return b%0A %0A return fibonacci(n-1)+fibonacci(n-2)%0A %0A%0A%0A%0Afor n in range(0,10):%0A print(fibonacci(n))%0A
| |
17096036326d62e7e25368ff1247e708fa077cb1 | Support __traceback_hide__ on stacks | raven/utils/stacks.py | raven/utils/stacks.py | """
raven.utils.stacks
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import inspect
import re
from raven.utils.encoding import transform
_coding_re = re.compile(r'coding[:=]\s*([-\w.]+)')
def get_lines_from_file(fi... | Python | 0.000038 | @@ -4372,21 +4372,31 @@
or frame
-_crud
+ in (f%5B0%5D for f
in fram
@@ -4389,32 +4389,33 @@
for f in frames
+)
:%0A yield
@@ -4412,27 +4412,93 @@
-yield
+if
frame
-_crud%5B0%5D
+.f_locals.get('__traceback_hide__'):%0A continue%0A yield frame
%0A%0Ade
|
fefb13108a151c5cbfe8c6acd5b94a480dac98ec | Add test for NPairLossScheme | tests/test_datasets.py | tests/test_datasets.py | Python | 0 | @@ -0,0 +1,884 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Tue Feb 21 20:30:26 2017%0A%0A@author: sakurai%0A%22%22%22%0A%0Aimport unittest%0A%0Aimport numpy as np%0A%0Afrom ..datasets.data_provider import NPairLossScheme%0A%0A%0Aclass TestNPairLossScheme(unittest.TestCase):%0A%0A def test_pairs_of_indexes(s... | |
33375a9333852eafa1bf262fb30f5d827c4534f7 | Create networkx.py | networkx.py | networkx.py | Python | 0.000007 | @@ -0,0 +1,16 @@
+import networkx%0A
| |
1c2330d9e45b9e87ed70848fd0ce192b0d06c904 | Update build_status.py | infra/auto-setup/build_status.py | infra/auto-setup/build_status.py | #!/usr/bin/env python
import codecs
import datetime
import os
import subprocess
import sys
import jenkins
import jinja2
from jinja2 import Environment, FileSystemLoader
JENKINS_SERVER = ('localhost', 8080)
LOGS_BUCKET = 'oss-fuzz-build-logs'
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
class Result(obj... | Python | 0.000002 | @@ -84,16 +84,33 @@
port sys
+%0Aimport traceback
%0A%0Aimport
@@ -1256,29 +1256,29 @@
-print %3E%3Esys.stderr, e
+traceback.print_exc()
%0A%0A
|
98a053f945e2c7cc01d8fbdec374ab90305bc11f | Create new files. | ospathex.py | ospathex.py | Python | 0 | @@ -0,0 +1,1562 @@
+#!/usr/bin/python%0A#_*_coding:utf-8_*_%0A%0Aimport os%0A%0Afor tmpdir in ('temp', r'c:%5Cwindows%5Ctemp'):%0A if os.path.isdir(tmpdir):%0A break%0A else:%0A print 'no temp directory available'%0A tmpdir = ''%0A%0Aif tmpdir:%0A os.chdir(tmpdir)%0A cwd = os.getcwd()%0... | |
81ade3168faa68ef43456cc35a122b9ef493a23e | Add script to plot MS flag rate and acq fail rate | plot_ms_flag_acq_fails.py | plot_ms_flag_acq_fails.py | Python | 0 | @@ -0,0 +1,1395 @@
+from __future__ import division%0A%0Aimport matplotlib.pyplot as plt%0Afrom astropy.table import Table%0Aimport numpy as np%0Afrom Ska.DBI import DBI%0Afrom chandra_aca import star_probs%0A%0Adb = DBI(dbi='sybase', server='sybase', user='aca_read')%0A%0Astats = db.fetchall('SELECT * from trak_stats_... | |
f2413f05bc64818297541112f42e2a8d5ae72cbe | Create test_setup.py | test_setup.py | test_setup.py | Python | 0 | @@ -0,0 +1,294 @@
+import wget%0Aimport os%0A%0Atest_files_path = os.getcwd() + '/image-analysis/test/test_data/'%0A%0A# test files will be here whether is data, images, videos ect.%0Atest_files = %5B%22https://s3.amazonaws.com/testcodas/test_video.mp4%22%5D%0A%0Afor file_path in test_files:%0A wget.download(file_path... | |
c54c948531cd73b0c0dd78b6bc8a1c5245886c97 | add visualise.py | visualize.py | visualize.py | Python | 0.000024 | @@ -0,0 +1,1395 @@
+#!/usr/bin/env python%0A%0Aimport json%0Aimport math%0Aimport numpy%0Aimport os%0Aimport re%0Aimport sys%0A%0Aif __name__ == '__main__':%0A if len(sys.argv) %3C 3:%0A print('usage: %25s %5Bresult dir%5D %5Boutput html%5D' %25 sys.argv%5B0%5D)%0A sys.exit()%0A%0A result = %5B%5B%5... | |
6c61c2d367e698861657d4cfc9bba0ba3789f197 | add naive bayes | nb.py | nb.py | Python | 0.999993 | @@ -0,0 +1,2486 @@
+import numpy as np%0A%0Aclass NaiveBayes:%0A def __init__(self):%0A self._prior = None%0A self._mat = None%0A%0A def train(self, X, y):%0A y = np.matrix(y)%0A p1 = y*X%0A p2 = (1-y)*X%0A p = np.vstack(%5B%0A np.log(p1+1) - np.log(p1.sum() + ... | |
9a33761f33c4f49a27d72944c231cb447353d81e | Add problem 10 | 010.py | 010.py | Python | 0 | @@ -0,0 +1,622 @@
+#!/usr/bin/env python3%0A# Author: Severin Kaderli %3Cseverin.kaderli@gmail.com%3E%0A#%0A# Project Euler - Problem 10:%0A# Find the sum of all the primes below two million.%0Adef get_prime_numbers(n):%0A %22%22%22Gets all prime numbers below n.%22%22%22%0A primes, sieve = %5B%5D, %5BTrue%5D * n... | |
d075d188d541090ad8d3a5c4cf583ba10063aa88 | Move timing to right location for staging. | project/project/timing.py | project/project/timing.py | Python | 0 | @@ -0,0 +1,1207 @@
+import time%0A%0Afrom django.utils.deprecation import MiddlewareMixin%0A%0A%0Aclass TimingMiddleware(object):%0A %22%22%22Times a request and adds timing information to the content.%0A%0A Adds an attribute, %60_timing%60, onto the request, and uses this at the end%0A of the rendering chain ... | |
2e503a58a1f9893d25cf2dbb2c885bc9834faebf | Create urls.py | tests/urls.py | tests/urls.py | Python | 0.000017 | @@ -0,0 +1,261 @@
+from django.conf.urls import url, include%0Afrom webhook.base import WebhookBase%0A%0A%0Aclass WebhookView(WebhookBase):%0A%0A def process_webhook(self, data, meta):%0A pass%0A%0A%0Aurlpatterns = %5B%0A url(r'%5Ewebhook-receiver', WebhookView.as_view(), name='web_hook'),%0A%5D%0A
| |
0b3bfeb06a4594a2c188e623835c3a54262cca5d | Write initial Bible book HTML parser | utilities/book_parser.py | utilities/book_parser.py | Python | 0 | @@ -0,0 +1,1525 @@
+# utilities.book_parser%0A# coding=utf-8%0A%0Afrom __future__ import unicode_literals%0Aimport yvs.shared as shared%0Afrom HTMLParser import HTMLParser%0A%0A%0Aclass BookParser(HTMLParser):%0A%0A # Resets parser variables (implicitly called on instantiation)%0A def reset(self):%0A HTMLP... | |
7b2d3aedbc2f78119974c9e724b37b2b336297d1 | Add device_hive_api.py | devicehive/device_hive_api.py | devicehive/device_hive_api.py | Python | 0.000029 | @@ -0,0 +1,1325 @@
+from devicehive.handler import Handler%0Afrom devicehive.device_hive import DeviceHive%0A%0A%0Aclass ApiCallHandler(Handler):%0A %22%22%22Api call handler class.%22%22%22%0A%0A def __init__(self, api, call, *call_args, **call_kwargs):%0A super(ApiCallHandler, self).__init__(api)%0A ... | |
1d4e462188e95b1270d45f95112c2458cbeb7b2f | Add definitions.py | definitions.py | definitions.py | Python | 0 | @@ -0,0 +1,2604 @@
+%0Adef API_launch():%0A %0A global app_config%0A global tweepy%0A%0A# Twitter API configuration%0A consumer_key = app_config.twitter%5B%22consumer_key%22%5D%0A consumer_secret = app_config.twitter%5B%22consumer_secret%22%5D%0A%0A access_token = app_config.twitter%5B%22access_token%... | |
cea01def787c6f9c6bfecd96fe40a7b8a312cf8e | Fix docstrings in RegisterHelper | FTB/Signatures/RegisterHelper.py | FTB/Signatures/RegisterHelper.py | '''
Crash Signature
Represents a crash signature as specified in https://wiki.mozilla.org/Security/CrashSignatures
@author: Christian Holler (:decoder)
@license:
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can ... | Python | 0.000001 | @@ -963,17 +963,27 @@
():%0A
-#
+'''%0A
Return
@@ -1047,16 +1047,24 @@
d valid%0A
+ '''%0A
retu
@@ -1414,16 +1414,17 @@
@rtype
+:
long%0A
@@ -1432,24 +1432,25 @@
@return
+:
The value o
@@ -2096,16 +2096,82 @@
values%0A
+ %0A @rtype: long%0A @return: The regi... |
045a10457cd87e37ef5862de55e344db5e9228cf | Add configfile.py | configfile.py | configfile.py | Python | 0.000003 | @@ -0,0 +1,1953 @@
+# vim: set et ts=4 sw=4 fdm=marker%0A%22%22%22%0AMIT License%0A%0ACopyright (c) 2016 Jesse Hogan%0A%0APermission is hereby granted, free of charge, to any person obtaining a copy%0Aof this software and associated documentation files (the %22Software%22), to deal%0Ain the Software without restriction... | |
2275ae52e336bd2e07e32fa3a2559926734c3567 | add pyunit for PUBDEV-1480 | h2o-py/tests/testdir_jira/pyunit_NOPASS_INTERNAL_pubdev_1480_medium.py | h2o-py/tests/testdir_jira/pyunit_NOPASS_INTERNAL_pubdev_1480_medium.py | Python | 0 | @@ -0,0 +1,727 @@
+import sys, os%0Asys.path.insert(1, %22../../%22)%0Aimport h2o, tests%0A%0Adef pubdev_1480():%0A%0A if not tests.hadoop_namenode_is_accessible(): raise(EnvironmentError, %22Not running on H2O internal network. No access to HDFS.%22)%0A train = h2o.import_file(%22hdfs://mr-0xd6/datasets/kaggle/... | |
b16f6ea8a723fa064a78e014ab767be1a797e613 | Create cab.py | cab.py | cab.py | Python | 0.000006 | @@ -0,0 +1,1136 @@
+%22%22%22%0AWork with *.cab files%0A%22%22%22%0Afrom ctypes import pythonapi%0Afrom ctypes import cdll%0Afrom ctypes import cast%0Aimport ctypes as _ctypes%0A%0Alibc = cdll%5B_ctypes.util.find_library('c')%5D%0Alibcab = cdll%5B_ctypes.util.find_library('cabinet')%5D%0A%0APyMem_Malloc = pythonapi.PyM... | |
e6abd6a44de8687d88672ba80388afbe0cdb029a | 习题 1: 第一个程序 | ex1.py | ex1.py | Python | 0.997795 | @@ -0,0 +1,307 @@
+# --coding:utf8--%0Aprint(%22Hello world%22)%0Aprint(%22Hello Again%22)%0Aprint(%22I like type this.%22)%0Aprint(%22This is fun%22)%0Aprint('Yay! Printing')%0Aprint(%22I'd much rather you 'not'.%22)%0Aprint('I %22said%22 do not touch this')%0Aprint('%E5%A6%B3%E5%A5%BD%EF%BC%8C%E6%88%91%E6%98%AFPython... | |
e17adde73c146ded7ed5a1a347f104a5e7a09f62 | Add bzl macro. | tools/testing/python/py23.bzl | tools/testing/python/py23.bzl | Python | 0.000066 | @@ -0,0 +1,370 @@
+%22%22%22Macro to generate python 2 and 3 binaries.%22%22%22%0A%0Adef py23_binary(name, **kwargs):%0A %22%22%22Generates python 2 and 3 binaries. Accepts any py_binary arguments.%22%22%22%0A native.py_binary(%0A name = name + %222%22,%0A python_version = %22PY2%22,%0A **kwa... | |
596f432eb7d4b3fa5d1bf5dec33cc882546e8233 | Add a script to convert a GRLevelX colortable file to a dict data structure (and optionally boundaries for norm) for use with Matplotlib. | trunk/metpy/vis/util/gr2_to_mpl_colortable.py | trunk/metpy/vis/util/gr2_to_mpl_colortable.py | Python | 0.000006 | @@ -0,0 +1,2317 @@
+#!/usr/bin/env python%0A# This script is used to convert colortables from GRLevelX to data for a%0A# matplotlib colormap%0Aimport sys%0Afrom optparse import OptionParser%0A%0A#Set up command line options%0Aopt_parser = OptionParser(usage=%22usage: %25prog %5Boptions%5D colortablefile%22)%0Aopt_parse... | |
a041c683475f78d6101fe1741a561a6c00492007 | add pautils, to host various utility functions like loading the P2TH keys into the local or remote node over JSON-RPC. | pypeerassets/pautils.py | pypeerassets/pautils.py | Python | 0 | @@ -0,0 +1,1374 @@
+%0A'''miscellaneous utilities.'''%0A%0Adef testnet_or_mainnet(node):%0A '''check if local node is configured to testnet or mainnet'''%0A%0A q = node.getinfo()%0A%0A if q%5B%22testnet%22%5D is True:%0A return %22testnet%22%0A else:%0A return %22mainnet%22%0A%0Adef load_p2th_... | |
7012a90cd1468da95c8939a0f0c1193766595ae8 | Add event spooler module | pytest_watch/spooler.py | pytest_watch/spooler.py | Python | 0 | @@ -0,0 +1,1073 @@
+# -*- coding: utf-8%0A%0Afrom multiprocessing import Queue, Process, Event%0A%0A%0Aclass Timer(Process):%0A def __init__(self, interval, function, args=%5B%5D, kwargs=%7B%7D):%0A super(Timer, self).__init__()%0A self.interval = interval%0A self.function = function%0A s... | |
0ff9373de6e11d7040b6b289cb3239a9ee9a924d | Fix haproxy agent unit test to be runnable alone by tox | neutron/tests/unit/services/loadbalancer/drivers/haproxy/test_agent.py | neutron/tests/unit/services/loadbalancer/drivers/haproxy/test_agent.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 New Dream Network, LLC (DreamHost)
#
# 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/li... | Python | 0.000001 | @@ -1014,52 +1014,8 @@
t)%0A%0A
- cfg.CONF.register_opts(agent.OPTS)%0A%0A
@@ -1695,16 +1695,74 @@
anager')
+,%0A mock.patch.object(cfg.CONF, 'register_opts')
%0A
@@ -1827,16 +1827,20 @@
mgr_cls
+, ro
):%0A
|
e4ef868660878e1ad1749be915b88ab6fea929b5 | Add asyncio example | examples/async.py | examples/async.py | Python | 0.000001 | @@ -0,0 +1,625 @@
+%22%22%22%0Aw1thermsensor%0A~~~~~~~~~~~~~%0A%0AA Python package and CLI tool to work with w1 temperature sensors.%0A%0A:copyright: (c) 2020 by Timo Furrer %3Ctuxtimo@gmail.com%3E%0A:license: MIT, see LICENSE for more details.%0A%22%22%22%0A%0Aimport asyncio%0A%0Afrom w1thermsensor import AsyncW1Therm... | |
ef4aeb1e16245c76e7d10091b6fc8b0b289d635f | Split IP validation to a module | validateIp.py | validateIp.py | Python | 0 | @@ -0,0 +1,331 @@
+#!/usr/bin/env python%0Aimport socket%0A%0Adef parse(ip):%0A # parse and validate ip address%0A try:%0A socket.inet_pton(socket.AF_INET,ip)%0A return %22valid%22%0A except socket.error, e:%0A try:%0A socket.inet_pton(socket.AF_INET6,ip)%0A return %2... | |
d0ce887da3043106da1b875a46b6fe1bc0ce7145 | Create 0018_auto_20201109_0655.py | herders/migrations/0018_auto_20201109_0655.py | herders/migrations/0018_auto_20201109_0655.py | Python | 0.000008 | @@ -0,0 +1,579 @@
+# Generated by Django 2.2.17 on 2020-11-09 14:55%0A%0Aimport django.contrib.postgres.fields%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('herders', '0017_auto_20200808_1642'),%0A %5D%0A%0A operations = %5B%0A ... | |
f9db946f9b067495d2785d46efe447371e22eb26 | Add tex2pdf function | docstamp/pdflatex.py | docstamp/pdflatex.py | Python | 0.000001 | @@ -0,0 +1,2192 @@
+# coding=utf-8%0A# -------------------------------------------------------------------------------%0A# Author: Alexandre Manhaes Savio %3Calexsavio@gmail.com%3E%0A# Grupo de Inteligencia Computational %3Cwww.ehu.es/ccwintco%3E%0A# Universidad del Pais Vasco UPV/EHU%0A#%0A# 2015, Alexandre Manhaes Sa... | |
96a9d00ea20dee3ffd9114b4a094868ed7ae2413 | add createmask.py | createMask.py | createMask.py | Python | 0.000002 | @@ -0,0 +1,1452 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A'''%0Apython createmask.py %5Bvoc-like dir%5D%0A'''%0Aimport os, sys%0Aimport numpy as np%0Aimport cv2%0A%0Adef parsexml(xmlfile):%0A tree = ET.parse(xmlfile)%0A width = int(tree.find('size').find('width').text)%0A height = int(tree.find(... | |
8ba179518a5901a250fdc7f864f79667c319cf2a | Enhance test | utest/api/test_exposed_api.py | utest/api/test_exposed_api.py | import unittest
from os.path import join
from robot import api, model, parsing, reporting, result, running
from robot.api import parsing as api_parsing
from robot.utils.asserts import assert_equal, assert_true
class TestExposedApi(unittest.TestCase):
def test_execution_result(self):
assert_equal(api.E... | Python | 0.000001 | @@ -1938,16 +1938,32 @@
'If'
+, 'Try', 'While'
):%0A
|
45bc2562d3afd3674929e56425b597b54e74ba24 | Create Legends.py | Legends.py | Legends.py | Python | 0 | @@ -0,0 +1,315 @@
+#Draws Legends, Titles and Labels using matplotlib%0A%0Aimport matplotlib.pyplot as plt%0A%0Ax = %5B1, 2, 3%5D%0Ay = %5B5, 7, 4%5D%0Ax1 = %5B1, 2, 3%5D%0Ay1 = %5B10, 14, 12%5D%0A%0Aplt.plot(x, y, label='First Line')%0Aplt.plot(x1, y1, label='Second Line')%0Aplt.xlabel('X Axis')%0Aplt.ylabel('Y Axis')... | |
29090add692e6c32a75e123be6cd201949efd6ce | Add elasticsearch-administer | scripts/elasticsearch-administer.py | scripts/elasticsearch-administer.py | Python | 0 | @@ -0,0 +1,2496 @@
+%22%22%22%0AUtilities for administering elasticsearch%0A%22%22%22%0Afrom argparse import ArgumentParser, RawDescriptionHelpFormatter%0Afrom collections import namedtuple%0Aimport json%0Aimport sys%0A%0Afrom elasticsearch import Elasticsearch%0Afrom elasticsearch.client import ClusterClient, NodesCli... | |
eee700f46e1edee1133722ee94992abda1ad6a4c | Add GYP build for zlib | deps/zlib.gyp | deps/zlib.gyp | Python | 0 | @@ -0,0 +1,1145 @@
+%7B%0A 'target_defaults': %7B%0A 'conditions': %5B%0A %5B'OS != %22win%22', %7B%0A 'defines': %5B%0A '_LARGEFILE_SOURCE',%0A '_FILE_OFFSET_BITS=64',%0A '_GNU_SOURCE',%0A 'HAVE_SYS_TYPES_H',%0A 'HAVE_STDINT_H',%0A 'HAVE_STDDEF_H',%... | |
c46962f8055dc1c9d45a35b21afaac363ec3eb46 | add home view | simple_media_service/views/pages.py | simple_media_service/views/pages.py | Python | 0 | @@ -0,0 +1,794 @@
+#%0A# Copyright (c) Elliot Peele %3Celliot@bentlogic.net%3E%0A#%0A# This program is distributed under the terms of the MIT License as found%0A# in a file called LICENSE. If it is not present, the license%0A# is always available at http://www.opensource.org/licenses/mit-license.php.%0A#%0A# This progr... | |
597e9d6f3d5804d403e3cd58a380ea882cbd5267 | Add tracker init support | home/iot/tracker.py | home/iot/tracker.py | Python | 0 | @@ -0,0 +1,1310 @@
+import functools%0Afrom flask import abort, request%0Afrom flask_login import login_required%0Afrom flask_socketio import join_room, emit%0A%0Afrom home.core.models import get_device%0Afrom home.settings import DEBUG%0Afrom home.web.utils import api_auth_required%0Afrom home.web.web import socketio,... | |
860f6b612c39bb5b569b0fae8279134bca264e70 | Add 2017-faust/toilet | 2017-faust/toilet/toilet.py | 2017-faust/toilet/toilet.py | Python | 0.000001 | @@ -0,0 +1,1250 @@
+#!/usr/bin/env python2%0A# -*- coding: utf-8 -*-%0Aimport re%0A%0Aimport dateutil.parser%0A%0Afrom pwn import *%0A%0Acontext(arch='amd64', os='linux')%0A%0A%0Adef get_latest_shas(io):%0A io.sendline('8')%0A io.recvuntil('#########################################################################... | |
571334df8e26333f34873a3dcb84441946e6c64c | Bump version number to 0.12.2 | flask/__init__.py | flask/__init__.py | # -*- coding: utf-8 -*-
"""
flask
~~~~~
A microframework based on Werkzeug. It's extensively documented
and follows best practice patterns.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
__version__ = '0.12.2-dev'
# utilities we import from Werkzeug... | Python | 0.000153 | @@ -275,12 +275,8 @@
12.2
--dev
'%0A%0A#
|
a5188b4a172e17ac755ba4ce8d8890c7b211eb74 | Create ex11.py | learningpythonthehardway/ex11.py | learningpythonthehardway/ex11.py | Python | 0.000001 | @@ -0,0 +1,352 @@
+print %22How old are you brother ?%22%0Aage = raw_input() # will get some text ;def%0Aprint %22How tall are you ?%22%0Aheight = raw_input()%0Aprint %22do you eat enough ?%22%0Aeat = raw_input()%0A%0Aprint %22So, you're a %25r years old and %25r tall guy that says : '%25r' to the food, right ?%22 %25 ... | |
e4bc9684c10a360ad8df32b2c6bfb8f013ea4b77 | Add Composite.py | Python/Composite/Composite.py | Python/Composite/Composite.py | Python | 0.000001 | @@ -0,0 +1,1814 @@
+#! /usr/bin/python%0A# -*- coding: utf-8 -*-%0A'''%0AComposite Pattern%0AAuthor: Kei Nakata%0AData: Oct.10.2014%0A'''%0Aimport abc%0Aimport exceptions%0A%0Aclass Component(object):%0A __metaclass__ = abc.ABCMeta%0A%0A @abc.abstractmethod%0A def __init__(self, name):%0A pass%0A%0A ... | |
ac3b5be9a6f71afb402db2f293e1198bce973440 | Create the login server using Flask | flask/login.py | flask/login.py | Python | 0.000001 | @@ -0,0 +1,1052 @@
+from abc import ABCMeta, ABC, abstractmethod, abstractproperty%0Afrom flask import Flask, app%0Aimport flask%0Afrom flask_login import LoginManager%0A%0Aclass User(ABC):%0A%0A authenticated = False%0A active = False%0A anonymous = False%0A id = None%0A%0A def is_authenticated(self):%0... | |
e15f59f29907d740d0a0f8dab46d77aa833ef802 | fix "peru -v" | peru/main.py | peru/main.py | #! /usr/bin/env python3
import os
import sys
from . import runtime
from . import module
def main():
peru_file_name = os.getenv("PERU_FILE_NAME") or "peru.yaml"
if not os.path.isfile(peru_file_name):
print(peru_file_name + " not found.")
sys.exit(1)
r = runtime.Runtime()
m = module.par... | Python | 0 | @@ -343,23 +343,108 @@
-if len(sys.argv
+flags = %7B%22-v%22, %22--verbose%22%7D%0A args = %5Barg for arg in sys.argv if arg not in flags%5D%0A if len(args
) %3E
@@ -463,24 +463,20 @@
arget =
-sys.
arg
-v
+s
%5B1%5D.spli
|
0d2c04790fb6c97b37f6e0700bb0162796e3dc4c | Add unit tests for AmountTaxScale serialization | tests/web_api/test_scale_serialization.py | tests/web_api/test_scale_serialization.py | Python | 0 | @@ -0,0 +1,702 @@
+# -*- coding: utf-8 -*-%0A%0Afrom openfisca_web_api.loader.parameters import walk_node%0Afrom openfisca_core.parameters import ParameterNode, Scale%0A%0Adef test_amount_scale():%0A parameters = %5B%5D%0A metadata = %7B'location':'foo', 'version':'1', 'repository_url':'foo'%7D%0A root_node = ... | |
a94db58105db598baaea41bb5fab0479e3203664 | Fix copying of Widevine CDM binaries on official Mac builds. | third_party/widevine/cdm/widevine_cdm.gyp | third_party/widevine/cdm/widevine_cdm.gyp | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'widevine_cdm_version_h_file%': 'widevine_cdm_version.h',
'widevine_cdm_binary_files%': [],
'conditions': [
[ 'brand... | Python | 0.000002 | @@ -4250,32 +4250,180 @@
'type': 'none',%0A
+ 'conditions': %5B%0A %5B 'OS==%22mac%22', %7B%0A 'xcode_settings': %7B%0A 'COPY_PHASE_STRIP': 'NO',%0A %7D%0A %7D%5D,%0A %5D,%0A
'copies':
|
a04d5745257c16e127711fbded6899f8f226aeba | add html generator using pdoc3 | doc/py/gen.py | doc/py/gen.py | Python | 0 | @@ -0,0 +1,738 @@
+import os%0Aimport pdoc%0Aimport clingo%0Aimport clingo.ast%0Aimport re%0Actx = pdoc.Context()%0A%0Acmod = pdoc.Module(clingo, context=ctx)%0Aamod = pdoc.Module(clingo.ast, supermodule=cmod, context=ctx)%0A%0Acmod.doc%5B%22ast%22%5D = amod%0Apdoc.link_inheritance(ctx)%0A%0Adef replace(s):%0A s = s... | |
e4efaa947533e6d63eb7518306e31386ec688c73 | write testing test | bioinformatics/tests/test_frequent_words.py | bioinformatics/tests/test_frequent_words.py | Python | 0.000095 | @@ -0,0 +1,141 @@
+def test_sanity_check_pass():%0A assert True%0A%0Adef test_sanity_check_fail():%0A assert False%0A%0Adef test_sanity_check_error():%0A assert 0/0%0A
| |
aee6afe48bf4d2992c39a22d9e492377dcec527c | Add migrations | dash/orgs/migrations/0029_auto_20211025_1504.py | dash/orgs/migrations/0029_auto_20211025_1504.py | Python | 0.000001 | @@ -0,0 +1,945 @@
+# Generated by Django 3.2.6 on 2021-10-25 15:04%0A%0Aimport functools%0A%0Afrom django.db import migrations, models%0A%0Aimport dash.utils%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A (%22orgs%22, %220028_alter_org_config%22),%0A %5D%0A%0A operations = %5... | |
6b9933cce4cac3131d603880969e1d9b78b1e4f0 | Remove party_affiliation table | alembic/versions/138c92cb2218_feed.py | alembic/versions/138c92cb2218_feed.py | Python | 0.000002 | @@ -0,0 +1,1190 @@
+%22%22%22Remove PartyAffiliation%0A%0ARevision ID: 138c92cb2218%0ARevises: 3aecd12384ee%0ACreate Date: 2013-09-28 16:34:40.128374%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '138c92cb2218'%0Adown_revision = '3aecd12384ee'%0A%0Afrom alembic import op%0Aimport sqlalchemy ... | |
6f7afea4aed4dd77cd06e8dce66e9ed1e6390a00 | Add a dummy label printer server. | dummyprint.py | dummyprint.py | Python | 0 | @@ -0,0 +1,1019 @@
+#!/usr/bin/env python3%0A# It does work with Python 2.7, too.%0A%0Afrom __future__ import print_function%0Afrom __future__ import unicode_literals%0A%0Atry:%0A from SocketServer import TCPServer, BaseRequestHandler%0Aexcept ImportError: # Python 3%0A from socketserver import TCPServer, BaseReq... | |
d173374a2bb0b3336a44c204f250ee1fa928051f | Add CLI mechanics stub. | grafcli/cli.py | grafcli/cli.py | Python | 0 | @@ -0,0 +1,680 @@
+%0Afrom grafcli.config import config%0Afrom grafcli.elastic import Elastic%0Afrom grafcli.filesystem import FileSystem%0A%0AROOT_PATH = %22/%22%0APROMPT = %22%3E %22%0A%0A%0Aclass GrafCLI(object):%0A%0A def __init__(self):%0A self._elastic = Elastic()%0A self._filesystem = FileSystem... | |
590f9b896be367ded589c90ac5eacd4d3006ebc8 | Create Combinations_001.py | leetcode/077-Combinations/Combinations_001.py | leetcode/077-Combinations/Combinations_001.py | Python | 0.000004 | @@ -0,0 +1,419 @@
+class Solution:%0A # @param %7Binteger%7D n%0A # @param %7Binteger%7D k%0A # @return %7Binteger%5B%5D%5B%5D%7D%0A def combine(self, n, k):%0A if k %3C 1 or k %3E n:%0A return %5B%5D%0A if k == 1:%0A return %5B%5Bi%5D for i in range(1, n+1)%5D%0A ... | |
0f0116be7870490447bbfa794c118205e8eca120 | Add an adapter for pecan. | wsme/pecan.py | wsme/pecan.py | Python | 0 | @@ -0,0 +1,1892 @@
+import inspect%0Aimport sys%0A%0Aimport json%0A%0Aimport xml.etree.ElementTree as et%0A%0Aimport wsme%0Aimport wsme.protocols.commons%0Aimport wsme.protocols.restjson%0Aimport wsme.protocols.restxml%0A%0Apecan = sys.modules%5B'pecan'%5D%0A%0A%0Aclass JSonRenderer(object):%0A def __init__(self, pa... | |
b113689db8b845471728a336b0fae30b45333022 | Create hilightresponses.py | HexChat/hilightresponses.py | HexChat/hilightresponses.py | Python | 0.000002 | @@ -0,0 +1,1145 @@
+import hexchat%0A%0A__module_name__ = 'Hilight Responses'%0A__module_version__ = '0.0.1'%0A__module_description__ = 'Highlights messages after yours'%0A__module_author__ = 'Vlek'%0A%0A_lastresponder = %7B%7D%0A%0Adef check_for_highlight(word, word_to_eol, userdata):%0A global _lastresponder%0A ... | |
8f3f9d79d8ce1960ad225e236ca3e11c72de28e0 | Add test for dials.report on integrated data | test/command_line/test_report.py | test/command_line/test_report.py | Python | 0 | @@ -0,0 +1,591 @@
+from __future__ import absolute_import, division, print_function%0A%0Aimport os%0Aimport procrunner%0A%0A%0Adef test_report_integrated_data(dials_regression, run_in_tmpdir):%0A %22%22%22Simple test to check that dials.symmetry completes%22%22%22%0A%0A result = procrunner.run(%0A %5B%0A ... | |
74329cd397e9dc4593333591700923e0ba7453a1 | Create __init__.py (#148) | robosuite/environments/manipulation/__init__.py | robosuite/environments/manipulation/__init__.py | Python | 0.000006 | @@ -0,0 +1 @@
+%0A
| |
6167ef40df491985749102bd4ca3f3f656f71f6c | Add migrations | mainapp/migrations/0030_auto_20210125_1431.py | mainapp/migrations/0030_auto_20210125_1431.py | Python | 0.000001 | @@ -0,0 +1,567 @@
+# Generated by Django 3.1.5 on 2021-01-25 13:31%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('mainapp', '0029_auto_20201206_2026'),%0A %5D%0A%0A operations = %5B%0A migrations.AddField(%0A m... | |
f6d3c63a0131a7532a091c1cc492ef7d7c84263e | Access realm alias objects in lower-case. | zerver/management/commands/realm_alias.py | zerver/management/commands/realm_alias.py | from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import BaseCommand
from zerver.models import Realm, RealmAlias, get_realm, can_add_alias
from zerver.lib.actions import realm_aliases
import sys
cla... | Python | 0 | @@ -1420,16 +1420,24 @@
'alias'%5D
+.lower()
%0A
|
a6d958b7c29f11014ed322b9f153e8ad0c1a2cda | Add local server. | runserver.py | runserver.py | Python | 0 | @@ -0,0 +1,103 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Afrom flask_rest_service import app%0A%0Aapp.run(debug=True)%0A
| |
a00dc9b0b1779ee8218917bca4c75823081b7854 | Add migration file for new database model | InvenTree/part/migrations/0072_bomitemsubstitute.py | InvenTree/part/migrations/0072_bomitemsubstitute.py | Python | 0 | @@ -0,0 +1,931 @@
+# Generated by Django 3.2.5 on 2021-10-12 23:24%0A%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('part', '0071_alter_partparametertemplate_name'),%0A %5D%0A%0A operations = %5B%... | |
88087c9416103ae7f56749f59cdfabcd19fb14ab | Add a snippet. | python/notion_api/update_a_page_and_its_icon.py | python/notion_api/update_a_page_and_its_icon.py | Python | 0.000002 | @@ -0,0 +1,1426 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A#################################################################%0A# Install the Python requests library: pip install requests%0A# http://docs.python-requests.org/en/master/user/quickstart/%0A#####################################################... | |
a962de79938c73b5c0e0459be7b82265bde76b40 | Test case for LSPI on gridworld. | cases/gridworld/lspi.py | cases/gridworld/lspi.py | Python | 0 | @@ -0,0 +1,1655 @@
+#!/usr/bin/env python%0A%0A__author__ = %22William Dabney%22%0A%0Afrom Domains import GridWorld%0Afrom Tools import Logger%0Afrom Agents import LSPI%0Afrom Representations import Tabular%0Afrom Policies import eGreedy%0Afrom Experiments import Experiment%0A%0A%0Adef make_experiment(id=1, path=%22./R... | |
bd0530d147f1c57d89c57548355b65ba207d3116 | make access log line buffered | daphne/cli.py | daphne/cli.py | import sys
import argparse
import logging
import importlib
from .server import Server
from .access import AccessLogGenerator
logger = logging.getLogger(__name__)
class CommandLineInterface(object):
"""
Acts as the main CLI entry point for running the server.
"""
description = "Django HTTP/WebSocket... | Python | 0 | @@ -3836,16 +3836,19 @@
log, %22a%22
+, 1
)%0A
|
b514cf783d53a5c713911729422239c9b0f0ff99 | Add automatic leak detection python script in examples | client/python/examples/edleak_autodetect.py | client/python/examples/edleak_autodetect.py | Python | 0 | @@ -0,0 +1,1556 @@
+import sys%0Aimport rpc.ws%0Aimport edleak.api%0Aimport edleak.slice_runner%0A%0Adef usage():%0A print('autodetect %5Bperiod%5D %5Bduration%5D')%0A%0Adef print_leaker(leaker):%0A print('-------------------------------')%0A print('class : ' + leaker%5B'leak_factor'%5D%5B'class'%5D)%0A pri... | |
04da8d531267972554c6300c24a5a7b2c7def59d | add basic unit testing for appliance instances (incomplete) | tests/test_appliance_instance.py | tests/test_appliance_instance.py | Python | 0.000012 | @@ -0,0 +1,769 @@
+import sys%0Asys.path.append('..')%0Aimport disaggregator as da%0Aimport unittest%0Aimport pandas as pd%0Aimport numpy as np%0A%0Aclass ApplianceInstanceTestCase(unittest.TestCase):%0A%0A def setUp(self):%0A indices = %5Bpd.date_range('1/1/2013', periods=96, freq='15T'),%0A ... | |
879744e19cab5cc7357912ba670d200adfd58be6 | add aur-update | bumblebee_status/modules/contrib/aur-update.py | bumblebee_status/modules/contrib/aur-update.py | Python | 0.000001 | @@ -0,0 +1,1639 @@
+%22%22%22Check updates for AUR.%0A%0ARequires the following packages:%0A * yay (used as default)%0A%0ANote - You can replace yay by changing the %22yay -Qum%22%0Acommand for your preferred AUR helper. Few examples:%0A%0Aparu -Qum%0Apikaur -Qua%0Arua upgrade --printonly%0Atrizen -Su --aur --quiet%... | |
4175f27a03be52baa8b4245df96a03e6bbd22310 | Add test for pygame sound play hook | modulation_test.py | modulation_test.py | Python | 0 | @@ -0,0 +1,379 @@
+import pygame%0Aimport random%0Afrom demodulate.cfg import *%0Afrom gen_tone import *%0A%0Aif __name__ == %22__main__%22:%0A%09pygame.mixer.pre_init(frequency = int(SAMPLE_FREQ), channels = 1)%0A%09pygame.mixer.init()%0A%09WPM = random.uniform(2,20)%0A%09pattern = %5B1,0,1,1,1,0,0,0,0,0,0,0%5D # mors... | |
cfeab0e8f704a4681e1ec887b3ce116839557af9 | update tests to changes in graph_lasso | sklearn/covariance/tests/test_graph_lasso.py | sklearn/covariance/tests/test_graph_lasso.py | """ Test the graph_lasso module.
"""
import sys
from StringIO import StringIO
import numpy as np
from scipy import linalg
from sklearn.covariance import graph_lasso, GraphLasso, GraphLassoCV
from sklearn.datasets.samples_generator import make_sparse_spd_matrix
from sklearn.utils import check_random_state
def test_g... | Python | 0 | @@ -185,16 +185,52 @@
hLassoCV
+, %5C%0A empirical_covariance
%0Afrom sk
@@ -728,16 +728,54 @@
samples)
+%0A emp_cov = empirical_covariance(X)
%0A%0A fo
@@ -897,17 +897,23 @@
h_lasso(
-X
+emp_cov
, alpha=
|
dd9893eec00c16f55b77944509bafe4864319b72 | create main function | JobManager.py | JobManager.py | Python | 0.004115 | @@ -0,0 +1,680 @@
+%0Aimport filelib.parser.ma%0Aimport filelib.parser.mb%0Aimport os.path%0Aimport sys%0A%0Aif __name__ == %22__main__%22:%0A addFilePath = %22/root/test_maya_2015.mb%22%0A%0A if(len(sys.argv) %3E 1):%0A addFilePath = sys.argv%5B1%5D%0A%0A%0A (dir,jobExt) = os.path.splitext(addFilePath)... | |
c65731de77f88380f2c816fa9667d153140bfbe1 | Add LDA script | lda/lda_analysis.py | lda/lda_analysis.py | Python | 0.000001 | @@ -0,0 +1,2034 @@
+import sys%0A%0Afrom sklearn.lda import LDA%0Aimport matplotlib.pyplot as plt%0Aimport numpy as np%0A%0Adef read_variants(flname):%0A%09fl = open(flname)%0A%09markers = %5B%5D%0A%09individuals = %5B%5D%0A%09population_ids = %5B%5D%0A%09population = -1%0A%09for ln in fl:%0A%09%09if %22Marker%22 in ln... | |
cf97c95ab9dcb3b1dba6608639471375a1cbef42 | Create afUdimLayout.py | scripts/afUdimLayout.py | scripts/afUdimLayout.py | Python | 0.000001 | @@ -0,0 +1,775 @@
+import pymel.core as pm%0Aimport maya.mel as mel%0A%0AallSets = pm.ls(sl=1,type=%22objectSet%22)%0A%0Afor i in range(0,len(allSets)):%0A if i%3C10:%0A pm.select(allSets%5Bi%5D,r=1,ne=1)%0A pm.select(hierarchy=1)%0A mel.eval(%22ConvertSelectionToUVs;%22)%0A pm.polyEditUV... | |
49f557228a6c826598c48a08f6a0de4ee176d888 | add python script to send ogg audio stream over LCM messages | software/tools/tools/scripts/oggStreamLCM.py | software/tools/tools/scripts/oggStreamLCM.py | Python | 0.000001 | @@ -0,0 +1,2420 @@
+import bot_core%0Aimport lcm%0Aimport urllib2%0Aimport time%0Aimport sys%0Aimport os%0Aimport select%0Aimport subprocess%0Aimport threading%0A%0A%0A# VLC command:%0A# cvlc %3Cinput%3E --sout '#transcode%7Bacodec=vorb,ab=10,channels=1,samplerate=8000%7D:std%7Baccess=http,mux=ogg,url=localhost:8080%7D... | |
76be22f3d1aa86616ecd06a326344f24ff03adbe | Add function to generate uniform addresses | DataGeneration/GenerateUniformAddresses.py | DataGeneration/GenerateUniformAddresses.py | Python | 0.018119 | @@ -0,0 +1,2239 @@
+# The purpose of this script is to generate a uniformly distributed series of%0A# lat/long coordinates given max/min latitude, max/min longitude, latitude%0A# resolution, and longitude resolution, where resolution is the desired number%0A# of degrees between output coordinates%0A# Outputs a panda... | |
05f87be4c85036c69abc9404acb824c58d71f101 | Add border operation... Damn that was easy | slice_ops.py | slice_ops.py | Python | 0 | @@ -0,0 +1,407 @@
+import slicer%0Aimport shapely.ops%0Aimport shapely.geometry%0A%0Adef border(sli, amount):%0A cuts = %5Bcut.polygon(True) for cut in sli.cuts%5D%0A cut_outline = shapely.ops.cascaded_union(cuts) %5C%0A .buffer(amount / 2)%0A shape_outline = sli.poly.boundary.buffe... | |
a3089dd3d9c31d0d705fe54858fdc0ebee76f488 | write a Python client for Sift Science's REST API | server/sift_client.py | server/sift_client.py | Python | 0 | @@ -0,0 +1,2121 @@
+%22%22%22Python client for Sift Science's REST API%0A(https://siftscience.com/docs/rest-api).%0A%22%22%22%0A%0Aimport json%0Aimport logging%0Aimport traceback%0A%0Aimport requests%0A%0A%0AAPI_URL = 'https://api.siftscience.com/v202/events'%0Asift_logger = logging.getLogger('sift_client')%0A%0A%0Acla... | |
cda1efa55242641accf78162493c3ebb3582399e | Create AM_example.py | Effects/Amplitude_Modulation/AM_example.py | Effects/Amplitude_Modulation/AM_example.py | Python | 0.000005 | @@ -0,0 +1,1911 @@
+# Play a wave file with amplitude modulation. %0A# Assumes wave file is mono.%0A# This implementation reads and plays a one frame (sample) at a time (no blocking)%0A%22%22%22%0ARead a signal from a wave file, do amplitude modulation, play to output%0AOriginal: pyrecplay_modulation.py by Gerald Schul... | |
2387d8f269cbe1943db1b1e6304603ccb6901e43 | Add flashcards for powers of two estimation | flashcards.py | flashcards.py | Python | 0 | @@ -0,0 +1,333 @@
+import random%0Aimport time%0A%0ADELAY = 10%0A%0Awhile 1:%0A time.sleep(DELAY)%0A useful_powers_of_2 = %7B7, 8, 10, 16, 20, 30, 32, 40%7D%0A random_power_of_2 = random.sample(useful_powers_of_2, 1)%5B0%5D%0A print '%5CnWhat%5C's the largest %25s bit integer?' %25 random_power_of_2%0A%0A time.sle... | |
795be78be4642426e45c1f0f6017a2744129b622 | Make session persistent between searches fix download URL construction error | flexget/plugins/search_ptn.py | flexget/plugins/search_ptn.py | from __future__ import unicode_literals, division, absolute_import
import logging
import re
from requests.utils import dict_from_cookiejar, cookiejar_from_dict
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.utils import requests
from flexget.utils.imdb import e... | Python | 0 | @@ -90,77 +90,8 @@
re%0A%0A
-from requests.utils import dict_from_cookiejar, cookiejar_from_dict%0A%0A
from
@@ -113,16 +113,16 @@
plugin%0A
+
from fle
@@ -392,22 +392,36 @@
')%0A%0A
-cookies = None
+session = requests.Session()
%0A%0Aca
@@ -1268,201 +1268,30 @@
-global cookies%0A login_sess = reques... |
f8b9e697f4d49f35dda322817ac8ac63d96b6732 | Add failing wait tests | nclxd/tests/test_container_utils.py | nclxd/tests/test_container_utils.py | # Copyright 2015 Canonical Ltd
# 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/licenses/LICENSE-2.0
#
# Unless required by... | Python | 0.000005 | @@ -621,8 +621,991 @@
icense.%0A
+%0A%0Aimport mock%0Afrom nova import exception%0Afrom nova import test%0A%0Afrom nclxd.nova.virt.lxd import container_utils%0Afrom nclxd import tests%0A%0A%0Aclass LXDTestContainerUtils(test.NoDBTestCase):%0A%0A def setUp(self):%0A super(LXDTestContainerUtils, self).setUp()%... |
04979d5536a9787cac0024dd6e767f0baec280fd | Update __init__.py | tendrl/node_agent/objects/definition/__init__.py | tendrl/node_agent/objects/definition/__init__.py | import importlib
import namespaces as ns
import yaml
from tendrl.commons import objects
from tendrl.commons import etcdobj
from tendrl.node_agent.objects.definition import master
# Definitions need there own special init and have to be present in the NS
# before anything else, Hence subclassing BaseObject
class ... | Python | 0.000072 | @@ -516,16 +516,21 @@
= master
+.read
%0A
@@ -3325,16 +3325,17 @@
cls = Definition
+%0A
|
51ee19f41e6fc48d4791bde97c5d28d55d76cdf4 | Add brute force inplementation | solvers/BruteForce.py | solvers/BruteForce.py | Python | 0.999725 | @@ -0,0 +1,981 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0A%0Afrom itertools import permutations%0A%0Afrom base_solver import BaseSolver%0A%0Aclass BruteForceSolver(BaseSolver):%0A def run_search(self):%0A # get list of mid nodes names%0A mid_nodes = %5B%5D%0A for node in self.task.mid_nodes... | |
46496d8761ae94a349ed3b592ec7ee7e0c7e1a15 | Remove unused import; add missing import | gitc_utils.py | gitc_utils.py | #
# Copyright (C) 2015 The Android Open Source Project
#
# 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 la... | Python | 0.000007 | @@ -656,13 +656,10 @@
rt s
-hutil
+ys
%0A%0Aim
|
4dfc0c49cec86f3c03b90fa66e1fc9de2ac665e6 | Add migration file (fix fields) | samples/migrations/0012_auto_20170512_1138.py | samples/migrations/0012_auto_20170512_1138.py | Python | 0 | @@ -0,0 +1,716 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11 on 2017-05-12 14:38%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('samples', '0011_fluvaccine_date_applied'),%0A %5D%... | |
947551083798e3125cf0782df44cc18728c6bca4 | test messages | src/eduid_webapp/security/tests/test_msgs.py | src/eduid_webapp/security/tests/test_msgs.py | Python | 0.000004 | @@ -0,0 +1,2136 @@
+# -*- coding: utf-8 -*-%0A%0Aimport unittest%0A%0Afrom eduid_webapp.security.helpers import SecurityMsg%0A%0A%0Aclass MessagesTests(unittest.TestCase):%0A%0A def test_messages(self):%0A %22%22%22%22%22%22%0A self.assertEqual(str(SecurityMsg.out_of_sync.value), 'user-out-of-sync')%0A... | |
fcfb84838c7bb111fb9710f4984767b2233caed3 | test commit | test.py | test.py | Python | 0.000002 | @@ -0,0 +1,62 @@
+print(%22Content-Type: text/plain%22)%0Aprint(%22%22)%0Aprint(%22Fuck you%22)%0A
| |
f4f3429d157988d4823f20d5155b951f8471fb1b | Fix test app | test.py | test.py |
from gunicorn.httpserver import WSGIServer
def app(environ, start_response):
"""Simplest possible application object"""
data = 'Hello, World!\n'
status = '200 OK'
response_headers = [
('Content-type','text/plain'),
('Content-Length', len(data))
]
start_response(status, respo... | Python | 0.000013 | @@ -1,51 +1,4 @@
-%0Afrom gunicorn.httpserver import WSGIServer%0A%0A%0A%0A
%0Adef
@@ -302,107 +302,4 @@
a%5D%0A%0A
-if __name__ == '__main__':%0A server = WSGIServer((%22127.0.0.1%22, 8000), 1, simple_app)%0A server.run()
|
bc0aa69adc5b1e290941c221ddd498d3fb92244e | Add simple recipe tagger experiment | test.py | test.py | Python | 0.000039 | @@ -0,0 +1,2428 @@
+import nltk%0Afrom nltk.classify import MaxentClassifier%0A%0A# Set up our training material in a nice dictionary.%0Atraining = %7B%0A 'ingredients': %5B%0A 'Pastry for 9-inch tart pan',%0A 'Apple cider vinegar',%0A '3 eggs',%0A '1/4 cup sugar',%0A %5D,%0A 'steps... | |
5d9200298ab660bee79d7958f8e155023893be08 | Change author | l10n_cr_account_banking_cr_bcr/__openerp__.py | l10n_cr_account_banking_cr_bcr/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | Python | 0.000003 | @@ -1124,29 +1124,24 @@
hor': 'C
-LEARCORP S.A.
+learCorp
',%0A '
@@ -1275,16 +1275,19 @@
ng_ccorp
+_dg
',%0A
|
ab458e10742897c692e3d4e4066ed193e141e258 | add filterfuncs module | filterfuncs.py | filterfuncs.py | Python | 0.000001 | @@ -0,0 +1,617 @@
+from tools import pipeline_helpers%0Aimport pandas as pd%0A%0Adef run1(infile, features_label, output_label):%0A %22%22%22%0A Handle variant data by only keeping rows where 10-90%25 of samples have%0A variants.%0A%0A For CNV data, don't do any filtering.%0A%0A Otherwise, simply remove ... | |
b9d5e015b291f27becc682f05a12ec5c6a0cf467 | Implement module to create new pads on collabedit.com. | gygax/modules/pad.py | gygax/modules/pad.py | Python | 0 | @@ -0,0 +1,1186 @@
+# -*- coding: utf-8 -*-%0A%0A%22%22%22%0A:mod:%60gygax.modules.pad%60 --- Module for creating pads on collabedit.com%0A=======================================================================%0A%22%22%22%0A%0Afrom http import client%0A%0Afrom gygax.modules import admin%0A%0Adef pad(bot, sender, text)... | |
7cc86a96427cc35824960c01d84fbe8d45364670 | Add admin page for User | helios_auth/admin.py | helios_auth/admin.py | Python | 0.000143 | @@ -0,0 +1,170 @@
+from django.contrib import admin%0Afrom helios.models import User%0A%0Aclass UserAdmin(admin.ModelAdmin):%09%0A exclude = ('info', 'token')%0A%0Aadmin.site.register(User, UserAdmin)
| |
e99700ff985e9821faf390ca6070a0c879eafc20 | Add perkeyavg python example | src/python/PerKeyAvg.py | src/python/PerKeyAvg.py | Python | 0.000001 | @@ -0,0 +1,789 @@
+%22%22%22%0A%3E%3E%3E from pyspark.context import SparkContext%0A%3E%3E%3E sc = SparkContext('local', 'test')%0A%3E%3E%3E b = sc.parallelize(%5B(%22coffee%22, 1), (%22pandas%22, 2), (%22coffee%22, 3), (%22very%22, 4)%5D)%0A%3E%3E%3E perKeyAvg(b)%0A%0A%22%22%22%0A%0Aimport sys%0A%0Afrom pyspark import... | |
a640bf45c4fb8829888f664e48058d6647473449 | Fix migrations | lowfat/migrations/0113_merge_20171103_0948.py | lowfat/migrations/0113_merge_20171103_0948.py | Python | 0.000006 | @@ -0,0 +1,336 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.5 on 2017-11-03 09:48%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('lowfat', '0112_auto_20171031_1133'),%0A ('lowfat', '... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.