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 |
|---|---|---|---|---|---|---|---|
b77187592e3a6ba4fd06c13fb2a576ab9066d893 | add test for #313 | numba/tests/issues/test_issue_313.py | numba/tests/issues/test_issue_313.py | Python | 0 | @@ -0,0 +1,517 @@
+# -*- coding: utf-8 -*-%0Afrom numba import void, double, jit%0Aimport numpy as np%0A %0A# thanks to @ufechner7%0A%0Adef multiassign(res0, res1, val0, val1):%0A res0%5B:%5D, res1%5B:%5D = val0%5B:%5D, val1%5B:%5D%0A%0Aif __name__ == %22__main__%22:%0A multiassign1 = jit(void(double%5B:%5D, doub... | |
efbf98235b82c954364f35cb09f63006e23346e2 | Create tests for JavaScript parser. | tests/test_lang_javascript.py | tests/test_lang_javascript.py | Python | 0 | @@ -0,0 +1,1284 @@
+#!/usr/bin/env python3%0A# -*- coding: UTF-8 -*-%0A%0Aimport pytest # type: ignore%0A%0Afrom sensibility.language import Language%0Afrom sensibility.language.javascript import javascript%0Afrom sensibility.token_utils import Position%0A%0Afrom location_factory import LocationFactory%0A%0Atest_file ... | |
b29a37c92efca42cbd85b24306455b063dce33e2 | debug module can be imported to cause break-on-exception | pug/debug.py | pug/debug.py | Python | 0.000003 | @@ -0,0 +1,1441 @@
+%22%22%22Import this module to invoke the interractive python debugger, ipydb, on any exception%0A%0A Resources:%0A Based on http://stackoverflow.com/a/242531/623735%0A%0A Examples:%0A %3E%3E%3E import debug%0A %3E%3E%3E x=%5B%5D%5B0%5D%0A%22%22%22 %0A%0A# from http://stackoverflow.com/a/... | |
fd3a4e39b17995f75d9b6027b4abcb29013f479d | add network/sshd.py. | network/sshd.py | network/sshd.py | Python | 0 | @@ -0,0 +1,1605 @@
+from __future__ import print_function%0A%0Aimport os%0Aimport sys%0Aimport re%0Aimport time%0Aimport datetime%0A%0Adef get_ptyreq_reply(line):%0A # for Microsoft Windows, the %60pty-req reply%60 in sshd log would be 0.%0A # for Linux, the %60pty-req reply%60 would be 1.%0A REGEX = r'(?%3C=p... | |
45c746c6c6aee03092b2b08bf1aff73ead85683e | add form | 150409/server/form.py | 150409/server/form.py | Python | 0.000001 | @@ -0,0 +1,790 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Thu Apr 23 18:48:43 2015%0A%0A@author: Wasit%0A%22%22%22%0A%0Afrom flask import Flask%0Afrom flask import request%0Aapp = Flask(__name__)%0A%0Aform_str=%22%22%22%3Cform action=%22login%22 method=%22POST%22%3E%0AFirst name:%3Cbr%3E%0A%3Cinput type=%22te... | |
a9077802269270a1d8cfb685400b9f23f45d6940 | add propagator test | tests/pptc/test_propagator.py | tests/pptc/test_propagator.py | Python | 0 | @@ -0,0 +1,1036 @@
+from pybbn.graph.dag import BbnUtil%0Afrom pybbn.pptc.potentialinitializer import PotentialInitializer%0Afrom pybbn.pptc.moralizer import Moralizer%0Afrom pybbn.pptc.triangulator import Triangulator%0Afrom pybbn.pptc.transformer import Transformer%0Afrom pybbn.pptc.initializer import Initializer%0Af... | |
9100015cf25d0ab09aa3b8d6410343f933b599fc | Add quicklook.py, a quick way of checking properties across all the data | quicklook.py | quicklook.py | Python | 0 | @@ -0,0 +1,688 @@
+from fiona import collection%0Afrom sys import argv%0Afrom glob import glob%0A%0Aif (len(argv) == 2):%0A addrs = glob(%22chunks/addresses-%25s.shp%22)%0A for addr in addrs:%0A print addr%0Aelse:%0A addrs = glob(%22chunks/addresses*.shp%22)%0A for addr in addrs:%0A try:%0A ... | |
34939554fc3697867979a6ca711583b24d38def0 | Create quicksort.py | quicksort.py | quicksort.py | Python | 0.000004 | @@ -0,0 +1,1877 @@
+%22%22%22Implements Quicksort algorithm.%0A%22%22%22%0A%0Aimport random # for random selection of pivot element%0A%0A%0Adef swap_elements(mut_seq, index1, index2):%0A %22%22%22Swaps two elements of mutable sequence.%0A%0A Args:%0A mut_seq: mutable sequence%0A index1: index of ele... | |
09ee7c5972f3a508355f6dfd49ff05d8de482cd9 | Add example of slide-hold-slide test | shs_example.py | shs_example.py | Python | 0.000001 | @@ -0,0 +1,1178 @@
+import numpy as np%0Aimport matplotlib.pyplot as plt%0Aimport rsf%0A%0Amodel = rsf.RateState()%0A%0A# Set model initial conditions%0Amodel.mu0 = 0.6 # Friction initial (at the reference velocity)%0Amodel.a = 0.005 # Empirical coefficient for the direct effect%0Amodel.b = 0.01 # Empirical coefficient... | |
4f7b103d6c5fa3b07abb23e346caa995a7f803ef | Make new test fail correctlyish | tests/completion.py | tests/completion.py | from _utils import _output_eq, IntegrationSpec
class ShellCompletion(IntegrationSpec):
"""
Shell tab-completion behavior
"""
def no_input_means_just_task_names(self):
_output_eq('-c simple_ns_list --complete', "z_toplevel\na.b.subtask\n")
def no_input_with_no_tasks_yields_empty_response(... | Python | 0.998843 | @@ -1,8 +1,48 @@
+import sys%0A%0Afrom nose.tools import ok_%0A%0A
from _ut
@@ -79,16 +79,46 @@
tionSpec
+, _dispatch, trap, expect_exit
%0A%0A%0Aclass
@@ -433,24 +433,34 @@
lete', %22%22)%0A%0A
+ @trap%0A
def top_
@@ -513,50 +513,283 @@
-_output_eq('--complete -- -', %22--lol%5Cn--wut%22
+with expect... |
b5dcc8d77ebbe3f1e62599164139cf60927c94c8 | Create Precio.py | Precio.py | Precio.py | Python | 0 | @@ -0,0 +1,1234 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A%0Afrom att import *%0A#from att import Sector_Destino%0Afrom zona import zona%0Afrom Conexion import *%0A%0A# lugar = %22Costa del Este%22%0A# # lugar = %22Altos del Hip%C3%B3dromo%22%0A# # destino=%22El Tecal%22%0A# # # lugar = %22El Tecal%22%0A# desti... | |
661943403b9a4b7c28bf9e0a59ba937dc2298fef | Add SSH auto detect feature | netmiko/ssh_autodetect.py | netmiko/ssh_autodetect.py | Python | 0 | @@ -0,0 +1,2336 @@
+%22%22%22%0AThis module is used to auto-detect the type of a device in order to automatically create a%0ANetmiko connection.%0A%0AThe will avoid to hard coding the 'device_type' when using the ConnectHandler factory function%0Afrom Netmiko.%0A%22%22%22%0A%0Afrom netmiko.ssh_dispatcher import CLASS_M... | |
98dcea81abcfb795c61b24b260c5a5592d24b2d4 | use this file to built unit tests | tests/test_money.py | tests/test_money.py | Python | 0 | @@ -0,0 +1,996 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0Afrom decimal import Decimal%0Aimport cPickle as pickle%0Afrom django.utils.formats import number_format%0Afrom . import Money%0Afrom .money_maker import MoneyMaker, AbstractMoney%0A%0A# Tests:%0Am1 = Money('1.46')%0Am2 = Money('3.54'... | |
0d32800fec1419eac39711fd8c94ce07896cddaf | Test for the gaussian output layer, going through all same fit() and predict() tests as the linear output. | sknn/tests/test_gaussian.py | sknn/tests/test_gaussian.py | Python | 0 | @@ -0,0 +1,310 @@
+import unittest%0Afrom nose.tools import (assert_is_not_none, assert_raises, assert_equal)%0A%0Afrom sknn.mlp import MultiLayerPerceptronRegressor as MLPR%0A%0Afrom . import test_linear%0A%0A%0Aclass TestGaussianOutput(test_linear.TestLinearNetwork):%0A%0A def setUp(self):%0A self.nn = MLPR... | |
4fd971e3e5e4c6e972cb764cecd355638c67a36f | Update exception handler test in line with deprecations | tests/test_views.py | tests/test_views.py | from __future__ import unicode_literals
import copy
import sys
from django.test import TestCase
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.settings import api_settings
from rest_framework.test import APIRequestFact... | Python | 0 | @@ -3868,16 +3868,25 @@
dler(exc
+, request
):%0A
|
dfa8f4b867a17a6f63a0e2e2e5f7f615ad514fc0 | improve proj | notes/code/linked_list.py | notes/code/linked_list.py | Python | 0.000002 | @@ -0,0 +1,451 @@
+# Hmm.... python classes are not so clear.%0Aclass LinkedList:%0A pass%0A%0Aclass Node:%0A def __str__(self):%0A return str(self.value)%0A%0Anames = LinkedList()%0Anames.head = None%0A%0Adef add(llist,x):%0A newnode = Node()%0A newnode.value = x%0A newnode.next = llist.head%0A ... | |
5fb337e143ae55d98b3772dc6f5059d0c01115c1 | Create package __init__.py file. | __init__.py | __init__.py | Python | 0 | @@ -0,0 +1,1447 @@
+%22%22%22%0ASConsProject%0A%0AThe sconsproject package proposes a way to easily create the compilation system%0Aof your project with the minimum of information. It's an helper around SCons.%0A%0A########################################%0A# Example 1%0Afrom sconsProject import SConsProject%0A%0Aproje... | |
436029e6f4626d0e13393206cc38e5f2cae9c770 | Create __init__.py | __init__.py | __init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
3402602d0aaf39e491a6422ba35f175bc249539b | Add __init__.py. | __init__.py | __init__.py | Python | 0.000084 | @@ -0,0 +1,54 @@
+from mpyq import MPQArchive%0A%0A__all__ = %5B'MPQArchive'%5D%0A
| |
4ed138d379aa1e16d852907aa31e40b799818356 | tornado blocking task | toys/tornado_blocking_task.py | toys/tornado_blocking_task.py | Python | 0.999553 | @@ -0,0 +1,1997 @@
+# coding=utf-8%0A%22%22%22%0ARef:%0A https://gist.github.com/methane/2185380%0A%0A%E6%B5%8B%E8%AF%95%E6%96%B9%E6%B3%95:%0A curl 'http://127.0.0.1:8888/' &%0A curl 'http://127.0.0.1:8888/' &%0A curl 'http://127.0.0.1:8888/' &%0A curl 'http://127.0.0.1:8888/' &%0A curl 'http://127.0.... | |
6d33848780d71c9bf725288f1f92d022f143a7e6 | add sift_matcher #132 | jsk_2015_05_baxter_apc/node_scripts/sift_matcher.py | jsk_2015_05_baxter_apc/node_scripts/sift_matcher.py | Python | 0.000001 | @@ -0,0 +1,2914 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A#%0Aimport os%0Aimport gzip%0Aimport cPickle as pickle%0A%0Aimport numpy as np%0Aimport yaml%0A%0Aimport rospy%0Afrom posedetection_msgs.msg import ImageFeature0D%0Afrom jsk_2014_picking_challenge.srv import ObjectMatch, ObjectMatchResponse%0A%0Afrom... | |
f24c082c87db92bc894997e5adcbc72ba54ef464 | Fix comparing template name | scripts/misspelling.py | scripts/misspelling.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This script fixes links that contain common spelling mistakes.
This is only possible on wikis that have a template for these misspellings.
Command line options:
-always:XY instead of asking the user what to do, always perform the same
action. For examp... | Python | 0.000254 | @@ -1012,9 +1012,9 @@
-201
-6
+7
%0A#%0A#
@@ -4698,16 +4698,179 @@
t None:%0A
+ templates = self.misspellingTemplate%5BdisambPage.site.code%5D%0A if isinstance(templates, basestring):%0A templates = (templates, )%0A
@@ -4950,17 +4950,16 @@
if
-(
template
@@ -499... |
c0aa12111befbc6a5779be6a0111f7b80027082d | add new package (#6659) | var/spack/repos/builtin/packages/tasmanian/package.py | var/spack/repos/builtin/packages/tasmanian/package.py | Python | 0 | @@ -0,0 +1,1660 @@
+##############################################################################%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... | |
d8fd5835b6ba0a6de757fe4aa63fa97bdbd15f83 | add new package (#2486) | var/spack/repos/builtin/packages/rename/package.py | var/spack/repos/builtin/packages/rename/package.py | Python | 0 | @@ -0,0 +1,1851 @@
+##############################################################################%0A# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
558e5ff1a4d33f339d34a4fe2fac649cd22f45c3 | add reprlib.repr() sample. | trypython/stdlib/reprlib01.py | trypython/stdlib/reprlib01.py | Python | 0 | @@ -0,0 +1,1268 @@
+%22%22%22%0Areprlib %E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E3%81%AE%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%81%A7%E3%81%99%E3%80%82%0A%0Alink::%0A https://docs.python.jp/3/library/reprlib.html%0A%22%22%22%0Aimport functools%0Aimport random%0Aimport reprlib%0Aimport string%0Afrom typing import Sequence... | |
a4945972bb4f04c2d18fec87ec4c6d6e955cba1c | add release script | release.py | release.py | Python | 0.000006 | @@ -0,0 +1,1659 @@
+#! /usr/bin/env python%0A%0Aimport subprocess%0Aimport sys%0A%0A%0AGIT_SHOW_REF_HEARD = 'git show-ref --verify --quiet refs/heads/%25s'%0AGIT_SHOW_REF_TAGS = 'git show-ref --verify --quiet refs/tags/%25s'%0A%0A%0Adef checkExistingTag(version):%0A if (subprocess.call((GIT_SHOW_REF_HEARD %25 version)... | |
e8e00263acb7f04e19c0839bd881151b6ed4abd1 | Create webhook.py | webhook.py | webhook.py | Python | 0.000005 | @@ -0,0 +1,14 @@
+print 'Hello'%0A
| |
6bba6221343ec2b2c2626504ea46aba621a39df0 | convert gatk result to gistic segment file | lib/Format/gatk2gistic_segment_file.py | lib/Format/gatk2gistic_segment_file.py | Python | 0.000489 | @@ -0,0 +1,1790 @@
+import argparse%0Aimport gzip%0Aimport math%0Aimport logging%0A%0Aparser = argparse.ArgumentParser(description=%22Convert GATK segment CNV to gistic2 segmentation file%22,%0A formatter_class=argparse.ArgumentDefaultsHelpFormatter)%0A%0Aparser.add_argument('-i', '--inp... | |
27177a3e27edfa8524c9bffee5aa4e4430d1e311 | Create base mesh | api/mesh.py | api/mesh.py | Python | 0 | @@ -0,0 +1,2644 @@
+import bpy%0A%0Afrom .base import BlenderObject%0A%0A%0Aclass Mesh(BlenderObject):%0A %22%22%22Base mesh%22%22%22%0A def add_modifier(self, type):%0A %22%22%22Add a modifier to the active object%0A%0A :param type: Type of the modifier, must be one of the following:%0A ... | |
080955df4708c27aac57fc93b0b46dbaa7615004 | fix .get on None object (#4077) | Tests/scripts/wait_until_server_ready.py | Tests/scripts/wait_until_server_ready.py | """Wait for server to be ready for tests"""
import sys
import json
import argparse
from time import sleep
import datetime
import demisto
from typing import List, AnyStr
from Tests.test_utils import print_error, print_color, LOG_COLORS
MAX_TRIES = 20
SLEEP_TIME = 45
def get_username_password():
parser = argpars... | Python | 0 | @@ -1807,24 +1807,100 @@
resp.json()%0A
+ if not isinstance(resp, dict):%0A raise ValueError%0A
|
da98b07624e2403807166e8a9d0dac3752f75c0f | Add more options to `spack edit` | lib/spack/spack/cmd/edit.py | lib/spack/spack/cmd/edit.py | ##############################################################################
# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
... | Python | 0 | @@ -2816,27 +2816,40 @@
't exist.%22)%0A
+%0A
+ filetypes =
subparser.a
@@ -2855,63 +2855,274 @@
add_
-argument(%0A '-c', '--command', dest='edit_command
+mutually_exclusive_group()%0A filetypes.add_argument(%0A '-c', '--command', dest='path', action='store_const',%0A const=spack.cmd.co... |
0b8ca8c7015ddd567abdd08e508a27c6ee3ed778 | fix history pickup payload | karrot/history/migrations/0009_extend_historic_data_more.py | karrot/history/migrations/0009_extend_historic_data_more.py | Python | 0 | @@ -0,0 +1,705 @@
+from django.db import migrations%0A%0ABATCH_SIZE = 1000%0A%0A%0Adef migrate(apps, schema_editor):%0A History = apps.get_model('history', 'History')%0A%0A # rewrite pickup date payload date field from string to list%0A save_payload = %5B%5D%0A%0A for h in History.objects.filter(payload__da... | |
adbdacfceca33e0dc22f1d28b8e1963932c7e31a | save work for augmentation | donkeycar/parts/stores/augmentation.py | donkeycar/parts/stores/augmentation.py | Python | 0 | @@ -0,0 +1,1099 @@
+import numpy as np%0A%0A%0Adef white_unbalance(x, y):%0A # Adjust white balance.%0A min_channel_high_end = 0.25%0A max_channel_low_end = 0.25%0A rmin = random.random()*min_channel_high_end%0A gmin = random.random()*min_channel_high_end%0A bmin = random.random()*min_channel_high_end... | |
b5e9821642c07f30909f7cbaff193af6666777a7 | Revert "disable 'svn init' for blink temporarily" | recipes/blink.py | recipes/blink.py | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# TOOD(dpranke): reenable import json
# pylint: disable=F0401
import recipe_util
import sys
# pylint: disable=W0232
class Blink(recipe_util.Recipe):
"... | Python | 0.000022 | @@ -164,34 +164,8 @@
e.%0A%0A
-# TOOD(dpranke): reenable
impo
@@ -384,39 +384,8 @@
-# TODO(dpranke): reenable%0A #
subm
@@ -403,17 +403,16 @@
= %7B%0A
-#
'third
@@ -429,25 +429,24 @@
Kit': %7B%0A
-#
'svn_url
@@ -482,33 +482,32 @@
ink/trunk',%0A
-#
'svn_branch'
@@ -521,17 +521,16... |
345b26fff755dbdea4021ba9bc613647a374644c | Add match group migration | matches/migrations/0007_match_group.py | matches/migrations/0007_match_group.py | Python | 0 | @@ -0,0 +1,456 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.5 on 2016-05-24 13:07%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('matches', '0006_match_is_finished'),%0A %5D%0A%0A... | |
907ff7fca6228248010dbb86fc81c2266cdeb264 | Add release script | release.py | release.py | Python | 0.000001 | @@ -0,0 +1,2092 @@
+#!/usr/bin/env python%0A%0Afrom collections import OrderedDict%0Afrom itertools import zip_longest%0Aimport json%0Aimport os%0Aimport re%0Afrom subprocess import check_output, CalledProcessError%0Aimport sys%0Afrom zipfile import ZipFile%0A%0A%0Adef sh(command, v=False):%0A if v:%0A print(... | |
3ac53be481ec0b6465420d4a223378263f87475c | add test client | test/client.py | test/client.py | Python | 0.000001 | @@ -0,0 +1,758 @@
+import json%0Aimport socket%0Aimport ssl%0Aimport struct%0Aimport logging%0Aimport time%0Aimport sys%0Afrom kutils.ksonsocket import KSONClientConnection%0Afrom threading import Thread%0A%0A%0A%0Adef _client_default_handler(json_connection, msg):%0A print msg%0A%0Adef main(argv):%0A client_conn... | |
53f54b114d23e5aa5e19aebc145944156d7ae87c | add example file starting to summarize an LRAUV log like the old review scripts | examples/review-scripts/log-summary.py | examples/review-scripts/log-summary.py | Python | 0 | @@ -0,0 +1,1092 @@
+#!/usr/bin/env python%0Aimport matplotlib.pyplot as plt%0Aimport okeanidanalysis as oa%0A%0Adef main(logfile, verbose=0):%0A %22%22%22summarize an LRAUV log file with plots%0A%0A %22%22%22%0A if type(logfile) is not str: s = oa.logs.OkeanidLog(logfile.name)%0A else: s = oa.logs.OkeanidLo... | |
237df47a31240ebf35a5de304bcc6c73e8f921b9 | Create merge_sort_fastest.py | sorts/merge_sort_fastest.py | sorts/merge_sort_fastest.py | Python | 0.999998 | @@ -0,0 +1,500 @@
+'''%0APython implementation of merge sort algorithm.%0ATakes an average of 0.6 microseconds to sort a list of length 1000 items.%0ABest Case Scenario : O(n)%0AWorst Case Scenario : O(n)%0A'''%0Adef merge_sort(LIST):%0A start = %5B%5D%0A end = %5B%5D%0A a = LIST%5B0%5D%0A b = LIST%5B-1%5D%... | |
ec5337dc7d8fe4f642447e9b438818b61cdc74c2 | call docker logs on context.failed=true | openchain/peer/bddtests/environment.py | openchain/peer/bddtests/environment.py |
from steps.bdd_test_util import cli_call
def after_scenario(context, scenario):
if context.failed:
filename = scenario.name.replace(" ", "_")
for containerData in context.compose_containers:
logfile = containerData.containerName + filename
print("********** Test failed. Doc... | Python | 0.000649 | @@ -1,8 +1,26 @@
+%0Aimport subprocess
%0Afrom st
@@ -132,14 +132,23 @@
file
-name =
+_suffix = %22_%22 +
sce
@@ -175,16 +175,25 @@
%22, %22_%22)
+ + %22.log%22
%0A
@@ -258,18 +258,18 @@
-logfile =
+with open(
cont
@@ -302,108 +302,306 @@
file
-name%0A print(%22********** Test failed. ... |
03c0b3e679e08f857a78479d73b5335ed2af46f0 | Create InputDataIO.py | InputDataIO.py | InputDataIO.py | Python | 0.000006 | @@ -0,0 +1,737 @@
+import win32api, win32con%0Aimport actionFunctions%0A%0A#Write Function for AI%0A#Text format:%0A# %5Bgoodness number%5D %5Bdistance from ground%5D %5Bdistance from pipe%5D%0A#returns a list of the last iteration's input values%0A%0A%0Adef writeToFile(goodness, distFromGround, distFromPipe)%0A out... | |
e63b4b62cd5cd957da11e6c23bac1844d2a414a3 | Create main.py | pomodor/main.py | pomodor/main.py | Python | 0.000001 | @@ -0,0 +1,409 @@
+#!/usr/bin/env python%0A__version__ = '0.0.1'%0A__name__ = 'pomodoro'%0Aimport click%0Aimport progressbar%0Aimport time%0A%0A@click.command()%0A@click.option('--minutes', default=25, help='Number of minutes, default 25.')%0Adef pomodoro(minutes):%0A bar = progressbar.ProgressBar(widgets=%5B%0A ... | |
5d7c18219dfe3595a07901e7e56f69068ef7d586 | add vectorization example | examples/vectorization.py | examples/vectorization.py | Python | 0 | @@ -0,0 +1,2729 @@
+# Copyright 2014, 2015 The ODL development group%0A#%0A# This file is part of ODL.%0A#%0A# ODL is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU General Public License as published by%0A# the Free Software Foundation, either version 3 of the License, or%0A# (a... | |
e40ddb72243faaf5a754537ea11d0393b02b27f2 | Create rest-mqtt.py | rest-mqtt.py | rest-mqtt.py | Python | 0 | @@ -0,0 +1,1557 @@
+# Title: Script to catch rest calls for home automation and forward to MQTT (rest-mqtt)%0A# Author: Dr. Asif Rana (aiqbalrana@gmail.com)%0A# Date: 20160525%0A%0Afrom flask import Flask%0Afrom flask import request%0Afrom flask_restful import Resource, Api%0Aimport paho.mqtt.publish as publish%0Aimpor... | |
785e37a65ee8bc311326e3c2db90a273858a345c | Prepare for rally-openstack package | rally/plugins/__init__.py | rally/plugins/__init__.py | # Copyright 2015: Mirantis 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 b... | Python | 0 | @@ -998,16 +998,325 @@
.plugins
+.common%22)%0A try:%0A import rally_openstack # noqa%0A except ImportError:%0A # print warnings when rally_openstack will be released%0A discover.import_modules_from_package(%22rally.plugins.openstack%22)%0A discover.import_mod... |
263d183c73f45efe780dc5bc97bf680e43509351 | List question | Sketches/MPS/List/HelloWorldServer/HelloWorldServer.py | Sketches/MPS/List/HelloWorldServer/HelloWorldServer.py | Python | 0.999958 | @@ -0,0 +1,480 @@
+#!/usr/bin/python%0A%0Aimport Axon%0Afrom Kamaelia.Chassis.ConnectedServer import FastRestartServer%0A%0Aclass HelloWorld(Axon.Component.component):%0A def main(self):%0A self.send(%22Hello %22, %22outbox%22)%0A self.send(%22World%22, %22outbox%22)%0A self.send(%22%5Cr%5... | |
d31528540950cd8b5e8a398b50bc59ea98271d26 | Create overlay.py | client/opencv/pic_on_pic/overlay.py | client/opencv/pic_on_pic/overlay.py | Python | 0.000001 | @@ -0,0 +1,784 @@
+import cv2%0Aimport numpy as np%0A%0A# Load two images%0Aimg1 = cv2.imread('1.jpg')%0Aimg2 = cv2.imread('2.png')%0A%0A# I want to put logo on top-left corner, So I create a ROI%0Arows,cols,channels = img2.shape%0Aroi = img1%5B0:rows, 0:cols %5D%0A%0A# Now create a mask of logo and create its inverse ... | |
74ffdab0c54f332b8787aea04582ee7312a34b4c | Remove control_id column from assessments table | src/ggrc/migrations/versions/20161123124848_1f5c3e0025da_remove_control_id_column_from_.py | src/ggrc/migrations/versions/20161123124848_1f5c3e0025da_remove_control_id_column_from_.py | Python | 0.000001 | @@ -0,0 +1,2424 @@
+# Copyright (C) 2016 Google Inc.%0A# Licensed under http://www.apache.org/licenses/LICENSE-2.0 %3Csee LICENSE file%3E%0A%0A%22%22%22%0ARemove control_id column from assessments table%0A%0ACreate Date: 2016-11-23 12:48:48.942528%0A%22%22%22%0A# disable Invalid constant name pylint warning for mandato... | |
7a6fd0ca5951bc1134fd0ac5b0cdbbb9b94fb3d4 | add palindrome exercise | exercises/IsPalindrome.py | exercises/IsPalindrome.py | Python | 0.99996 | @@ -0,0 +1,1258 @@
+description = r%22%22%22%0A(Exercise 3.1.13)%0AA %3Ci%3Epalindrome%3C/i%3E is a string that reads the same forwards or backwards,%0Alike %3Ctt%3E%22RADAR%22%3C/tt%3E or %3Ctt%3E%22STOOTS%22%3C/tt%3E.%0ADefine a method %3Ctt%3EisPalindrome%3C/tt%3E %0Athat takes as input a string and returns true if ... | |
79d6958670090f052ee0a1b1150364618838ff5e | add dev example settings file | {{cookiecutter.repo_name}}/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/settings/dev_example.py | {{cookiecutter.repo_name}}/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/settings/dev_example.py | Python | 0 | @@ -0,0 +1,366 @@
+import os%0A%0Afrom .base import *%0A%0A%0ADEBUG = True%0AALLOWED_HOSTS = %5B'*'%5D%0ADEV = DEBUG%0A%0AINSTALLED_APPS += ('debug_toolbar',)%0A%0ADATABASES = %7B%0A 'default': %7B%0A 'ENGINE': 'django.db.backends.sqlite3',%0A 'NAME': 'arwoad.db',%0A %7D%0A%7D%0A%0ASECRET_KEY = 'dev... | |
ea0e181659f328198955b07252d09ad2e3da0e42 | change name of setupTS | setupTS.py | setupTS.py | Python | 0.000006 | @@ -0,0 +1,602 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22%0A Setup file for timeseries.%0A%0A This file was generated with PyScaffold 2.5.6, a tool that easily%0A puts up a scaffold for your new Python project. Learn more under:%0A http://pyscaffold.readthedocs.org/%0A%22%22%22%0A%0Aimp... | |
92d520127e01369be10f777d85e6021a023dec7d | Create scraper.py | scraper.py | scraper.py | Python | 0.000004 | @@ -0,0 +1,144 @@
+#modocDB/scraper.py%0A#Scrapes the offender web search library for offender data%0A%0Aclass Scraper:%0A%09def __init__(self):%0A%09%09pass%0A%0AdataSet = Scraper()%0A
| |
809acb9fd29b0834745571c21f128d02932bc118 | Add bgr2hsv. | bgr2hsv.py | bgr2hsv.py | Python | 0 | @@ -0,0 +1,507 @@
+import cv2%0Aimport numpy%0Aimport sys%0A%0A%0AbgrColor = None%0A%0A# Get user supplied values%0Aif len(sys.argv) != 3:%0A print(%22%22%22%0A Usage:%0A python bgr2hsv.py -rgb 0,255,0%0A%0A Output:%0A OpenCV HSV: %5B60, 255, 255%5D%0A %22%22%22)%0A sys.exit()%0A%0A... | |
21f248d3fc90a604cd85283c48e339784e6ea523 | add command line interface | topik/cli.py | topik/cli.py | Python | 0.000003 | @@ -0,0 +1,3119 @@
+from __future__ import absolute_import%0A%0Aimport os%0A%0Afrom topik.readers import iter_document_json_stream, iter_documents_folder%0Afrom topik.tokenizers import (SimpleTokenizer, CollocationsTokenizer,%0A EntitiesTokenizer, MixedTokenizer)%0A%0Afrom topik.vectorize... | |
316ec13f041bc8b928ba7bb1253c0242ed2b5579 | Add example test script | example.py | example.py | Python | 0.000001 | @@ -0,0 +1,2351 @@
+#!/usr/bin/env python%0D%0Afrom __future__ import division, absolute_import, print_function, unicode_literals%0D%0Aimport secretsocks%0D%0Aimport socket%0D%0Aimport Queue%0D%0Aimport threading%0D%0A%0D%0Aclass Client(secretsocks.Client):%0D%0A def __init__(self, ip, port):%0D%0A secretsock... | |
d7f24713ad5b8372f5c5aacac252521d2dbbe192 | Add ui version | openspending/ui/__init__.py | openspending/ui/__init__.py | Python | 0 | @@ -0,0 +1,19 @@
+__version__ = '0.8'
| |
c41212807781af2c4f6078bbb1bb047591c0923a | Create tweet_basic.py | Automation/tweet_basic.py | Automation/tweet_basic.py | Python | 0.002536 | @@ -0,0 +1,865 @@
+from selenium import webdriver%0Afrom getpass import getpass%0Afrom time import sleep%0A%0Ausr = input('Enter your username or email : ')%0Apwd = getpass('Enter your password : ')%0Amsg = input('Enter your tweet : ')%0A%0Adriver = webdriver.Chrome()%0Adriver.get('https://twitter.com/login')%0A%0Ausr_... | |
30307988ba8a79fc97b42cc1b4fca8cc4521d363 | remove unused imports | corehq/apps/app_manager/detail_screen.py | corehq/apps/app_manager/detail_screen.py | from corehq.apps.app_manager import suite_xml as sx, xform
from corehq.apps.app_manager.xform import SESSION_CASE_ID, CaseXPath
def get_column_generator(app, module, detail, column):
return get_class_for_format(column.format)(app, module, detail, column)
def get_class_for_format(slug):
return get_class_for_fo... | Python | 0.000001 | @@ -48,84 +48,8 @@
s sx
-, xform%0Afrom corehq.apps.app_manager.xform import SESSION_CASE_ID, CaseXPath
%0A%0Ade
|
83515e8e4c354a68e317f6ba9f97c9ca73e0850c | Add Henon plot | fractals/iterate-henon.py | fractals/iterate-henon.py | Python | 0.000001 | @@ -0,0 +1,259 @@
+import matplotlib.pyplot as plt%0A%0Axvalues = %5B%5D%0Ayvalues = %5B%5D%0Ax = 1.12%0Ay = 0.09%0A%0Afor i in range(10):%0A xvalues.append(x)%0A yvalues.append(y)%0A print(x, y)%0A x, y = y+1-1.4*x*x, 0.3*x%0A%0Aplt.plot(xvalues, yvalues)%0Aplt.plot(xvalues, yvalues, 'bo')%0Aplt.show()
| |
fe4e5b0eba9d1064ce17cc5b8e7c64271969f2a9 | add initial migration for core app | credentials/apps/core/migrations/0001_initial.py | credentials/apps/core/migrations/0001_initial.py | Python | 0 | @@ -0,0 +1,2991 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport django.utils.timezone%0Aimport django.core.validators%0Aimport django.contrib.auth.models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('au... | |
5444920a3447be65592e14d26aba0ef6d257f6cb | Create rename_images.py | rename_images.py | rename_images.py | Python | 0.000002 | @@ -0,0 +1,580 @@
+#!/usr/bin/env python%0A%0Aimport os%0Arootdir = os.getcwd()%0Afor root, dirs, files in os.walk(rootdir):%0A%09for directory in dirs:%0A%09%09workingdir = os.path.join(root, directory)%0A%09%09contents = os.listdir(workingdir)%0A%09%09if '*.jpg' or '*.JPG' in contents:%0A%09%09%09count = 1%0A%09%09%0... | |
206eeb3c9ef3df1e2f7c4f7b2e3c2a002e642375 | Fix tab/spaces issue | simpleLogger.py | simpleLogger.py | Python | 0 | @@ -0,0 +1,2056 @@
+from colorama import init, Fore, Back%0A# Local imports %0Aimport formatter%0A%0Ainit(autoreset=True)%0Aclass SimpleLogger:%0A %22%22%22 Class Used to log messages to the terminal %22%22%22%0A @staticmethod%0A def init(verboseLoggingEnabled):%0A %22%22%22 Initialize the logger with t... | |
7df3c2e6bc328557b5e1613dfeeaf30aa4f58b8c | Correct validation logic in notification settings | src/sentry/web/frontend/accounts.py | src/sentry/web/frontend/accounts.py | """
sentry.web.frontend.accounts
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from crispy_forms.helper import FormHelper
from django.conf import settings as dj_settings
from django.contrib import messages
from djan... | Python | 0 | @@ -5261,11 +5261,8 @@
or f
-, h
in
|
df499f540be02b7ce1b241d006d1260ea7327c37 | Check user permissions in view for task and project | web/views.py | web/views.py | from django.template import RequestContext
from django.shortcuts import render_to_response, render, get_object_or_404, redirect
from django.contrib.auth import logout as auth_logout
from django.contrib.auth.decorators import login_required
from api.models import UserProfile, Project, Task, Event
from .form import Use... | Python | 0 | @@ -232,16 +232,79 @@
required
+%0Afrom django.contrib.auth.decorators import permission_required
%0A%0Afrom a
@@ -1866,28 +1866,33 @@
sk_list%7D)%0A%0A@
-logi
+permissio
n_required%0Ad
@@ -1881,32 +1881,72 @@
mission_required
+('api.change_task', login_url='/login/')
%0Adef task_edit(r
@@ -2430,28 +2430,33 @@
'... |
2178c706dc583c9a2325de7a9ca87a7ea9cb088b | Add start td_agent step | dbaas/workflow/steps/util/region_migration/td_agent.py | dbaas/workflow/steps/util/region_migration/td_agent.py | Python | 0.000002 | @@ -0,0 +1,2327 @@
+# -*- coding: utf-8 -*-%0Aimport logging%0Afrom util import full_stack%0Afrom util import exec_remote_command%0Afrom util import build_context_script%0Afrom dbaas_cloudstack.models import HostAttr as CS_HostAttr%0Afrom workflow.steps.util.base import BaseStep%0Afrom workflow.steps.util import test_b... | |
25802ed351018958fecf0808f70265d678709ce6 | Create 3longestWord.py | 3longestWord.py | 3longestWord.py | Python | 0.999998 | @@ -0,0 +1,255 @@
+#Finds the longest word in a string%0A%0A#1. Split the string by space using .split()%0A#2. using max function to find the biggest using the length as the criteria%0Adef LongestWord(sen): %0A return max(sen.split(), key=len)%0A %0Aprint LongestWord(raw_input())%0A
| |
164f01c8a44c48486b3a2d161ac219e11c1a69e0 | Add check-version command | dodo_commands/extra/standard_commands/check-version.py | dodo_commands/extra/standard_commands/check-version.py | Python | 0.000003 | @@ -0,0 +1,1183 @@
+%22%22%22Compare configuration version to version in original project config file.%22%22%22%0Afrom . import DodoCommand%0Aimport os%0Aimport sys%0Aimport yaml%0A%0A%0Aclass Command(DodoCommand): # noqa%0A def _get_version(self, config_filename):%0A with open(config_filename) as f:%0A ... | |
35d3f38a9450c06212a4eceb93bfb890806d7f3e | Create Longest_Valid_Parentheses.py | Longest_Valid_Parentheses.py | Longest_Valid_Parentheses.py | Python | 0.000222 | @@ -0,0 +1,1378 @@
+class Solution(object):%0A def longestValidParentheses(self, s):%0A %22%22%22%0A :type s: str%0A :rtype: int%0A %22%22%22%0A stack = %5B%5D%0A ret = 0%0A last = -1%0A %0A for i in range(len(s)):%0A if s%5Bi%5D == '(': %0A ... | |
da91ec5e931f798fd263563846dd440f76617409 | fix issue #63. thanks! | gunicorn/workers/async.py | gunicorn/workers/async.py | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import errno
import socket
import traceback
import gunicorn.http as http
import gunicorn.http.wsgi as wsgi
import gunicorn.util as util
import gunicorn.workers.base as base
ALREADY_HANDLED ... | Python | 0 | @@ -122,16 +122,55 @@
ation.%0A%0A
+from __future__ import with_statement%0A%0A
import e
|
372bd768acae6fbf425271b193d1734e5001c71a | Add initial working solution 4 | 4/Solution.py | 4/Solution.py | Python | 0.000014 | @@ -0,0 +1,559 @@
+class Solution(object):%0A def findMedianSortedArrays(self, nums1, nums2):%0A %22%22%22%0A :type nums1: List%5Bint%5D%0A :type nums2: List%5Bint%5D%0A :rtype: float%0A %22%22%22%0A nums1.extend(nums2)%0A merged = sorted(nums1)%0A%0A length = ... | |
84769e0cf76f750e7b8c5315a937d881b097d969 | Add binding.gyp file for building the module with node-gyp. Should be used for nodejs v0.7 and v0.8 or so. | binding.gyp | binding.gyp | Python | 0 | @@ -0,0 +1,344 @@
+%7B%0A%09'targets' : %5B%0A%09%09%7B%0A%09%09%09'target_name' : 'odbc_bindings',%0A%09%09%09'sources' : %5B %0A%09%09%09%09'src/Database.cpp' %0A%09%09%09%5D,%0A%09%09%09'libraries' : %5B %0A%09%09%09%09'-lodbc' %0A%09%09%09%5D,%0A%09%09%09'include_dirs' : %5B%0A%09%09%09%09'/usr/local/lib', %0A%09%0... | |
2f0d186ef1a0b63e4c66ecd9e63cd1d02c73ecf8 | Create LeetCode-SummaryRanges.py | LeetCode-SummaryRanges.py | LeetCode-SummaryRanges.py | Python | 0 | @@ -0,0 +1,709 @@
+%22%22%22%0AGiven a sorted integer array without duplicates, return the summary of its ranges.%0AFor example, given %5B0,1,2,4,5,7%5D, return %5B%220-%3E2%22,%224-%3E5%22,%227%22%5D. %0A%22%22%22%0A%0Aclass Solution(object):%0A def summaryRanges(self, nums):%0A %22%22%22%0A :type num... | |
5013a7dfc3297a5f8d6f6d7107f0839f5b12d150 | Update network-delay-time.py | Python/network-delay-time.py | Python/network-delay-time.py | # Time: O((|E| + |V|) * log|V|)
# Space: O(|E| + |V|)
# Dijkstra's algorithm
class Solution(object):
def networkDelayTime(self, times, N, K):
"""
:type times: List[List[int]]
:type N: int
:type K: int
:rtype: int
"""
min_heap = []
adj = [[] for _ in ... | Python | 0.000002 | @@ -268,30 +268,8 @@
%22%22%22%0A
- min_heap = %5B%5D%0A
@@ -302,16 +302,16 @@
nge(N)%5D%0A
+
@@ -370,16 +370,47 @@
-1, w))%0A
+ %0A result = 0
%0A
@@ -420,24 +420,16 @@
okup
-, result
= set()
, 0%0A
@@ -428,11 +428,8 @@
et()
-, 0
%0A
@@ -433,39 +433,24 @@
... |
e00cc32b2cea8d95e5178336c4a296e09abb6dba | Remove local testing secret from settings.py | server/server/settings.py | server/server/settings.py | """
Django settings for server project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | Python | 0 | @@ -682,58 +682,8 @@
= '
-#pd41av)c)o@djbn!*jnhc0lv(&)xm359aysp4r*$qx_v2u!c0
'%0A%0A#
|
9532664cabae175aed73355d79f62f2326e2a9ef | add flask as server in react | react/s.py | react/s.py | Python | 0 | @@ -0,0 +1,574 @@
+from flask import Flask%0Aimport os%0A%0Aapp = Flask(__name__, static_url_path='', static_folder='')%0A%0A%0Adef serve_dir(path):%0A h = %22%3Chtml%3E%5Cn%22%0A h = h + %22%3Cul%3E%5Cn%22%0A for entry in os.scandir(path):%0A a = %22%3Cli%3E%3Ca href='%7B0%7D/%7B1%7D'%3E%7B1%7D%3C/a%3E... | |
b66ad576230fb7c96a8f5c6c7b6af8a8e4c8d0b5 | Add module for Source Engine game logic entities | vmf/games/source.py | vmf/games/source.py | Python | 0 | @@ -0,0 +1,393 @@
+%22%22%22%0A%0AHelper classes for creating maps in any Source Engine game.%0A%0A%22%22%22%0A%0Afrom vmf.vmf import Entity%0Afrom vmf.types import Origin%0A%0Aclass LogicAuto(Entity):%0A%0A %22%22%22Sets up certain game logic. Fires some useful map events.%0A %0A https://developer.valvesoftwa... | |
688a9ab3bcc8312d88014ed93177c0b9d75f88cc | Create minimum_partition.py | dynamic_programming/minimum_partition.py | dynamic_programming/minimum_partition.py | Python | 0.999999 | @@ -0,0 +1,620 @@
+%22%22%22%0APartition a set into two subsets such that the difference of subset sums is minimum%0A%22%22%22%0Adef findMin(arr):%0A n = len(arr)%0A s = sum(arr)%0A%0A dp = %5B%5BFalse for x in range(s+1)%5Dfor y in range(n+1)%5D%0A%0A for i in range(1, n+1):%0A dp%5Bi%5D%5B0%5D = Tr... | |
a198ab95fe34f368f8a579ec5e4c8fb7ef27c9c5 | Solve non abundant sums | project_euler/023.non_abundant_sums.py | project_euler/023.non_abundant_sums.py | Python | 0.999999 | @@ -0,0 +1,2794 @@
+'''%0AProblem 023%0A%0AA perfect number is a number for which the sum of its proper divisors is exactly%0A equal to the number. For example, the sum of the proper divisors of 28 would %0A be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.%0A%0AA number n is called deficient if ... | |
b18cf437f499ee8ebe536779883d05518a69c00f | Fix conflicting migrations | accelerator/migrations/0100_update_program_model.py | accelerator/migrations/0100_update_program_model.py | Python | 0.000003 | @@ -0,0 +1,951 @@
+# Generated by Django 2.2.28 on 2022-04-20 13:05%0A%0Aimport sorl.thumbnail.fields%0Afrom django.db import (%0A migrations,%0A models,%0A)%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A%3C%3C%3C%3C%3C%3C%3C HEAD:accelerator/migrations/0101_update_program_model.py%... | |
d3fceb049ac2c3278bdf65d0d465bf47776e9ae8 | Placeholder entity | gludb/annotations.py | gludb/annotations.py | Python | 0.999992 | @@ -0,0 +1,209 @@
+from functools import wraps%0A%0A# TODO: this is just a single object for package testing%0A# it will change when we actually decide on a namespace%0Adef DataObject(f):%0A # TODO: actual work%0A return f%0A %0A
| |
7d60876f2b1152fbe92ba90ec0fa9e2acfb05af2 | fix InMoov launching button | src/main/resources/resource/Intro/InMoov01_start.py | src/main/resources/resource/Intro/InMoov01_start.py | Python | 0 | @@ -0,0 +1,275 @@
+#########################################%0A# InMoov01_start.py%0A# categories: inmoov%0A# more info @: http://myrobotlab.org/service/InMoov%0A#########################################%0A# uncomment for virtual hardware%0A# Platform.setVirtual(True)%0Ai01 = Runtime.start('i01', 'InMoov2')
| |
8f2ec9462b038704d00f85b706cfb34a19eac974 | add weekly backup job | etc/weekly_backup.py | etc/weekly_backup.py | Python | 0.000001 | @@ -0,0 +1,870 @@
+#!/usr/bin/env python%0A%0Afrom datetime import datetime%0Aimport os.path%0Aimport sys%0A%0A%0Adef day_abbrev():%0A return datetime.now().strftime('%25Y%25m%25d').lower()%0A%0Adef warn(txt):%0A print %3E%3E sys.stderr, %22WARNING: %25s!%22 %25 txt%0A os.system(%22%22%22echo %22At %25s: %25s%... | |
4761b92bc058c49b696757580212a599e4a22bed | update 26 ott 2016 | realmain.py | realmain.py | Python | 0 | @@ -0,0 +1,2994 @@
+# Micropython Http Server%0A# Erni Tron ernitron@gmail.com%0A# Copyright (c) 2016%0A%0Aimport time%0Aimport network%0Aimport gc%0Aimport machine%0A%0Afrom config import read_config, get_config, set_config, save_config%0A%0Adevelopment = True%0A%0Adef do_connect(ssid, pwd):%0A sta_if = network.WLA... | |
69df0819456c45bcac8ace28cfd3f294795ae726 | Create ATM.py | src/ATM.py | src/ATM.py | Python | 0.000973 | @@ -0,0 +1,3028 @@
+# Copyright 2014 Rico Antonio Felix%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 ... | |
6616d17a534ff2cf0dbdeb9f138d4ef09bf8d03d | update app.config | run_all.py | run_all.py | Python | 0.000002 | @@ -0,0 +1,369 @@
+def func(self):%0A%09import sys, os%0A%09import py_compile%0A%09if os.environ%5B'EXECUTOR'%5D != %22docker%22:%0A%09%09sys.path.append(%22/home/philipsahli/workspace/httptest/app%22)%0A%09%09py_compile.compile(%22/home/philipsahli/workspace/httptest/app/run_all.py%22, doraise=True)%0A%09%09import ru... | |
de4359d228b47a4da87c0f79603373b916ff9464 | Add migration from other branch | temba/flows/migrations/0083_populate_recent_msgs.py | temba/flows/migrations/0083_populate_recent_msgs.py | Python | 0 | @@ -0,0 +1,2854 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.5 on 2017-01-11 09:46%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Adef old_recent_messages_lookup(FlowStep, step_uuid, rule_uuid, next_uuid):%0A %22%22%22%0A The old way of looking up recent message... | |
3c3fa723b23d6e93dfe7299c7d9ef38c182e9f71 | change model adding linkman | app/models.py | app/models.py | # -*- coding:utf8 -*-
# Author: shizhenyu96@gamil.com
# github: https://github.com/imndszy
import hashlib
from werkzeug.security import generate_password_hash, check_password_hash
from flask import current_app, request, url_for
from flask_login import UserMixin
from app import db,login_manager
fa_user = db.Table('fa_... | Python | 0 | @@ -2597,32 +2597,130 @@
teger) #%E6%B4%BB%E5%8A%A8%E6%9C%9F%E6%95%B0%0A
+ linkman = db.Column(db.String(16)) #%E8%81%94%E7%B3%BB%E4%BA%BA%EF%BC%88%E6%9C%89%E5%AD%97%E9%95%BF%E9%99%90%E5%88%B6%EF%BC%89%0A contact = db.Column(db.String(16)) #%E8%81%94%E7%B3%BB%E6%96%B9%E5%BC%8F%0A
users = db.r
@@ -3363,... |
a32b4216b98fb2bb23d8a0a700d05bd417df1906 | Implement main function | useless_passport_validator/umain.py | useless_passport_validator/umain.py | Python | 0.999999 | @@ -0,0 +1,381 @@
+#!/usr/bin/python3.4%0Aimport ulibrary%0Aimport sys%0Afrom uwindow import UWindow%0Afrom gi.repository import Gtk%0A%0A%0Aclass Usage(Exception):%0A def __init__(self, msg):%0A self.msg = msg%0A%0A%0Adef main():%0A ulibrary.init()%0A%0A uwindow = UWindow()%0A uwindow.connect(%22del... | |
845a74ca5475aa8121733ab92d4e1141e62d39a1 | rename error to result error. | testcube/core/migrations/0006_auto_20170610_0526.py | testcube/core/migrations/0006_auto_20170610_0526.py | Python | 0 | @@ -0,0 +1,401 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.1 on 2017-06-10 05:26%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A dependencies = %5B%0A ('core', '0005_auto_20170610_0506'),%0A %5D%0A%0A operatio... | |
a9388f7d4c4747e6710d20d618b57f19360cb69c | Add remove vlan compliance test | tests/adapters/compliance_tests/remove_vlan_test.py | tests/adapters/compliance_tests/remove_vlan_test.py | Python | 0 | @@ -0,0 +1,1609 @@
+# Copyright 2019 Internap.%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 ap... | |
b9ba0f23b4e9efdc2c6158ce2047f5e4cc73f9b5 | Add conftest.py to ignore top-level stuff | conftest.py | conftest.py | Python | 0 | @@ -0,0 +1,95 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A%0Acollect_ignore = %5B%22setup.py%22, %22.pythonrc.py%22%5D%0A
| |
63326149ba56677f2fbcfc6e875819d0b2ddf5de | Create sqlsync.py | sqlsync.py | sqlsync.py | Python | 0.001791 | @@ -0,0 +1,1724 @@
+import MySQLdb as db%0A%0AHOST = %22%22%0APORT = %0AUSER = %22%22%0APASSWORD = %22%22%0ADB = %22%22%0A%0Adef post_file (path, filename):%0A%0A try:%0A conn = db.Connection(host=HOST, port=PORT, user=USER, passwd=PASSWORD, db=DB)%0A dbhandler = conn.cursor(db.cursors.DictCursor)%0A sql = (%... | |
03e1a4d988650196f698623da8d84070f9ace47d | Create ModisLADSFTP.py | ModisLADSFTP.py | ModisLADSFTP.py | Python | 0 | @@ -0,0 +1,2552 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Tue Apr 4 13:02:35 2017%0A@author: Tom%C3%A1s Acu%C3%B1a y Italo Moletto%0Amail: tomasacuna@ug.uchile.cl%0AModified from : http://www.science-emergence.com/Codes/Download-a-file-of-MODIS-MYD08-M3-from-ladsftp-using-python/%0A%22%22%22%0A%0Afrom ftpli... | |
d0c3e0901cbb1c89477ec081a5dce0d3a12f8df8 | add test runner script for local development | runtests.py | runtests.py | Python | 0 | @@ -0,0 +1,808 @@
+#!/usr/bin/env nix-shell%0A#! nix-shell -i python3 -p python3Packages.pyyaml%0A%22%22%22Run the tests in the circleci config, for local dev.%22%22%22%0Afrom os.path import dirname, join%0Afrom subprocess import call%0Aimport yaml%0A%0Awith open(join(dirname(__file__), %22.circleci%22, %22config.yml%2... | |
e86c3137d2c42f7440bc2d3e1171e9d0609f962c | move bs4 import to run to avoid unnecessary ImportErrors | i3pystatus/parcel.py | i3pystatus/parcel.py | from urllib.request import urlopen
import webbrowser
import lxml.html
from lxml.cssselect import CSSSelector
from bs4 import BeautifulSoup as BS
from i3pystatus import IntervalModule
from i3pystatus.core.util import internet, require
class TrackerAPI:
def __init__(self, idcode):
pass
def status(sel... | Python | 0 | @@ -106,44 +106,8 @@
ctor
-%0Afrom bs4 import BeautifulSoup as BS
%0A%0Afr
@@ -3822,16 +3822,64 @@
try:%0A
+ from bs4 import BeautifulSoup as BS%0A
|
3361cf94d06bdc3a207caa490c7ce2e43cc5795f | Add 136-single-number.py | 136-single-number.py | 136-single-number.py | Python | 0.999995 | @@ -0,0 +1,853 @@
+%22%22%22%0AQuestion:%0A Single Number%0A%0A Given an array of integers, every element appears twice except for one. Find that single one.%0A%0A Note:%0A Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?%0A%0APerformance:%0A 1. T... | |
fd4d754a1621c8399c3992ba49124c2a3d40ed89 | Make SmartDict an attrdict | src/python/m5/util/smartdict.py | src/python/m5/util/smartdict.py | # Copyright (c) 2005 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list ... | Python | 0.000325 | @@ -2268,16 +2268,46 @@
import *
+%0Afrom attrdict import attrdict
%0A%0Aclass
@@ -4476,16 +4476,20 @@
artDict(
+attr
dict):%0A
|
c8c026cb1f0d19a928671dd80e7a9664d13507c6 | add leetcode Binary Tree Preorder Traversal | leetcode/BinaryTreePreorderTraversal/solution.py | leetcode/BinaryTreePreorderTraversal/solution.py | Python | 0.000001 | @@ -0,0 +1,586 @@
+# -*- coding:utf-8 -*-%0A# Definition for a binary tree node%0A# class TreeNode:%0A# def __init__(self, x):%0A# self.val = x%0A# self.left = None%0A# self.right = None%0A%0A%0Aclass Solution:%0A # @param root, a tree node%0A # @return a list of integers%0A def pr... | |
19f58aca5dbfbdd6e47cca5927df51dc8904371c | Add mocked up settings | settings.py | settings.py | Python | 0.000001 | @@ -0,0 +1,1492 @@
+#!/usr/bin/env python%0A# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8%0A%0ASECRET_KEY = 'this is not a secret key'%0A%0AINSTALLED_APPS = (%0A 'couchdbkit.ext.django',%0A 'couchforms',%0A 'coverage'%0A)%0A%0ADATABASES = %7B%0A 'default': %7B%0A 'ENGINE': 'django.db.backends.sqlite3',... | |
158e4df1738ab1b1e104ee50a93cb829ed868374 | Create tutorial2.py | tutorial2.py | tutorial2.py | Python | 0 | @@ -0,0 +1,445 @@
+from ggame import App, Color, LineStyle, Sprite%0Afrom ggame import CircleAsset%0A%0Ared = Color(0xff0000, 1.0)%0Agreen = Color(0x00ff00, 1.0)%0Ablue = Color(0x0000ff, 1.0)%0Ablack = Color(0x000000, 1.0)%0A%0Athinline = LineStyle(1, black)%0Amycircle = CircleAsset(5, thinline, blue)%0Axcoordinates = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.