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 |
|---|---|---|---|---|---|---|---|
90a30ae1b3165c03f6de5458c92f8ecb9d3f948a | Add homework min_three | domaci-zadaci/05/test_min_three.py | domaci-zadaci/05/test_min_three.py | Python | 0.00046 | @@ -0,0 +1,1030 @@
+from solutions import min_three%0A%0Aimport unittest%0Aimport random%0A%0Aclass TestMinThree(unittest.TestCase):%0A def test_1000_cases(self):%0A for _ in range(1000):%0A first = (random.random() - 0.5) * 2000%0A second = (random.random() - 0.5) * 2000%0A t... | |
2d4c59cef7c2db0c3e8c07ef9c749b8b3a5d3998 | Remove stray todo. | pakit_tests.py | pakit_tests.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Automated bot for testing recipes.
"""
from __future__ import absolute_import, print_function
import argparse
from argparse import RawDescriptionHelpFormatter as RawDescriptionHelp
import glob
import mmap
import os
import re
import sys
__version__ = '0.1.0'
TEMPLATE = ... | Python | 0 | @@ -1112,48 +1112,8 @@
_d)%0A
- # TODO: Pass in folder via command.%0A
|
aad51679cc2e4e719ed12e3983b54dcf15a2c06f | Update slack.py | graphite_beacon/handlers/slack.py | graphite_beacon/handlers/slack.py | import json
from tornado import gen, httpclient as hc
from graphite_beacon.handlers import AbstractHandler, LOGGER
from graphite_beacon.template import TEMPLATES
class SlackHandler(AbstractHandler):
name = 'slack'
# Default options
defaults = {
'webhook': None,
'channel': None,
... | Python | 0 | @@ -730,19 +730,26 @@
rtswith(
+(
'#'
+, '@')
):%0A
|
34908071bd11470806a84d9f76c630fd3fcc2d4b | test file :-) | tests/gsim/abrahamson_silva_2008_test.py | tests/gsim/abrahamson_silva_2008_test.py | Python | 0 | @@ -0,0 +1,1665 @@
+# nhlib: A New Hazard Library%0A# Copyright (C) 2012 GEM Foundation%0A#%0A# This program is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as%0A# published by the Free Software Foundation, either version 3 of the%0A# License, or (... | |
9fc373bbfa606aeb23c237df9c8d9143e14b60a1 | structure of preprocessing module for lea to fill in | code/python/seizures/preprocessing/preprocessing.py | code/python/seizures/preprocessing/preprocessing.py | Python | 0 | @@ -0,0 +1,537 @@
+import scipy.signal%0A%0Adef preprocess_multichannel_data(matrix):%0A n_channel,m= matrix.shape%0A for i in range(n_channel):%0A preprocess_single_channel(matrix%5Bi,:%5D)%0A%0Adef preprocess_single_channel(x):%0A x = remove_elec_noise(x)%0A x = hp_filter(x)%0A x = remove_dc(x)%... | |
5de3f1294961621b4167778096d04fbee581ad78 | Fix error: iterate over custom_translations.values(). | app/recaptcha/client/captcha.py | app/recaptcha/client/captcha.py | # This file is originally from recaptcha-client 1.0.5 (obtained from pypi),
# now modified to support custom translations.
import urllib
import urllib2
import simplejson
API_SSL_SERVER = 'https://api-secure.recaptcha.net'
API_SERVER = 'http://api.recaptcha.net'
VERIFY_SERVER = 'api-verify.recaptcha.net'
class Recap... | Python | 0.00003 | @@ -1207,11 +1207,8 @@
for
- k,
v i
@@ -1228,16 +1228,25 @@
slations
+.values()
):%0A
|
42c82bc865d69b904ec688aa152caf3a247df1c6 | Create frontdoor.py | home/pi/PirFrontDoor/frontdoor.py | home/pi/PirFrontDoor/frontdoor.py | Python | 0.000024 | @@ -0,0 +1,649 @@
+#!/usr/bin/python%0A%0Aimport RPi.GPIO as GPIO%0Aimport time%0Aimport requests%0A%0AGPIO.setmode(GPIO.BCM)%0A%0APIR_PIN = 22%0A%0AGPIO.setup(PIR_PIN, GPIO.IN)%0A%0Adef MOTION(PIR_PIN):%0A print %22Motion Detected!%22%0A payload = %7B 'value1' : 'Someone at Front Door'%7D%0A r = r... | |
1d7451fd6eca8a68832b676ef0a696e8de801533 | Update services_and_index_sync.py | tendrl/node_agent/node_sync/services_and_index_sync.py | tendrl/node_agent/node_sync/services_and_index_sync.py | import json
import etcd
from tendrl.commons.event import Event
from tendrl.commons.message import ExceptionMessage
from tendrl.commons.message import Message
from tendrl.commons.utils import etcd_utils
# TODO(darshan) this has to be moved to Definition file
TENDRL_SERVICES = [
"tendrl-node-agent",
"etcd",
... | Python | 0.000001 | @@ -1218,32 +1218,512 @@
s.save()%0A
+ %0A # Try to claim orphan %22provisioner_%25integration_id%22 tag%0A _cluster = NS.tendrl.objects.Cluster(integration_id=NS.tendrl_context.integration_id).load()%0A try:%0A if _cluster.is_managed == %22yes%22:%0A _tag =... |
bcb89187a398000d80c7c0b0ac5152e76edd2666 | Remove TRT 4.0 restrictions on int32 test. | tensorflow/python/compiler/tensorrt/test/int32_test.py | tensorflow/python/compiler/tensorrt/test/int32_test.py | # Copyright 2018 The TensorFlow Authors. 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 applica... | Python | 0 | @@ -2868,303 +2868,8 @@
%5B%5D%0A%0A
- def ShouldRunTest(self, run_params):%0A %22%22%22Whether to run the test.%22%22%22%0A # TODO(aaroey): Trt 4.0 forbids conversion for tensors with rank %3C3 in int8%0A # mode, which is a bug. Re-enable this when trt library is fixed.%0A return not trt_test.IsQuantizat... |
f94f1f698c8e9473b7c96ec7b1244e84fc4ebe5d | update unittest for MonoMixer | test/src/unittest/standard/test_monomixer_streaming.py | test/src/unittest/standard/test_monomixer_streaming.py | #!/usr/bin/env python
# Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation (FSF), e... | Python | 0 | @@ -2992,13 +2992,167 @@
pty.
-wav')
+ogg')%0A # NOTE: AudioLoader will through exception on %22empty.wav%22 complaining that %0A # it cannot read stream info, using %22empty.ogg%22 therefore...
%0A
@@ -3424,16 +3424,43 @@
%3E%3E None%0A
+ loader.md5 %3E%3E None%0A
|
1307070cfe27ca605bfcc279644b735ee941f627 | Add work for ex21.py. | lpthw/ex31.py | lpthw/ex31.py | Python | 0 | @@ -0,0 +1,1048 @@
+print %22You enter a dark room with two doors. Do you go through door #1 or #2?%22%0A%0Adoor = raw_input(%22%3E %22)%0A%0Aif door == %221%22:%0A print %22Ther's a giant bear here eating a cheese cake. What do you do?%22%0A print %221. Take the cake.%22%0A print %222. Scream at the bear.%22%... | |
d3c6c91bc4b6214053b9a1d1d2291a402c164b86 | add file | GridPixelPlot.py | GridPixelPlot.py | Python | 0.000001 | @@ -0,0 +1,2300 @@
+import kplr%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0A%0Aqua = 5%0A%0Aclient = kplr.API()%0A%0A# Find the target KOI.%0Akoi = client.koi(282.02)%0A%0AoriginStar = koi.star%0A%0A# Find potential targets by Kepler magnitude%0AkoisOver = client.kois(where=%22koi_kepmag between %25f and %... | |
8515155d9d0df940eea758121124995320fce6bb | add experimental C/clang plugin | languages/c.py | languages/c.py | Python | 0 | @@ -0,0 +1,713 @@
+import os%0A%0Afrom lint.linter import Linter%0Afrom lint.util import find%0A%0Aclass C(Linter):%0A language = 'c'%0A cmd = ('clang', '-xc', '-fsyntax-only', '-std=c99', '-Werror',%0A '-pedantic')%0A regex = (%0A r'%5E%3Cstdin%3E:(?P%3Cline%3E%5Cd+):(?P%3Ccol%3E%5Cd+):'%0A ... | |
0026beea95ec26b8763feae270e79872f86de8a5 | Add run_sample_tests for executing sample tests in Travis | stress_test/sample_test_confs/run_sample_tests.py | stress_test/sample_test_confs/run_sample_tests.py | Python | 0 | @@ -0,0 +1,492 @@
+#! /usr/bin/env python3.4%0A%0A# Copyright (c) 2015 Intracom S.A. Telecom Solutions. All rights reserved.%0A#%0A# This program and the accompanying materials are made available under the%0A# terms of the Eclipse Public License v1.0 which accompanies this distribution,%0A# and is available at http://w... | |
352b17d8139fb0d269e4c17c01fe8ee488961c3a | Create HR_miniMaxSum.py | HR_miniMaxSum.py | HR_miniMaxSum.py | Python | 0.000003 | @@ -0,0 +1,458 @@
+#!/bin/python3%0A%0Aimport math%0Aimport os%0Aimport random%0Aimport re%0Aimport sys%0A%0A%0A# Complete the miniMaxSum function below.%0Adef miniMaxSum(arr):%0A maxx = max(arr)%0A minn = min(arr)%0A %0A mini = arr.copy()%0A mini.remove(maxx)%0A maxi = arr.copy()%0A maxi.remove(mi... | |
b8fe92674773c7470c3b47899a8832bbb94771b4 | Add path module | lib/oelite/path.py | lib/oelite/path.py | Python | 0 | @@ -0,0 +1,647 @@
+import os%0A%0ATOPDIR = os.getcwd()%0A%0A%0Adef init(topdir):%0A global TOPDIR%0A TOPDIR = topdir%0A%0A%0Adef relpath(path):%0A %22%22%22Return a relative version of paths compared to TOPDIR.%22%22%22%0A global TOPDIR%0A if path.startswith(TOPDIR):%0A return path%5Blen(TOPDIR):%... | |
8ce2da2ed2e445480ee2e10483a5fae1c7c677a0 | Include self contained method for output to a view | lib/output_view.py | lib/output_view.py | Python | 0 | @@ -0,0 +1,2185 @@
+import sublime%0Aimport sublime_plugin%0A%0A###-----------------------------------------------------------------------------%0A%0Adef output_to_view(window,%0A title,%0A content,%0A reuse=True,%0A syntax=None,%0A ... | |
0d35b502515a9775166e775c3462ca9300fe4517 | add examples | examples/helpers.py | examples/helpers.py | Python | 0 | @@ -0,0 +1,701 @@
+# -*- coding: utf-8 -*-%0A#%0Afrom dolfin import as_backend_type%0Aimport matplotlib.pyplot as plt%0Aimport scipy.linalg%0A%0A%0Adef show_matrix(A):%0A A = as_backend_type(A)%0A A_matrix = A.sparray()%0A%0A # colormap%0A cmap = plt.cm.gray_r%0A A_dense = A_matrix.todense()%0A # A_r ... | |
e333bc7b23a69a39392899a1d1c8e0bdf3523c3f | remove unused import [ci skip] | corehq/apps/app_manager/management/commands/build_apps.py | corehq/apps/app_manager/management/commands/build_apps.py | import contextlib
from functools import wraps
import json
from django.core.management.base import BaseCommand
from lxml import etree
import os
from corehq.apps.app_manager.models import Application, RemoteApp
_parser = etree.XMLParser(remove_blank_text=True)
def normalize_xml(xml):
xml = etree.fromstring(xml, pars... | Python | 0 | @@ -15,36 +15,8 @@
lib%0A
-from functools import wraps%0A
impo
|
f4bf1c83f55013051037b4380f1b579375bad3d7 | Add test for ContextAwareForm | backend/tests/api/test_forms.py | backend/tests/api/test_forms.py | Python | 0 | @@ -0,0 +1,435 @@
+import pytest%0A%0Afrom api.forms import ContextAwareForm%0A%0Afrom users.models import User%0A%0A%0Adef test_cannot_use_form_context_if_its_not_passed():%0A class TestModelForm(ContextAwareForm):%0A class Meta:%0A model = User%0A fields = ('id',)%0A%0A form = TestM... | |
3d40378e0e42f62615199daf97a48f24d5b9eb12 | add basic test for LIS | test_lis.py | test_lis.py | Python | 0.000001 | @@ -0,0 +1,360 @@
+import unittest%0Aimport lis%0A%0Aclass TestLis(unittest.TestCase):%0A def test_basic(self):%0A l = lis.Lis()%0A answer = %5B%5B0, 4, 6, 9, 13, 15%5D, %5B0, 2, 6, 9, 13, 15%5D, %5B0, 4, 6, 9, 11, 15%5D, %5B0, 2, 6, 9, 11, 15%5D%5D%0A self.assertEquals(answer, l.lis(%5B0, 8, 4,... | |
71675f81214ea510c377abf23fe2a11dfb113717 | create module | pyAhocorasick/pyAhocorasick.py | pyAhocorasick/pyAhocorasick.py | Python | 0.000001 | @@ -0,0 +1,77 @@
+#-*- encoding=utf-8 -*- %0A'''%0ACreated on Mar 15, 2014%0A%0A@author: tonyzhang%0A'''%0A
| |
963866e795df42121f972ee2170ddeb890f7e5b7 | Create pytest test file | python-practice/test_arrays.py | python-practice/test_arrays.py | Python | 0.000001 | @@ -0,0 +1,1319 @@
+import arrays%0A%0A# Reverse an array in place%0Adef test_reverse_array():%0A input = %5B1, 2, 3%5D%0A%0A assert arrays.reverse_array(input) == %5B3, 2, 1%5D%0A%0A%0A# Search a sorted list%0Adef test_binary_search_no_list():%0A input_array = %5B%5D%0A target = 1%0A%0A assert arrays.bi... | |
4932483b10876eddab39477063a9b8546e5e0f33 | Create a.py | a.py | a.py | Python | 0.000489 | @@ -0,0 +1,2 @@
+a%0A
| |
50e24b0445f259d975e5dd78dd34a8e760e4ed88 | Create SQLite database and table and insert data from CSV file | DB.py | DB.py | Python | 0 | @@ -0,0 +1,1113 @@
+# Create a database%0A%0Aimport sqlite3%0Aimport csv%0Afrom datetime import datetime%0Aimport sys %0Areload(sys) %0Asys.setdefaultencoding('utf8')%0A%0Aclass createDB():%0A%0A def readCSV(self, filename):%0A conn = sqlite3.connect('CIUK.db')%0A print 'DB Creation Successful!'%0A ... | |
5a926913d3da29e8911fbea03fe57be020525e03 | Update to v0.6 of liffylights | homeassistant/components/light/lifx.py | homeassistant/components/light/lifx.py |
"""
homeassistant.components.light.lifx
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LIFX platform that implements lights
Configuration:
light:
# platform name
platform: lifx
# optional server address
# only needed if using more than one network interface
# (omit if you are unsure)
server: 192.168.1.3
# optiona... | Python | 0 | @@ -745,17 +745,17 @@
ghts==0.
-5
+6
'%5D%0ADEPEN
|
874c01374397014e7c99afd67f5680ed32f1c5c6 | Build and revision number script | bn.py | bn.py | Python | 0 | @@ -0,0 +1,242 @@
+import sys%0Afrom time import gmtime%0Ayear, mon, mday, hour, min, sec, wday, yday, isdst = gmtime()%0Abld = ((year - 2000) * 12 + mon - 1) * 100 + mday%0Arev = hour * 100 + min%0Aprint 'Your build and revision number for today is %25d.%25d.' %25 (bld, rev)%0A
| |
480b0bd80f65646da52824403ade92880af1af2e | Add circle ci settings | project/circleci_settings.py | project/circleci_settings.py | Python | 0.000001 | @@ -0,0 +1,366 @@
+# -*- coding: utf-8 -*-%0A%0ADEBUG = True%0A%0ALOCAL_DATABASES = %7B%0A 'default': %7B%0A 'ENGINE': 'django.db.backends.postgresql',%0A 'NAME': 'circle_test',%0A 'USER': 'circleci',%0A 'PASSWORD': '',%0A 'HOST': 'localhost',%0A 'PORT': '5432',%0A %7D%0A... | |
339798bbed673253358866bf083e7d974f79956c | Make sure proper_count is populated by metainfo_series | flexget/plugins/metainfo/series.py | flexget/plugins/metainfo/series.py | import logging
from string import capwords
from flexget.plugin import priority, register_plugin
from flexget.utils.titles import SeriesParser
from flexget.utils.titles.parser import ParseWarning
import re
log = logging.getLogger('metanfo_series')
class MetainfoSeries(object):
"""
Check if entry appears to be... | Python | 0.000017 | @@ -1705,16 +1705,72 @@
.proper%0A
+ entry%5B'proper_count'%5D = parser.proper_count%0A
|
780e4eb03420d75c18d0b21b5e616f2952aeda41 | Test sending headers with end stream. | test/test_basic_logic.py | test/test_basic_logic.py | # -*- coding: utf-8 -*-
"""
test_basic_logic
~~~~~~~~~~~~~~~~
Test the basic logic of the h2 state machines.
"""
import h2.connection
from hyperframe import frame
class TestBasicConnection(object):
"""
Basic connection tests.
"""
example_request_headers = [
(':authority', 'example.com'),
... | Python | 0 | @@ -1092,8 +1092,310 @@
is None%0A
+%0A def test_send_headers_end_stream(self):%0A c = h2.connection.H2Connection()%0A frames = c.send_headers_on_stream(%0A 1, self.example_request_headers, end_stream=True%0A )%0A assert len(frames) == 1%0A assert frames%5B-1%5D.flags =... |
8adac46cd59c562ec494508ad735843253adc1f2 | add frequencies benchmark | bench/test_frequencies.py | bench/test_frequencies.py | Python | 0.000001 | @@ -0,0 +1,112 @@
+from toolz import frequencies, identity%0A%0Adata = range(1000)*1000%0A%0Adef test_frequencies():%0A frequencies(data)%0A
| |
892740ce17c2906de996089f07f005c7812270ef | add init back | src/__init__.py | src/__init__.py | Python | 0.000001 | @@ -0,0 +1,56 @@
+%22%22%22 Source Files, and a location for Global Imports %22%22%22%0A
| |
94acf181f063808c2b6444dbc15ea40ee17bdee3 | print structure | bin/print_h5_structure.py | bin/print_h5_structure.py | Python | 0.000004 | @@ -0,0 +1,726 @@
+import sys%0Afile_name = sys.argv%5B1%5D%0A# python3 print_data_structure.py filename%0Aimport glob%0Aimport os%0Aimport numpy as n%0A%0Aimport h5py # HDF5 support%0A%0Af0 = h5py.File(file_name, %22r%22)%0A%0Adef print_attr(h5item):%0A for attr in h5item:%0A print(attr, h5item%5Battr%5D)%0A ... | |
fea9e1e80d03b87c05eacd02b5440fc783eb456d | Fix buildfier | package_managers/apt_get/repos.bzl | package_managers/apt_get/repos.bzl | # Copyright 2017 Google Inc. 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 applicable law or agre... | Python | 0.000001 | @@ -1437,16 +1437,17 @@
%22%0A )%0A
+%0A
%22%22%22Gener
|
05c103238d977fe8c5d6b614f21f581069373524 | Increase tidy column limit to 100 | src/etc/tidy.py | src/etc/tidy.py | #!/usr/bin/env python
# xfail-license
import sys, fileinput, subprocess, re
from licenseck import *
err=0
cols=78
# Be careful to support Python 2.4, 2.6, and 3.x here!
config_proc=subprocess.Popen([ "git", "config", "core.autocrlf" ],
stdout=subprocess.PIPE)
result=config_proc.communica... | Python | 0.000193 | @@ -110,10 +110,11 @@
ols=
-78
+100
%0A%0A#
|
f5a561494ece69c32d4bbd3e23c435a0fe74788a | Add local enum capability (needed for contentwrapper) | processrunner/enum.py | processrunner/enum.py | Python | 0 | @@ -0,0 +1,524 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0A# For use with deployment statuses%0A# https://stackoverflow.com/a/1695250%0Adef enum(*sequential, **named):%0A %22%22%22An implementation of the Enum data type%0A%0A Usage%0A myEnum= enum(%0A 'Apple'%0A ... | |
bb649f299538c76d555e30ac0d31e2560e0acd3e | Add test | tests/test_calculator.py | tests/test_calculator.py | Python | 0.000005 | @@ -0,0 +1,501 @@
+import unittest%0A%0Afrom app.calculator import Calculator%0A%0A%0Aclass TestCalculator(unittest.TestCase):%0A%0A def setUp(self):%0A self.calc = Calculator()%0A%0A def test_calculator_addition_method_returns_correct_result(self):%0A calc = Calculator()%0A result = calc.add... | |
630309837989e79ba972358a3098df40892982f5 | Create rrd_ts_sync.py | rrd_ts_sync.py | rrd_ts_sync.py | Python | 0.000005 | @@ -0,0 +1,3172 @@
+#-------------------------------------------------------------------------------%0A#%0A# Controls shed weather station%0A#%0A# The MIT License (MIT)%0A#%0A# Copyright (c) 2015 William De Freitas%0A# %0A# Permission is hereby granted, free of charge, to any person obtaining a copy%0A# of this softwar... | |
b20a6ccc211060644ff3e6f89428420fa59f5a5d | add a couple of tests for the build_scripts command | tests/test_build_scripts.py | tests/test_build_scripts.py | Python | 0 | @@ -0,0 +1,2325 @@
+%22%22%22Tests for distutils.command.build_scripts.%22%22%22%0A%0Aimport os%0Aimport unittest%0A%0Afrom distutils.command.build_scripts import build_scripts%0Afrom distutils.core import Distribution%0A%0Afrom distutils.tests import support%0A%0A%0Aclass BuildScriptsTestCase(support.TempdirManager, u... | |
3cf30bac4d20dbebf6185351ba0c10426a489de9 | Add sanity linter to catch future use | tools/run_tests/sanity/check_channel_arg_usage.py | tools/run_tests/sanity/check_channel_arg_usage.py | Python | 0 | @@ -0,0 +1,1689 @@
+#!/usr/bin/env python%0A%0A# Copyright 2018 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/LICENSE-2.... | |
51d0623da276aa60a0da4d48343f215f0c517a29 | Add module for ids2vecs | thinc/neural/ids2vecs.py | thinc/neural/ids2vecs.py | Python | 0 | @@ -0,0 +1,55 @@
+from ._classes.window_encode import MaxoutWindowEncode%0A
| |
ada91bd1ed76d59b7ec41d765af188aed2f8fd62 | add a module for collecting Warnings | src/pymor/core/warnings.py | src/pymor/core/warnings.py | Python | 0 | @@ -0,0 +1,256 @@
+'''%0ACreated on Nov 19, 2012%0A%0A@author: r_milk01%0A'''%0A%0Aclass CallOrderWarning(UserWarning):%0A '''I am raised when there's a preferred call order, but the user didn't follow it.%0A For an Example see pymor.discretizer.stationary.elliptic.cg%0A '''%0A pass
| |
03c1f7040cc971c6e05f79f537fc501c550edaa8 | Add back manage.py (doh). | manage.py | manage.py | Python | 0 | @@ -0,0 +1,353 @@
+#!/usr/bin/env python%0Aimport os%0Aimport sys%0A%0Aif __name__ == %22__main__%22:%0A conf = os.path.dirname(__file__)%0A wafer = os.path.join(conf, '..', 'wafer')%0A sys.path.append(wafer)%0A%0A os.environ.setdefault(%22DJANGO_SETTINGS_MODULE%22, %22settings%22)%0A%0A from django.core... | |
0b88d652ddb23a385e79bfccb1db89c954d7d27f | Set up Restaurant class | get_a_lunch_spot.py | get_a_lunch_spot.py | Python | 0.000003 | @@ -0,0 +1,625 @@
+import json%0A%0Arestaurants_string = %22%22%22%5B%7B%0A %22name%22 : %22sweetgreen%22%0A%7D%5D%22%22%22%0Aprint restaurants_string%0A%0Arestaurants_json = json.loads(restaurants_string)%0Aprint restaurants_json%0A%0Aclass Restaurant:%0A name = %22%22%0A%0A def __init__(self, data):%0A self.nam... | |
23e778c78c2d77a9eeb0904856429546e379f8b5 | change the version of openerp | bin/release.py | bin/release.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole re... | Python | 0 | @@ -1405,17 +1405,18 @@
= '4.3.
-0
+99
'%0Adescri
|
23257c56b58c26694773fb12d3ba167de43bd43b | Add validate.py tool | validate.py | validate.py | Python | 0.000001 | @@ -0,0 +1,681 @@
+import json%0Aimport sys%0Aimport urllib2%0A%0Adata=json.loads(open(%22bootstrap/%7B%7D.json%22.format(sys.argv%5B1%5D)).read())%0Afor f in data%5B'storage'%5D%5B'files'%5D:%0A if 'source' not in f%5B'contents'%5D or 'http' not in f%5B'contents'%5D%5B'source'%5D:%0A continue%0A url = f%5... | |
dd1c49eb12bf69580a8727353aa19741059df6d5 | add 102 | vol3/102.py | vol3/102.py | Python | 0.999996 | @@ -0,0 +1,355 @@
+import urllib2%0A%0Aif __name__ == %22__main__%22:%0A ans = 0%0A for line in urllib2.urlopen('https://projecteuler.net/project/resources/p102_triangles.txt'):%0A ax, ay, bx, by, cx, cy = map(int, line.split(','))%0A a = ax * by - ay * bx %3E 0%0A b = bx * cy - by * cx %3E 0... | |
feac5a01059a95910c76a0de5f83ad2473cf09c8 | Create app.py | app.py | app.py | Python | 0.000003 | @@ -0,0 +1,2763 @@
+import os%0Aimport sys%0Aimport tweepy%0Aimport requests%0Aimport numpy as np%0Aimport json%0Aimport os%0A%0Afrom __future__ import print_function%0Afrom future.standard_library import install_aliases%0Ainstall_aliases()%0A%0Afrom urllib.parse import urlparse, urlencode%0Afrom urllib.request import ... | |
1490f438693a5727c722d933a712c889d3c09556 | test where SSL proxying works | test/others/ProxyTest.py | test/others/ProxyTest.py | Python | 0.000002 | @@ -0,0 +1,1528 @@
+import urllib2%0D%0A%0D%0AhttpTarget = %22http://www.collab.net%22%0D%0AhttpsTargetTrusted = %22https://ctf.open.collab.net/sf/sfmain/do/home%22%0D%0AhttpsTargetUntrusted = %22https://www.collab.net%22%0D%0A%0D%0AproxyHost = %22cu182.cloud.sp.collab.net%22%0D%0AproxyPort = %2280%22%0D%0AproxyUser = ... | |
a021928ff9e1625b5e95a8962e12a0d2cc25399f | Remove debug prints | nose2/main.py | nose2/main.py | import logging
import os
import sys
from nose2.compat import unittest
from nose2 import events, loader, runner, session, util
log = logging.getLogger(__name__)
__unittest = True
class PluggableTestProgram(unittest.TestProgram):
sessionClass = session.Session
loaderClass = loader.PluggableTestLoader
run... | Python | 0.000001 | @@ -1359,37 +1359,8 @@
:%5D)%0A
- print cfg_args, argv%0A
@@ -1576,33 +1576,8 @@
gv)%0A
- print args, argv%0A
|
aa1808c9a13894751953c8a1c816c89861e514d1 | Create new package. (#6061) | var/spack/repos/builtin/packages/r-iso/package.py | var/spack/repos/builtin/packages/r-iso/package.py | Python | 0 | @@ -0,0 +1,1679 @@
+##############################################################################%0A# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
384033b6b5d7a3b207c1360b896f70bfbc064caf | Update __init__.py | tendrl/integrations/gluster/sds_sync/__init__.py | tendrl/integrations/gluster/sds_sync/__init__.py | import etcd
import time
from tendrl.commons.objects.job import Job
from tendrl.commons import sds_sync
from tendrl.commons.utils import log_utils as logger
import uuid
class GlusterIntegrtaionsSyncThread(sds_sync.StateSyncThread):
def run(self):
logger.log(
"debug",
NS.get("publi... | Python | 0.000072 | @@ -451,77 +451,8 @@
():%0A
- time.sleep(int(NS.config.data.get(%22sync_interval%22, 10)))%0A
@@ -579,14 +579,89 @@
-return
+time.sleep(int(NS.config.data.get(%22sync_interval%22, 10)))%0A continue
%0A%0A
@@ -2628,16 +2628,106 @@
pass
+%0A %0A ... |
930274bb8ab10379f4c76618cccc604c9fe27996 | Update the test to match removed XLA:CPU device | tensorflow/python/eager/remote_cloud_tpu_test.py | tensorflow/python/eager/remote_cloud_tpu_test.py | # Copyright 2019 The TensorFlow Authors. 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 applicable ... | Python | 0 | @@ -1492,33 +1492,8 @@
0',%0A
- '/device:XLA_CPU:0',%0A
%5D%0AEX
|
4dd36d68225311e328cc4a909b3c56bf9b6e8e53 | Create picture.py | picture.py | picture.py | Python | 0.000002 | @@ -0,0 +1,50 @@
+from ggame import App%0A%0Amyapp = App()%0A%0Amyapp.run()%0A
| |
b3a3376e90d1eede9b2d33d0a4965c1f4920f20a | Add a memoizer | memoize.py | memoize.py | Python | 0.000022 | @@ -0,0 +1,465 @@
+%0A# from http://code.activestate.com/recipes/578231-probably-the-fastest-memoization-decorator-in-the-/%0A%0A__all__ = %5B%22memoize%22%5D%0A%0Adef memoize(f):%0A %22%22%22 Memoization decorator for a function taking one or more arguments. %22%22%22%0A class memodict(dict):%0A def __get... | |
9a902049212ceea29b7b0e440acd33e3c63c7beb | Add timer tests script. | scripts/examples/02-Board-Control/timer_tests.py | scripts/examples/02-Board-Control/timer_tests.py | Python | 0 | @@ -0,0 +1,617 @@
+# Timer Test Example%0A#%0A# This example tests all the timers.%0A%0Aimport time%0Afrom pyb import Pin, Timer, LED%0A%0Ablue_led = LED(3)%0A%0A# Note: functions that allocate memory are Not allowed in callbacks%0Adef tick(timer):%0A blue_led.toggle()%0A%0Aprint(%22%22)%0Afor i in range(1, 18):%0A... | |
11447d409756f2bcd459a6db9d51967358272780 | move flags to constant module | hotline/constant.py | hotline/constant.py | Python | 0.000002 | @@ -0,0 +1,120 @@
+# -*- coding: utf-8 -*-%0A%0A%0Aclass flags(object):%0A DontHide = object()%0A Hide = object()%0A _list = %5BDontHide, Hide%5D%0A
| |
0295a1cbad1dfa2443e6b8e8d639b7d845adaebf | Add lc0225_implement_stack_using_queues.py | lc0225_implement_stack_using_queues.py | lc0225_implement_stack_using_queues.py | Python | 0.000002 | @@ -0,0 +1,1827 @@
+%22%22%22Leetcode 225. Implement Stack using Queues%0AEasy%0A%0AURL: https://leetcode.com/problems/implement-stack-using-queues/%0A%0AImplement the following operations of a stack using queues.%0A- push(x) -- Push element x onto stack.%0A- pop() -- Removes the element on top of the stack.%0A- top() ... | |
0a48d3dc2286db9cff5ec757d8b5f0b45f35ab7d | update : some minor fixes | ptop/interfaces/__init__.py | ptop/interfaces/__init__.py | Python | 0 | @@ -0,0 +1,24 @@
+from .GUI import PtopGUI
| |
261b2477cf6f086028a1028c7d8a02f1b1631018 | add solution for Jump Game | src/jumpGame.py | src/jumpGame.py | Python | 0 | @@ -0,0 +1,322 @@
+class Solution:%0A # @param A, a list of integers%0A # @return a boolean%0A%0A def canJump(self, A):%0A if not A:%0A return False%0A max_dist = 0%0A for i in xrange(len(A)):%0A if i %3E max_dist:%0A return False%0A max_dist... | |
5c0805edd7d54a070b7ce1942eadfc0b3ff2874b | Update memory.py | src/collectors/memory/memory.py | src/collectors/memory/memory.py | # coding=utf-8
"""
This class collects data on memory utilization
Note that MemFree may report no memory free. This may not actually be the case,
as memory is allocated to Buffers and Cache as well. See
[this link](http://www.linuxatemyram.com/) for more details.
#### Dependencies
* /proc/meminfo or psutil
"""
im... | Python | 0 | @@ -723,16 +723,37 @@
ocChunk'
+,%0A 'Committed_AS',
%0A%5D%0A%0A%0Acla
|
99f9f14039749f8e3e4340d6bf0e0394e3483ca2 | add basic propfind test | protocol/test_protocol_propfind.py | protocol/test_protocol_propfind.py | Python | 0 | @@ -0,0 +1,600 @@
+from smashbox.utilities import *%0Afrom smashbox.utilities.hash_files import *%0Afrom smashbox.protocol import *%0A%0A@add_worker%0Adef main(step):%0A%0A d = make_workdir()%0A reset_owncloud_account()%0A%0A URL = oc_webdav_url()%0A%0A ls_prop_desktop20(URL,depth=0)%0A logger.info(%22Pa... | |
6bbdd1d9d60b03429dc2bc1ff3ba5d06353fad9a | Add a Bug class. | libzilla/bug.py | libzilla/bug.py | Python | 0 | @@ -0,0 +1,515 @@
+class Bug:%0A def __init__(self,%0A bug_number,%0A comment=None,%0A resolution=None,%0A status=None):%0A%0A self.bug_number = bug_number%0A self.resolution = resolution%0A self.status = status%0A self.comme... | |
17bd35df32dd68d1cbc0fe73fcda186d13a66db0 | Add run.py | run.py | run.py | Python | 0.000009 | @@ -0,0 +1,1328 @@
+#!/usr/bin/env python3%0A#%0A# Copyright (c) 2014 Mark Samman %3Chttps://github.com/marksamman/pylinkshortener%3E%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining a copy%0A# of this software and associated documentation files (the %22Software%22), to deal%0A# in the Soft... | |
7613285ba24990d62cf2273387a143aa74ce8bb0 | add shortcut to send sms message | nexmo/utils.py | nexmo/utils.py | Python | 0.000001 | @@ -0,0 +1,605 @@
+from .libpynexmo.nexmomessage import NexmoMessage%0Afrom django.conf import settings%0A%0A%0Adef send_message(to, message):%0A %22%22%22Shortcut to send a sms using libnexmo api.%0A%0A Usage:%0A%0A %3E%3E%3E from nexmo import send_message%0A %3E%3E%3E send_message('+33612345678', 'My sms ... | |
49b68f35bb6555eaad7cd5e3bfeb4e7fadb500ba | Add intermediate tower 4 | pythonwarrior/towers/intermediate/level_004.py | pythonwarrior/towers/intermediate/level_004.py | Python | 0.998117 | @@ -0,0 +1,935 @@
+# ----%0A# %7CC s %7C%0A# %7C @ S%7C%0A# %7CC s%3E%7C%0A# ----%0A%0Alevel.description(%22Your ears become more in tune with the surroundings. %22%0A %22Listen to find enemies and captives!%22)%0Alevel.tip(%22Use warrior.listen to find spaces with other units, %22%0A %22and... | |
7662d0a0701381b37f60d42e7dbf04d7950c18ad | add management command to print out duplicate bihar tasks | custom/bihar/management/commands/bihar_cleanup_tasks.py | custom/bihar/management/commands/bihar_cleanup_tasks.py | Python | 0.000001 | @@ -0,0 +1,2456 @@
+import csv%0Afrom django.core.management.base import BaseCommand%0Afrom corehq.apps.hqcase.utils import get_cases_in_domain%0Afrom dimagi.utils.decorators.log_exception import log_exception%0A%0A%0Aclass Command(BaseCommand):%0A %22%22%22%0A Creates the backlog of repeat records that were drop... | |
245879ce699b275edc3ee17e4cba1146241f25de | Add GLib mainllop transport for xmlrpcserver | wizbit/xmlrpcdeferred.py | wizbit/xmlrpcdeferred.py | Python | 0 | @@ -0,0 +1,2780 @@
+import gobject%0A%0Aimport xmlrpclib%0A%0Aclass XMLRPCDeferred (gobject.GObject):%0A %22%22%22Object representing the delayed result of an XML-RPC%0A request.%0A%0A .is_ready: bool%0A True when the result is received; False before then.%0A .value : any%0A Once is_ready=True, th... | |
0880d067f478ba6474e433e620a1e48e23ed9c34 | Add nginx+uWSGI for 10% perf improvement over gunicorn | wsgi/setup_nginxuwsgi.py | wsgi/setup_nginxuwsgi.py | Python | 0 | @@ -0,0 +1,915 @@
+import subprocess%0Aimport multiprocessing%0Aimport os%0A%0Abin_dir = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin')%0Aconfig_dir = os.path.expanduser('~/FrameworkBenchmarks/config')%0ANCPU = multiprocessing.cpu_count()%0A%0Adef start(args):%0A try:%0A subprocess.check_call('s... | |
d4f4d93e8180bb2046c4e37111edfee18f18013e | Bump setuptools to latest | readthedocs/doc_builder/python_environments.py | readthedocs/doc_builder/python_environments.py | import logging
import os
import shutil
from django.conf import settings
from readthedocs.doc_builder.config import ConfigWrapper
from readthedocs.doc_builder.loader import get_builder_class
from readthedocs.projects.constants import LOG_TEMPLATE
log = logging.getLogger(__name__)
class PythonEnvironment(object):
... | Python | 0 | @@ -3315,12 +3315,12 @@
ls==
-18.6
+20.1
.1',
|
8fe4b03d7944f2facf8f261d440e7220c4d1228b | add file | Python/mapexp.py | Python/mapexp.py | Python | 0.000001 | @@ -0,0 +1,1016 @@
+#!/usr/bin/env python%0A%0A%22%22%22%0Amap(fun, iterable,...)%0A Return a list of the results of applying the function to the items of%0A the argument sequence(s). If more than one sequence is given, the%0A function is called with an argument list consisting of the corresponding%0A item of... | |
6dd4b6ee9b9457d2362404aac71fd73e907bf535 | Add Timeline class. | source/vistas/ui/controls/timeline.py | source/vistas/ui/controls/timeline.py | Python | 0 | @@ -0,0 +1,3168 @@
+import datetime%0Afrom bisect import insort%0A%0A%0Aclass TimelineFilter:%0A pass # Todo: implement%0A%0A%0Aclass Timeline:%0A _global_timeline = None%0A%0A @classmethod%0A def app(cls):%0A %22%22%22 Global timeline %22%22%22%0A%0A if cls._global_timeline is None:%0A ... | |
560d82cd4b7de72a4fada77b0fe13bfb1caa9790 | package script | package.py | package.py | Python | 0.000002 | @@ -0,0 +1,646 @@
+import os%0Aimport sys%0Afor root, dirs, files in os.walk(os.path.dirname(os.path.abspath(__file__))):%0A for name in files:%0A if name.endswith((%22.java%22)):%0A file = open(name, %22r%22)%0A lines = file.readlines()%0A file.close()%0A file = op... | |
cc9ce576a33c60acc9f60f12b42e56f474b760ac | Add json_jinja renderer | salt/renderers/json_jinja.py | salt/renderers/json_jinja.py | Python | 0.000668 | @@ -0,0 +1,657 @@
+'''%0AThe default rendering engine, yaml_jinja, this renderer will take a yaml file%0Awith the jinja template and render it to a high data format for salt states.%0A'''%0A%0A# Import python libs%0Aimport os%0Aimport json%0A%0A# Import Third Party libs%0Afrom jinja2 import Template%0A%0Adef render(tem... | |
e35711d368faadaa017186200092297f264648fe | Add web ui | nodes/web_ui.py | nodes/web_ui.py | Python | 0.000001 | @@ -0,0 +1,1771 @@
+#!/usr/bin/env python%0Aimport roslib; roslib.load_manifest('rospilot')%0Aimport rospy%0Afrom pymavlink import mavutil%0Aimport rospilot.msg%0A%0Afrom BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer%0A%0APORT_NUMBER = 8085%0A%0Aarmed = None%0A%0A#This class will handles any incoming request ... | |
c8ede03a393ae1287a9a34e86af40cd6a8b3027b | add missing module (RBL-3757) | mint/targets.py | mint/targets.py | Python | 0 | @@ -0,0 +1,2325 @@
+#%0A# Copyright (c) 2008 rPath, Inc.%0A#%0A# All Rights Reserved%0A#%0A%0Afrom mint import database, mint_error%0Aimport simplejson%0A%0Aclass TargetsTable(database.KeyedTable):%0A name = 'Targets'%0A key = 'targetId'%0A%0A fields = ('targetId', 'targetType', 'targetName')%0A%0A def addT... | |
3709bcbd421d82f9404ab3b054989546d95c006f | Fix another broken sc2reader.plugins reference. | sc2reader/scripts/sc2json.py | sc2reader/scripts/sc2json.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals, division
import sc2reader
from sc2reader.plugins.replay import toJSON
def main():
import argparse
parser = argparse.ArgumentParser(description="Prints replay data to a json string.")
pa... | Python | 0 | @@ -155,16 +155,26 @@
2reader.
+factories.
plugins.
|
c3c559f893e31e728a429cf446039781cea1f25d | Add unit tests for `%tensorflow_version` | tests/test_tensorflow_magics.py | tests/test_tensorflow_magics.py | Python | 0 | @@ -0,0 +1,1732 @@
+# Copyright 2019 Google Inc.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by ... | |
fe879d7f6f56db410eb5d3d9aeb5691d020661c7 | Create shackbullet.py | shackbullet.py | shackbullet.py | Python | 0.000109 | @@ -0,0 +1,1418 @@
+#Import the modules%0Aimport requests%0Aimport json%0Aimport uuid%0A%0A#Edit these to your shacknews login credentials%0Ashackname = 'Username'%0Ashackpass = 'ShackPassword'%0Apushbulletkey = 'access token from https://www.pushbullet.com/account'%0A%0A#Fun Bbegins%0A%0A#generate uuid from namespace%... | |
dc4a3ec9a8bb042cef115005d8ebf11dc2c5889e | Longest increasing subsequence in the list | longest_increasing_subsequence.py | longest_increasing_subsequence.py | Python | 1 | @@ -0,0 +1,1162 @@
+l = %5B3,4,5,9,8,1,2,7,7,7,7,7,7,7,6,0,1%5D%0Aempty = %5B%5D%0Aone = %5B1%5D%0Atwo = %5B2,1%5D%0Athree = %5B1,0,2,3%5D%0Atricky = %5B1,2,3,0,-2,-1%5D%0Aring = %5B3,4,5,0,1,2%5D%0Ainternal = %5B9,1,2,3,4,5,0%5D%0A%0A# consider your list as a ring, continuous and infinite%0Adef longest_increasing_subs... | |
0b419a71a414e605af57029286b627e286c5df47 | add session | controller/addSession.py | controller/addSession.py | Python | 0 | @@ -0,0 +1,630 @@
+#!/usr/local/bin/python3%0A%0A%22%22%22%0Acreated_by: Aninda Manocha%0Acreated_date: 3/5/2015%0Alast_modified_by: Aninda Manocha%0Alast_modified_date: 3/5/2015%0A%22%22%22%0A%0Aimport constants%0Aimport utils%0Aimport json%0Afrom sql.session import Session%0Afrom sql.user import User%... | |
d83e30cc2ec46eeb2f7c27c26e0fc3d2d3e6de90 | add an environment checker | scripts/check_environment.py | scripts/check_environment.py | Python | 0 | @@ -0,0 +1,87 @@
+%22%22%22%0ASomething to run to make sure our machine is up to snuff!%0A%22%22%22%0Aimport pg%0Aimport xlwt
| |
ef78460a3303216f424247203cf0b5e1ecc88197 | Add test for ticket #1074. | scipy/optimize/tests/test_regression.py | scipy/optimize/tests/test_regression.py | Python | 0.000005 | @@ -0,0 +1,322 @@
+%22%22%22Regression tests for optimize.%0A%0A%22%22%22%0Afrom numpy.testing import *%0Aimport numpy as np%0A%0A%0Aclass TestRegression(TestCase):%0A def test_newton_x0_is_0(self):%0A %22%22%22Ticket #1074%22%22%22%0A import scipy.optimize%0A tgt = 1%0A res = scipy.optim... | |
c654841595fd679c511d2d3b91c2edc9335c78cc | Create Quiz-Problem8.py | Quiz-Problem8.py | Quiz-Problem8.py | Python | 0.000001 | @@ -0,0 +1,527 @@
+# PROBLEM 8%0A%0A%0Adef satisfiesF(L):%0A %22%22%22%0A Assumes L is a list of strings%0A Assume function f is already defined for you and it maps a string to a Boolean%0A Mutates L such that it contains all of the strings, s, originally in L such%0A that f(s) returns True, and ... | |
aa3cf6a383c38a9f17172ae2a754a8e67243e318 | add new form to bulk import indicators from json file | corehq/apps/indicators/forms.py | corehq/apps/indicators/forms.py | Python | 0 | @@ -0,0 +1,1257 @@
+from django import forms%0Afrom django.utils.translation import ugettext_noop, ugettext as _%0Afrom bootstrap3_crispy import bootstrap as twbs%0Afrom bootstrap3_crispy.helper import FormHelper%0Afrom bootstrap3_crispy import layout as crispy%0Afrom corehq.apps.style.crispy import FormActions%0A%0A%0... | |
04f851706b4384add01e6cd41f31305d587f7a36 | Create pushbullet.py | pushbullet.py | pushbullet.py | Python | 0.00003 | @@ -0,0 +1,859 @@
+# Python unofficial Pushbullet client%0A# (C) 2015 Patrick Lambert - http://dendory.net - Provided under MIT License%0Aimport urllib.request%0Aimport sys%0A%0Aapi_key = %22XXXXXXXXX%22%0Atitle = %22My Title%22%0Amessage = %22My Body%22%0A%0Adef notify(key, title, text):%0A%09post_params = %7B%0A%09%0... | |
57b19c56b8be8c8131cc3d98cb9f30da3398412b | create a reporting helper for logging channel info | remoto/log.py | remoto/log.py | Python | 0 | @@ -0,0 +1,329 @@
+%0A%0Adef reporting(conn, result):%0A log_map = %7B'debug': conn.logger.debug, 'error': conn.logger.error%7D%0A while True:%0A try:%0A received = result.receive()%0A level_received, message = received.items()%5B0%5D%0A log_map%5Blevel_received%5D(message.... | |
371df7c27fa1c4130214c58ececa83b0e0b6b165 | Create palindrome3.py | palindrome3.py | palindrome3.py | Python | 0.000034 | @@ -0,0 +1,47 @@
+palindrome3 = lambda x: str(x) == str(x)%5B::-1%5D%0A
| |
5129dd5de6f4a8c0451adbb5631940bb82b51a26 | Add a script to enact updates to positions & alternative names | mzalendo/kenya/management/commands/kenya_apply_updates.py | mzalendo/kenya/management/commands/kenya_apply_updates.py | Python | 0 | @@ -0,0 +1,3477 @@
+from collections import defaultdict%0Aimport csv%0Aimport datetime%0Aimport errno%0Aimport hmac%0Aimport hashlib%0Aimport itertools%0Aimport json%0Aimport os%0Aimport re%0Aimport requests%0Aimport sys%0A%0Afrom django.core.management.base import NoArgsCommand, CommandError%0Afrom django.template.def... | |
67e7d530b4b4ffa86c9f147751cf17828e024cba | add migration to create job table | migrations/versions/5706baf73b01_add_jobs_table.py | migrations/versions/5706baf73b01_add_jobs_table.py | Python | 0.000001 | @@ -0,0 +1,1741 @@
+%22%22%22Add jobs table%0A%0ARevision ID: 5706baf73b01%0ARevises: 6bd350cf4748%0ACreate Date: 2016-09-14 15:53:50.394610%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '5706baf73b01'%0Adown_revision = '6bd350cf4748'%0A%0Afrom alembic import op%0Aimport sqlalchemy as sa%0Ai... | |
ec841c86348302dc67b48af93d2b3b5c8fb96b6e | add list | misc/list.py | misc/list.py | Python | 0.000016 | @@ -0,0 +1,230 @@
+#!/usr/bin/env python%0A%0A# Python 3: List comprehensions%0A%0Afruits = %5B'Banana', 'Apple', 'Lime'%5D%0A%0Aloud_fruits = %5Bfruit.upper() for fruit in fruits%5D%0A%0Aprint(loud_fruits)%0A%0A# List and the enumerate function%0Aprint(list(enumerate(fruits)))%0A
| |
427fa7f57776a73b5ec0e5045114d5ac330e6a57 | Create misc.py | misc/misc.py | misc/misc.py | Python | 0 | @@ -0,0 +1 @@
+%0A
| |
0612769b07e88eae9865a16f1ae8162502fe65f9 | Add senate evacuation | 2016/1c/senate_evacuation.py | 2016/1c/senate_evacuation.py | Python | 0.000367 | @@ -0,0 +1,2241 @@
+#!/usr/bin/env python%0A%0Afrom __future__ import print_function%0A%0Adef parse_senates(senates_str):%0A return %5Bint(_) for _ in senates_str.split(' ')%5D%0A%0Adef get_evacuation_plan(senates):%0A if not isinstance(senates, list):%0A raise TypeError%0A%0A num_parties = len(senates)... | |
aabb57148cced94b31109b46adf83a43ca23f7a3 | allow to apply std functions back | mosql/std.py | mosql/std.py | Python | 0 | @@ -0,0 +1,669 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A'''It applies the standard functions to :mod:%60mosql.util%60.%0A%0AThe usage:%0A%0A::%0A%0A import mosql.std%0A%0AIf you want to patch again:%0A%0A::%0A%0A mosql.std.patch()%0A%0AIt will replace the functions in :mod:%60mosql.util%60 with or... | |
69892066449a40322a34b3a7b8e60e3fa99eef41 | Create deobfuscator.py | ver.-0.1/deobfuscator.py | ver.-0.1/deobfuscator.py | Python | 0.000015 | @@ -0,0 +1 @@
+%0A
| |
3c396700a52571d5aae2a12fac601f063a7af761 | Add missing add_master.py. | devops/deployment/add_master.py | devops/deployment/add_master.py | Python | 0 | @@ -0,0 +1,444 @@
+#!/usr/bin/env python%0A# script to add minion config%0Aimport yaml%0Aimport sys%0Aimport os%0Af=open(%22/etc/salt/minion%22, 'r')%0Asettings=yaml.load(f)%0Af.close()%0Aip=os.environ%5B%22MASTER_IP%22%5D%0Aif settings%5B%22master%22%5D.__class__ == str:%0A settings%5B%22master%22%5D = %5Bsettings%5B... | |
00a059f172e1d6214d858370829e1034c2742ce4 | add gevent run script | run_gevent.py | run_gevent.py | Python | 0 | @@ -0,0 +1,235 @@
+from gevent.monkey import patch_all; patch_all()%0Afrom gevent.wsgi import WSGIServer%0Afrom pypi_notifier import create_app%0Aapp = create_app('ProductionConfig')%0Ahttp_server = WSGIServer(('0.0.0.0', 5001), app)%0Ahttp_server.serve_forever()%0A
| |
916b7fe4ee4c3c5c55278927a7116a4d1e0ad6d1 | Add solarized256.py | solarized256.py | solarized256.py | Python | 0 | @@ -0,0 +1,2569 @@
+# -*- coding: utf-8 -*-%0A%0A%22%22%22%0A solarized256%0A ------------%0A%0A A Pygments style inspired by Solarized's 256 color mode.%0A%0A :copyright: (c) 2011 by Hank Gay, (c) 2012 by John Mastro.%0A :license: BSD, see LICENSE for more details.%0A%22%22%22%0A%0Afrom pygments.style i... | |
fd89f422e1a95729b31da683a50f601604a43e9b | Version 1 of pyAdd. Raw | pyAdd.py | pyAdd.py | Python | 0.000003 | @@ -0,0 +1,531 @@
+#!/usr/bin/python%0A# Name: Frank Lewis%0A# NSID: fbl773%0A# Student ID: 11194945%0A# Lecture: 04%0A# Tutorial: T08%0A# Assignment: lab _%0A# Synopsis: python - beans on toast... weird%0A%0Aprint %22Begin Adder%22%0A%0Ac = 2%0An = -1.0%0Ac = raw_input(%22How many elements?: %22)%0A... | |
6cab10d19386911f33aaca660a9e1a35751b18ee | broke github api url naming scheme. fixed | post_qr.py | post_qr.py | import praw
import OAuth2Util
import time
import requests
import json
import os
import humanize
# sweet mother of imports
def make_qr(repo):
"""
Takes a github url, uses the github api to get the direct download url and size, and uses google api to make a qr.
It returns the link to the qr (not on imgur) a... | Python | 0.999656 | @@ -352,34 +352,8 @@
%22%22%22%0A
- if 'tag' in repo:%0A
@@ -372,19 +372,24 @@
rsplit('
-tag
+releases
', 1)%5B0%5D
@@ -430,33 +430,34 @@
url up to /
-tag/%0A
+releases/%0A
repo = r
@@ -469,217 +469,24 @@
8::%5D
- # cut out www.~~~ blah up to /user/repo%... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.