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 |
|---|---|---|---|---|---|---|---|
0fa30986e1f97331f96444e0b3b0f86cbe20c68a | Add tests for JsonBackend __init__ and commit methods | shadho/backend/json/tests/test_db.py | shadho/backend/json/tests/test_db.py | Python | 0.000002 | @@ -0,0 +1,2158 @@
+import pytest%0A%0Afrom shadho.backend.base.tests.test_db import TestBaseBackend%0Afrom shadho.backend.json.db import JsonBackend%0A%0Aimport json%0Aimport os%0Aimport shutil%0A%0A%0Aclass TestJsonBackend(object):%0A%0A def test_init(self):%0A %22%22%22Ensure that initialization sets up th... | |
871f79a0b2bd235df457e3a1dc502d5c18bd934a | Add some generic python utilities as a basis for scripts | tools/build/common_utils.py | tools/build/common_utils.py | Python | 0.000001 | @@ -0,0 +1,1678 @@
+from __future__ import print_function%0A%0Aimport os%0A%0Adef game_root_path():%0A file_path = os.path.dirname(os.path.abspath(__file__))%0A return os.path.abspath(os.path.join(file_path, '..', '..'))%0A%0Adef files_with_type(root, type):%0A all_files = %5Bos.path.join(root, filename) for f... | |
7d22c38348ccd411871942ef0dd43ed57794de16 | include benchmark code | bench.py | bench.py | Python | 0.000001 | @@ -0,0 +1,1383 @@
+from statistics import mean%0Aimport heapq%0Aimport importlib%0Aimport time%0A%0Aimport numpy as np%0A%0A%0Ar = np.random.random(1000*1000)%0A%0A%0Amergers = %7B%0A 'heapq': ('merge', 'nlargest', 'nsmallest'),%0A 'cyheapq': ('merge', 'nlargest', 'nsmallest'),%0A 'cytoolz': ('merge_sorted', ... | |
5b2aebb9b9f9fafe291f0890f03c44abd661ca68 | add celery_work | celery_work.py | celery_work.py | Python | 0.999978 | @@ -0,0 +1,1330 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport os%0Afrom celery import Celery, platforms%0Afrom app import create_app%0A%0A%0Adef make_celery(app):%0A %22%22%22Create the celery process.%22%22%22%0A%0A # Init the celery object via app's configuration.%0A celery = Celery(%0A ... | |
771d44902a6b1fddc98e7801b58d718bf1b030b5 | use formatted title so we make sure all browsers will correctly read them | gunicorn/http/request.py | gunicorn/http/request.py | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import logging
import os
import re
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import sys
from urllib import unquote
from gunicorn impo... | Python | 0 | @@ -6415,24 +6415,32 @@
append((name
+.title()
, value.stri
|
caba92d9370a230d561675284979cb888964d9da | split only once | gunicorn/http/request.py | gunicorn/http/request.py | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import logging
import os
import re
import StringIO
import sys
from urllib import unquote
from gunicorn import __version__
from gunicorn.http.parser import Parser
from gunicorn.http.tee impor... | Python | 0.000001 | @@ -4085,16 +4085,19 @@
ipt_name
+, 1
)%5B-1%5D%0A%0A
|
9c53e59ee0c4e5418b54d47c932454b7b907dc03 | Revert escape nickname, desc, etc in user profile | seahub/profile/forms.py | seahub/profile/forms.py | # encoding: utf-8
from django import forms
from django.utils.html import escape
from seahub.profile.models import Profile, DetailedProfile
class ProfileForm(forms.Form):
nickname = forms.CharField(max_length=64, required=False)
intro = forms.CharField(max_length=256, required=False)
def save(self, userna... | Python | 0 | @@ -39,45 +39,8 @@
orms
-%0Afrom django.utils.html import escape
%0A%0Afr
@@ -296,31 +296,24 @@
nickname =
-escape(
self.cleaned
@@ -329,17 +329,16 @@
ckname'%5D
-)
%0A
@@ -346,23 +346,16 @@
intro =
-escape(
self.cle
@@ -372,17 +372,16 @@
'intro'%5D
-)
%0A
@@ -716,23 +716,16 @@
tment =
-esc... |
b23ec502b89ab70b9e8edd1868f4e9717392b7b2 | Add missing migrations | account/migrations/0004_auto_20170416_1821.py | account/migrations/0004_auto_20170416_1821.py | Python | 0.000029 | @@ -0,0 +1,488 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11 on 2017-04-16 18:21%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('account', '0003_passwordexpiry_passwordhistory'),%0A %5D%0... | |
ae94990bc8b790b5307ccaee992f09fefc045692 | add Tester lockedNormal | python/medic/plugins/Tester/lockedNormal.py | python/medic/plugins/Tester/lockedNormal.py | Python | 0 | @@ -0,0 +1,1824 @@
+from medic.core import testerBase%0Afrom maya import OpenMaya%0A%0A%0Aclass LockedNormal(testerBase.TesterBase):%0A Name = %22LockedNormal%22%0A Description = %22vertex(s) which has locked normal%22%0A Fixable = True%0A%0A def __init__(self):%0A super(LockedNormal, self).__init__(... | |
088ec16cf33d4be4b396976d9e9ab1a5f17045fc | make contrib an app | adhocracy4/contrib/apps.py | adhocracy4/contrib/apps.py | Python | 0.000012 | @@ -0,0 +1,130 @@
+from django.apps import AppConfig%0A%0A%0Aclass OrganisationsConfig(AppConfig):%0A name = 'adhocracy4.contrib'%0A label = 'a4contrib'%0A
| |
e020f81593268899a04cce726823c512b8b54762 | copy over the PlotContainerEditor to the more appropriately named and located ComponentEditor. | enthought/enable2/component_editor.py | enthought/enable2/component_editor.py | Python | 0 | @@ -0,0 +1,2645 @@
+%22%22%22 Defines a Traits editor for displaying an Enable component.%0D%0A%22%22%22%0D%0A#-------------------------------------------------------------------------------%0D%0A# Written by: David C. Morrill%0D%0A# Date: 01/26/2007%0D%0A# (c) Copyright 2007 by Enthought, Inc.%0D%0A#---------------... | |
06164dbeb1ec113b24ca25a41e624793d878875f | implement a transferrable voting algorithm | instant_runoff_voting.py | instant_runoff_voting.py | Python | 0 | @@ -0,0 +1,2056 @@
+from collections import defaultdict, Counter%0Adef runoff(voters):%0A %22%22%22%0A a function that calculates an election winner from a list of voter selections using an%0A Instant Runoff Voting algorithm. https://en.wikipedia.org/wiki/Instant-runoff_voting%0A%0A Each voter selects sever... | |
5d6ef1cf969bac9fb53db0224eebdeb4a1bb6ff0 | Update app/exceptions/__init__.py | app/exceptions/__init__.py | app/exceptions/__init__.py | Python | 0 | @@ -0,0 +1,157 @@
+%0Aclass BadConfigurationError(Exception):%0A pass%0A%0A%0Aclass ClientUnavailableError(Exception):%0A pass%0A%0A%0Aclass ClusterNotConfiguredError(Exception):%0A pass%0A
| |
8affeda715b1facf12de1dab1d445bbe54616306 | Fix JSON serialisation problem with AJAX basket | oscar/core/ajax.py | oscar/core/ajax.py | import six
from django.contrib import messages
from six.moves import map
class FlashMessages(object):
"""
Intermediate container for flash messages.
This is useful as, at the time of creating the message, we don't know
whether the response is an AJAX response or not.
"""
def __init__(self):
... | Python | 0 | @@ -1063,12 +1063,9 @@
%5D =
-map(
+%5B
six.
@@ -1077,15 +1077,30 @@
type
-, msgs)
+(msg) for msg in msgs%5D
%0A
|
63d22058d15a11fad7232683630976d472997c33 | Add planetary time recipe | recipes/planetarytime.py | recipes/planetarytime.py | Python | 0.999993 | @@ -0,0 +1,793 @@
+%22%22%22%0A Author: Jo%C3%A3o Ventura %3Cflatangleweb@gmail.com%3E%0A %0A %0A This recipe shows sample code for handling %0A planetary times.%0A%0A%22%22%22%0A%0Afrom flatlib.datetime import Datetime%0Afrom flatlib.geopos import GeoPos%0Afrom flatlib.tools import planetarytime%0A%0A%0... | |
98c863c9d45bdfb328a5e79d0928c8b9694bc753 | Remove redundant import | check_mesos.py | check_mesos.py | #!/usr/bin/env python
import nagiosplugin
import urllib2
import argparse
import logging
import re
INFINITY = float('inf')
HEALTHY = 1
UNHEALTHY = -1
try:
from urllib2 import *
except ImportError:
from urllib.request import *
from urllib.error import HTTPError
try:
import json
except ImportError:
import sim... | Python | 0.001503 | @@ -39,23 +39,8 @@
gin%0A
-import urllib2%0A
impo
|
92c8afbb5131374611fb21b4da0b0af1a2f37a45 | add dummy test | tests/dummy.py | tests/dummy.py | Python | 0.999602 | @@ -0,0 +1,123 @@
+import pytest%0A%0Afrom pyannote.database import get_databases%0A%0Adef test_dummy():%0A assert isinstance(get_databases(), list)%0A
| |
0c8b7fa865df535f5baa33025c184bbf4234b7b1 | Create script to transform shapefile into csv distance matrix | shp_to_csv_distances.py | shp_to_csv_distances.py | Python | 0 | @@ -0,0 +1,1543 @@
+%22%22%22Create a csv matrix of distances between shapefile geometry objects.%0A%0ARequirements: fiona, shapely%0A%0AWritten by: Taylor Denouden%0ADate: November 25, 2015%0A%22%22%22%0A%0Aimport random%0Aimport fiona%0Afrom shapely.geometry import shape%0Afrom scripts.printer import print_progress%0... | |
9a4dd1c0c51cf2732b50d5594b2a4bf661b8262f | Add geoip_lookup.py | geoip_lookup.py | geoip_lookup.py | Python | 0.000027 | @@ -0,0 +1,763 @@
+import sys%0A%0Aif len(sys.argv) %3C 2:%0A print %22%22%22geoip_lookup.py ---%0A %22resolve%22 IP addresses to approximate geo-information%0A%0AUsage:%0A python geoip_lookup.py IP %5B GEOIP_SERVER %5D%0A%0Awhere IP is the address to resolve, and%0AGEOIP_SERVER is an optional GeoIP server to contac... | |
24d1162740aa9a9948665d97dc082a555a1ccf13 | Rename initial_args to standard argv. | grip/command.py | grip/command.py | """\
grip.command
~~~~~~~~~~~~
Implements the command-line interface for Grip.
Usage:
grip [options] [<path>] [<address>]
grip -h | --help
grip --version
Where:
<path> is a file to render or a directory containing a README.md file
<address> is what to listen on, of the form <host>[:<port>], or just <port>... | Python | 0 | @@ -687,28 +687,20 @@
ef main(
-initial_
arg
-s
+v
=None):%0A
@@ -752,28 +752,20 @@
%0A if
-initial_
arg
-s
+v
is None
@@ -774,28 +774,20 @@
-initial_
arg
-s
+v
= sys.a
@@ -885,20 +885,12 @@
rgv=
-initial_
arg
-s
+v
, ve
|
cf357e46b3d9664325ca69f3b7c0393c89ad44a7 | Add some function tests. | tests/test_func.py | tests/test_func.py | Python | 0 | @@ -0,0 +1,770 @@
+from .utils import assert_eval%0A%0A%0Adef test_simple_func():%0A assert_eval('(def @a $a 8) (@a)', 1, 8)%0A%0A%0Adef test_simple_func_args():%0A assert_eval(%0A '(def @a $a $a)'%0A '(@a 1)'%0A '(@a 2)'%0A '(@a 5)',%0A 1,%0A 1,%0A 2,%0A 5)... | |
79f57f27824caa423ff873fdee3a9b8916ed410b | extract speech information for reps | import/parse/speeches.py | import/parse/speeches.py | Python | 0.998676 | @@ -0,0 +1,956 @@
+%22%22%22%0Aparse data from govtrack.us%0A%0Afrom: data/crawl/govtrack/people.xml%0A%22%22%22%0A%0Aimport web%0Afrom xml.sax import make_parser, handler%0A%0Aclass SpeechesXML(handler.ContentHandler):%0A def __init__(self,callback):%0A self.callback = callback%0A self.current = None%... | |
ec6dff24e3049ddaab392f0bc5b8d8b724e41e20 | Print the trending Python repos on GitHub | trending_python.py | trending_python.py | Python | 0.998715 | @@ -0,0 +1,341 @@
+#!/usr/bin/env python3%0A%0Aimport bs4%0Aimport requests%0A%0Aurl = 'https://github.com/trending?l=Python'%0Asoup = bs4.BeautifulSoup(requests.get(url).content, 'lxml') # or 'html5lib'%0Arepos = soup.find('ol', class_=%22repo-list%22).find_all('a', href=True)%0Arepos = (r.text.strip().replace(' ', '... | |
37691851b6e21a6a51140f512fd9802e964b0785 | Create beta_pythons_dynamic_classes_3.py | Solutions/beta/beta_pythons_dynamic_classes_3.py | Solutions/beta/beta_pythons_dynamic_classes_3.py | Python | 0.000067 | @@ -0,0 +1,434 @@
+def create_class(class_name, secrets = None):%0A %0A if not class_name: return None%0A %0A class NewClass(object):%0A pass%0A %0A NewClass.__name__ = class_name%0A %0A if not secrets: return NewClass%0A %0A for i in secrets:%0A if 'function' in str(... | |
32d9a97336c786660a838dc69cfab2ebe3436343 | update viafReconciliationPeople.py | viafReconciliationPeople.py | viafReconciliationPeople.py | Python | 0 | @@ -0,0 +1,2030 @@
+import requests%0Aimport csv%0Afrom fuzzywuzzy import fuzz%0Aimport json%0Aimport urllib%0A%0AbaseURL = 'http://viaf.org/viaf/search/viaf?query=local.personalNames+%253D+%2522'%0Af=csv.writer(open('viafPeopleResults.csv', 'wb'))%0Af.writerow(%5B'search'%5D+%5B'result'%5D+%5B'viaf'%5D+%5B'lc'%5D+%5B'... | |
9d1f8f6bfd59cf2e083276ef095618f8545c5167 | Add test to check packages for Python2.6 compatibility, as well as core. | lib/spack/spack/test/python_version.py | lib/spack/spack/test/python_version.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 | @@ -2155,20 +2155,168 @@
def
-test
+all_package_py_files(self):%0A for name in spack.db.all_package_names():%0A yield spack.db.filename_for_package_name(name)%0A%0A%0A def check
_python_
@@ -2324,24 +2324,31 @@
ersions(self
+, files
):%0A #
@@ -2431,33 +2431,13 @@
in
-self.spack_... |
3ea69c783393b6c62f3428c6ec83a24fe7634b6c | add grader in Python | 8-kyu/grader.py | 8-kyu/grader.py | Python | 0.000128 | @@ -0,0 +1,178 @@
+def grader(score):%0A%09if score %3C 0.6 or score %3E 1:%0A%09%09return 'F'%0A%09elif score %3C 0.7:%0A%09%09return 'D'%0A%09elif score %3C 0.8:%0A%09%09return 'C'%0A%09elif score %3C 0.9:%0A%09%09return 'B'%0A%09else:%0A%09%09return 'A'%0A
| |
37dda1d235017bebb9bb0f6eff150dd12222762f | remove organisation from db | migrations/versions/0162_remove_org.py | migrations/versions/0162_remove_org.py | Python | 0 | @@ -0,0 +1,1812 @@
+%22%22%22%0A%0ARevision ID: 0162_remove_org%0ARevises: 0161_email_branding%0ACreate Date: 2018-02-06 17:08:11.879844%0A%0A%22%22%22%0Afrom alembic import op%0Aimport sqlalchemy as sa%0Afrom sqlalchemy.dialects import postgresql%0A%0Arevision = '0162_remove_org'%0Adown_revision = '0161_email_branding... | |
d1e8a8bb6ffc852bf07c40968029c5def7dc0a96 | Correct the dict | nclxd/nova/virt/lxd/host_utils.py | nclxd/nova/virt/lxd/host_utils.py | # Copyright (c) 2015 Canonical Ltd
#
# 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 ... | Python | 0.999145 | @@ -1190,19 +1190,24 @@
lable':
-fre
+availabl
e,%0A
|
85060c7653a04f18e6f5cd016e113327ba3a2878 | Add support for Sercomm IP camera discovery. (#238) | netdisco/discoverables/sercomm.py | netdisco/discoverables/sercomm.py | Python | 0 | @@ -0,0 +1,492 @@
+%22%22%22%0ADiscover Sercomm network cameras.%0AThese are rebranded as iControl and many others, and are usually%0Adistributed as part of an ADT or Comcast/Xfinity monitoring package.%0Ahttps://github.com/edent/Sercomm-API%0A%22%22%22%0Afrom . import SSDPDiscoverable%0A%0A%0Aclass Discoverable(SSDPDi... | |
1295f2867eb7348959d86618b8e80c001cc41ff7 | Add 'lib' init module. | akhet/paster_templates/akhet/+package+/lib/__init__.py | akhet/paster_templates/akhet/+package+/lib/__init__.py | Python | 0 | @@ -0,0 +1,55 @@
+%22%22%22Miscellaneous support packages for %7B%7Bproject%7D%7D.%0A%22%22%22%0A
| |
c491b9379966e772c0ab4649584a8d5a0773c403 | Update repositoryInstaller.py | scripts/devSetup/repositoryInstaller.py | scripts/devSetup/repositoryInstaller.py | from __future__ import print_function
__author__ = u'schmatz'
import configuration
import errors
import subprocess
import os
import sys
from which import which
#git clone https://github.com/nwinter/codecombat.git coco
class RepositoryInstaller():
def __init__(self,config):
self.config = config
asser... | Python | 0.000001 | @@ -1231,16 +1231,17 @@
stall it
+
(try 'su
|
8fe99eedd4e1a1604277c42ed8f2ea0dc2e622de | add simple csv utility module | mediacloud/mediawords/util/csv.py | mediacloud/mediawords/util/csv.py | Python | 0 | @@ -0,0 +1,659 @@
+%22%22%22Utility functions for dealing with csvs.%22%22%22%0A%0Aimport csv%0Aimport io%0A%0A%0Adef get_csv_string_from_dicts(dicts: list) -%3E str:%0A %22%22%22Given a list of dicts, return a representative csv string.%22%22%22%0A if len(dicts) %3C 1:%0A return ''%0A%0A csvio = io.Str... | |
f6c2d5e37685b149cfd447545c58ce1fc4d836b9 | Add function to create view for Span candidate subclasses | snorkel/models/views.py | snorkel/models/views.py | Python | 0 | @@ -0,0 +1,1313 @@
+%0A%0Adef create_serialized_candidate_view(session, C, verbose=True):%0A %22%22%22Creates a view in the database for a Candidate sub-class C defined over%0A Span contexts, which are direct children of a single sentence.%0A%0A Creates VIEW with schema:%0A candidate.id, candidate.split... | |
135324dd3346f7830abbe64cb5eadf82d1ca963c | add - module for generating data sets. | versus/src/data.py | versus/src/data.py | Python | 0 | @@ -0,0 +1,3205 @@
+%22%22%22%0AModule for loading datasets%0A%22%22%22%0A%0Aimport gzip%0Aimport theano.tensor as T%0Aimport theano%0Aimport numpy%0Aimport cPickle%0Aimport os%0A%0A%0Adef load_MNIST(dataset):%0A ''' Loads the dataset%0A%0A :type dataset: string%0A :param dataset: the path to the dataset (here... | |
9732c401fb51ae0b757be5108835b71e7c389850 | Add tests | django_comments_xtd/tests/test_get_version.py | django_comments_xtd/tests/test_get_version.py | Python | 0.000001 | @@ -0,0 +1,604 @@
+try:%0A from unittest.mock import patch%0Aexcept ImportError:%0A from mock import patch%0A%0Afrom django.test import TestCase%0A%0A%0Aclass GetVersionTestCase(TestCase):%0A%0A @patch('django_comments_xtd.VERSION', (2, 8, 0, 'f', 0))%0A def test_get_version_when_patch_equal_to_zero(self):%... | |
2eb163c5dd675c2e7a9cedb5d6868545833cbf34 | Add lemma rules | spacy/en/lemma_rules.py | spacy/en/lemma_rules.py | Python | 0.000237 | @@ -0,0 +1,702 @@
+# encoding: utf8%0Afrom __future__ import unicode_literals%0A%0A%0ALEMMA_RULES = %7B%0A %22noun%22: %5B%0A %5B%22s%22, %22%22%5D,%0A %5B%22ses%22, %22s%22%5D,%0A %5B%22ves%22, %22f%22%5D,%0A %5B%22xes%22, %22x%22%5D,%0A %5B%22zes%22, %22z%22%5D,%0A %5B%22c... | |
45628f2abd6ec66ad48679732d600174a3a7de26 | add a script | jython/surfaceMapToDs.py | jython/surfaceMapToDs.py | Python | 0.000003 | @@ -0,0 +1,1595 @@
+#!/bin/env jython%0A%0Aimport sys%0Aimport java.io%0Aimport org.gavrog%0A%0A%0Adef dsymbolFromCyclicAdjacencies(adjs):%0A vertexToChamber = %7B%7D%0A edgeToChamber = %7B%7D%0A chamberToVertex = %7B%7D%0A%0A size = 0%0A%0A for v in adjs:%0A vertexToChamber%5Bv%5D = size%0A ... | |
e212ad90a8fedb8e29abe3683b99a28d4030b544 | Add process module for Popen compat handling | passpie/process.py | passpie/process.py | Python | 0 | @@ -0,0 +1,1082 @@
+from subprocess import Popen, PIPE%0A%0Afrom ._compat import *%0A%0A%0Aclass Proc(Popen):%0A%0A def communicate(self, **kwargs):%0A if kwargs.get('input') and isinstance(kwargs%5B'input'%5D, basestring):%0A kwargs%5B'input'%5D = kwargs%5B'input'%5D.encode('utf-8')%0A retu... | |
53038aea2b439acdc265f81b9f031336ea1f27f3 | Add lc480_sliding_window_median.py | lc480_sliding_window_median.py | lc480_sliding_window_median.py | Python | 0.000044 | @@ -0,0 +1,1429 @@
+%22%22%22Leetcode 480. Sliding Window Median%0A%0AURL: https://leetcode.com/problems/sliding-window-median/%0A%0AHard%0A%0AMedian is the middle value in an ordered integer list. %0AIf the size of the list is even, there is no middle value. %0ASo the median is the mean of the two middle value.%0A%0AE... | |
9a6bf30ecfa7b843d8588a8a7b052f87089e44c7 | convert csv to excel | write_excel.py | write_excel.py | Python | 0.999999 | @@ -0,0 +1,636 @@
+%0Adef Excel2CSV(ExcelFile, SheetName, CSVFile):%0A workbook = xlrd.open_workbook(ExcelFile)%0A try:%0A worksheet = workbook.sheet_by_name(SheetName)%0A except xlrd.biffh.XLRDError:%0A print %22Missing portmap for switch %22 + str(SheetName)%0A print %22Exiting program. ... | |
a5ec49a658de23263802c7ddad02a4e34073a2a4 | add example of a go block returning value through a channel | example/go_block.py | example/go_block.py | Python | 0 | @@ -0,0 +1,265 @@
+import csp%0A%0A%0Adef lazy_echo(x):%0A yield csp.wait(0.5)%0A print %22I'm done%22%0A yield csp.stop(x)%0A%0A%0Adef main():%0A chan = csp.go(lazy_echo(1))%0A print (yield csp.take(chan))%0A%0A chan = csp.go(lazy_echo(2))%0A yield csp.wait(2)%0A print (yield csp.take(chan))%0A... | |
9ba08d5e678f3f088cc94b2dec5e1994be6b2912 | fix reversed flag for updating latest version. | script/upload.py | script/upload.py | #!/usr/bin/env python
import argparse
import errno
import glob
import os
import subprocess
import sys
import tempfile
from lib.util import *
TARGET_PLATFORM = {
'cygwin': 'win32',
'darwin': 'darwin',
'linux2': 'linux',
'win32': 'win32',
}[sys.platform]
ATOM_SHELL_VRESION = get_atom_shell_version()
NODE_VER... | Python | 0 | @@ -1212,12 +1212,11 @@
ore_
-fals
+tru
e')%0A
|
5007a2910f54c339c50667993c11fd4586412524 | add letter code | wordonhd/Letter.py | wordonhd/Letter.py | Python | 0.978909 | @@ -0,0 +1,402 @@
+class Letter(object):%0A _values = %7B%0A 'ENIOA': 1,%0A 'SDTR': 2,%0A 'MLKPBG': 3,%0A 'ZVUFJH': 4,%0A 'CW': 5,%0A 'XY': 8,%0A 'Q': 10%0A %7D%0A%0A def __init__(self, letter):%0A self.letter = letter%5B-1%5D%0A self.wordon = lett... | |
2e44b753a071aeba95b51bd03c5635a1eb4d7f28 | Create gcd.py | CiO/gcd.py | CiO/gcd.py | Python | 0.000001 | @@ -0,0 +1,158 @@
+from fractions import gcd%0A%0A%0Adef greatest_common_divisor(*args):%0A result, *args = args%0A for n in args:%0A result = gcd(result, n)%0A return result%0A
| |
239488d33f94b0262e642fbf751878894fb7510e | add test for post form admin in articles | opps/articles/tests/test_forms.py | opps/articles/tests/test_forms.py | Python | 0 | @@ -0,0 +1,1974 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Afrom django.test import TestCase%0Afrom django.contrib.sites.models import Site%0Afrom django.contrib.auth import get_user_model%0A%0Afrom opps.channels.models import Channel%0Afrom opps.core.widgets import OppsEditor%0A%0Afrom ..models import Pos... | |
94dbda64d07838a7408b94251972d81897536380 | Add listener example file | listeners_example.py | listeners_example.py | Python | 0 | @@ -0,0 +1,436 @@
+import turtle%0A%0Aturtle.penup()%0Aturtle.ht()%0A%0Adef up():%0A print(%22You pressed Up!%22)%0A%0Adef down():%0A print(%22You pressed Down!%22)%0A%0Adef left():%0A print(%22You pressed Left!%22)%0A%0Adef right():%0A print(%22You pressed Right!%22)%0A %0Aturtle.onkey(up, 'Up')%0Aturtl... | |
1d0aff329c5adb836e7b055c042990de219debe0 | Add rough first implementation of widgets.py | wtforms/widgets.py | wtforms/widgets.py | Python | 0 | @@ -0,0 +1,2072 @@
+%22%22%22%0A wtforms.widgets%0A ~~~~~~~~~~~~~~~%0A %0A The WTForms widget system.%0A %0A :copyright: 2009 by James Crasta, Thomas Johansson.%0A :license: MIT, see LICENSE.txt for details.%0A%22%22%22%0Afrom cgi import escape%0A%0A__all__ = (%0A 'ListWidget', 'TextInput', 'Pas... | |
b1d3f2a9f78cfaa2da275091e56c9287a50b561d | Switch the order of steps in a production deployment | ci/sync-dist.py | ci/sync-dist.py | # This script is used for syncing parts of the rustup dist server
# between the dev environment (dev-static.rlo), the local machine, and
# the prod environment (static.rlo). It's used during the deployment process.
#
# It does only a few things:
#
# * Sync dev bins to local host:
# python sync-dist.py dev-to-local
#
... | Python | 0.000057 | @@ -430,16 +430,25 @@
to prod
+ archives
%0A# pyt
@@ -477,16 +477,31 @@
-to-prod
+-archives 0.2.0
%0A#%0A# * S
@@ -518,33 +518,24 @@
bins to prod
- archives
%0A# python
@@ -560,31 +560,16 @@
-to-prod
--archives 0.2.0
%0A%0Aimport
|
be81dbc33e932e870a66ad0663c23e5d05b01ffa | Create Counter.py | Counter.py | Counter.py | Python | 0.000001 | @@ -0,0 +1,1503 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A%22%22%22 %0A@_ambonilla 2014%0A%0AUsing cocos & piglet libraries, is a small counter program %0Awhere when you push the up key it will add a number to the %0Adisplayed value, and the down key will substract one %0A%0A%22%22%22%0A%0Aimport cocos%0... | |
c80baf708c956a9814ef81213a66da8d443de12a | add migration | apps/bplan/migrations/0002_auto_20170509_1358.py | apps/bplan/migrations/0002_auto_20170509_1358.py | Python | 0.000001 | @@ -0,0 +1,1217 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('meinberlin_bplan', '0001_initial'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterFie... | |
2c78290cc569eb70b5b7098d154da3fb7a2247a9 | Add db_mktag.py, command line tag creator. | db_mktag.py | db_mktag.py | Python | 0 | @@ -0,0 +1,240 @@
+#!/usr/bin/env python%0A# -*- coding: iso-8859-1 -*-%0A%0Afrom sys import argv, exit%0Afrom dbclient import dbclient%0A%0Aif len(argv) not in (2, 3):%0A%09print %22Usage:%22, argv%5B0%5D, %22tagname %5Btagtype%5D%22%0A%09exit(1)%0A%0Aclient = dbclient()%0Aclient.add_tag(*argv%5B1:%5D)%0A
| |
3609c5842b33ca4146ad14b74c76f8954545aaa8 | Add commands for cases and variants | loqusdb/commands/view.py | loqusdb/commands/view.py | Python | 0.000001 | @@ -0,0 +1,1391 @@
+# -*- coding: utf-8 -*-%0Aimport logging%0Aimport click%0A%0Afrom . import base_command%0A%0Alogger = logging.getLogger(__name__)%0A%0A@base_command.command()%0A@click.option('-c' ,'--case-id', %0A help='Search for case'%0A)%0A@click.pass_context%0Adef cases(ctx, case_id):%0A %22%2... | |
dd2f332dd1b7a215d5a6aa81819e3d66d46c1b91 | add python solution for 20 | 01-50/20/20.py | 01-50/20/20.py | Python | 0.000077 | @@ -0,0 +1,76 @@
+import math%0Aprint sum(int(c) for c in str(math.factorial(100)).rstrip('L'))%0A
| |
7f661e24388e82ae2e2872ab11ee6a84d487aac7 | Create py-mysql-select.py | py-mysql-select.py | py-mysql-select.py | Python | 0.000008 | @@ -0,0 +1,555 @@
+#!/usr/bin/env python%0A# --*-- coding:utf-8 --*--%0A%0Aimport MySQLdb #%E6%93%8D%E4%BD%9Cmysql%EF%BC%8C%E9%9C%80%E8%A6%81%E5%8A%A0%E8%BD%BDMySQLdb%E6%A8%A1%E5%9D%97%0A%0A#%E5%88%9B%E5%BB%BA%E8%BF%9E%E6%8E%A5%0Aconn = MySQLdb.connect(host = '127.0.0.1',user = 'root',passwd = '123',db = 'mydb') #... | |
48b2b234377d8e66ccb274e4845a835486228166 | Create test_utils.py | utils_test.py | utils_test.py | Python | 0.000001 | @@ -0,0 +1,799 @@
+ import pytest%0A from utils import *%0A%0Adef test_struct_initialization():%0A s = Struct(a=1, b=2)%0A assert s.a == 1%0A assert s.b == 2%0A%0Adef test_struct_assignment():%0A s = Struct(a=1)%0A s.a = 3%0A assert s.a == 3%0A%0Adef test_removeall_list():%0A assert removeall(4, %5... | |
7581fbc397915c1ad72714203fee2349a84e14e9 | add notifiaction push script - pushNotif.py | API/ssc/SscData/pushNotif.py | API/ssc/SscData/pushNotif.py | Python | 0 | @@ -0,0 +1,567 @@
+from urllib2 import *%0Aimport urllib%0Aimport json%0Aimport sys%0A%0AMY_API_KEY=%22AIzaSyCgSjnjxtYBGMOq7jNgnE_tbhpOJjU5nOo%22%0A%0AmessageTitle = sys.argv%5B1%5D%0AmessageBody = sys.argv%5B2%5D%0A%0Adata=%7B%0A %22to%22 : %22/topics/sscapp%22,%0A %22notification%22 : %7B%0A %22body%22 :... | |
8d5f3136fb737c8058d8b0bb4d866d1fe5bb3af8 | Add main function for specchio | specchio/main.py | specchio/main.py | Python | 0.000003 | @@ -0,0 +1,1060 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport sys%0Aimport time%0A%0Afrom watchdog.observers import Observer%0A%0Afrom specchio.handlers import SpecchioEventHandler%0Afrom specchio.utils import logger%0A%0A%0Adef main():%0A %22%22%22Main function for specchio%0A%0A Example: specc... | |
e487ca21da9e7b62a860b91aadfecdf36df005a2 | add public templates module | pymzn/templates.py | pymzn/templates.py | Python | 0.000001 | @@ -0,0 +1,101 @@
+%0Afrom .mzn import templates as _templates%0Afrom .mzn.templates import *%0A%0A__all__ = _templates.__all__%0A
| |
1019f866fc0e9c16ccbe726b4b21265dbfc1ac68 | Add search_rotated_sorted_array.py | data_structures/sorting/search_rotated_sorted_array.py | data_structures/sorting/search_rotated_sorted_array.py | Python | 0.00001 | @@ -0,0 +1,2081 @@
+# Search in a Rotated Sorted Array%0A# You are given a sorted array which is rotated at some random pivot point.%0A#%0A# Example: %5B0,1,2,4,5,6,7%5D might become %5B4,5,6,7,0,1,2%5D%0A#%0A# You are given a target value to search. If found in the array return its index, otherwise return -1.%0A#%0A# ... | |
ffc1b443f13672d0a4002a38f5273b5f72cdb627 | Solve Even Fibonacci numbers | python/euler002.py | python/euler002.py | Python | 0.999998 | @@ -0,0 +1,434 @@
+#!/bin/python3%0A# Project Euler #2: Even Fibonacci numbers%0A%0Adef fibonacci_sequence(n):%0A sequence = %5B1, 2%5D%0A while sequence%5B-1%5D + sequence%5B-2%5D %3C n:%0A sequence.append(sequence%5B-1%5D + sequence%5B-2%5D)%0A return sequence%0A%0Adef evens(array):%0A return list(... | |
f5f2f87030e48dd751ed95eec08f29ab863a8ed9 | Compute the difference between two images | python/img_diff.py | python/img_diff.py | Python | 1 | @@ -0,0 +1,860 @@
+import requests%0Aimport json%0A%0A# Compute the difference between two images and output the reconstructed image and the diff output.%0A# Keep in mind that the two images must be of the same size or call 'resize' or 'crop' before to%0A# fit the images to the same dimension.%0A# Read more on imgdiff ... | |
dc5aad16e63ff210aa3770f6eae18f215f78f8ce | Create 03.py | 01/hw/03.py | 01/hw/03.py | Python | 0 | @@ -0,0 +1,191 @@
+# Given the variables s and t defined as:%0As = 'udacity'%0At = 'bodacious'%0A# write Python code that prints out udacious%0A# without using any quote characters in%0A# your code.%0A%0Aprint s%5B:3%5D + t%5B4:%5D%0A
| |
616e656cb9390321cb36d8f1b067d0bddaff11c2 | Add cli argument parser | frigg/worker/cli.py | frigg/worker/cli.py | Python | 0.000001 | @@ -0,0 +1,570 @@
+# -*- coding: utf8 -*-%0Afrom fabric import colors%0Afrom frigg.worker.fetcher import fetcher%0A%0A%0Aclass Commands(object):%0A%0A @staticmethod%0A def start():%0A print(colors.green(%22Starting frigg worker%22))%0A fetcher()%0A%0A @staticmethod%0A def unknown_command():%0A... | |
80caf160aba107f539d18287a09fc30d6cf3d0a1 | add demo plotting the available 1D demo signals | demo/plot_demo_signals.py | demo/plot_demo_signals.py | Python | 0 | @@ -0,0 +1,1392 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0A%22%22%22Plot the set of 1D demo signals available in %60pywt.data.demo_signal%60.%22%22%22%0A%0Aimport numpy as np%0A%0Aimport matplotlib.pyplot as plt%0A%0Aimport pywt%0A%0A# use 'list' to get a list of all available 1d demo signals%0Asignals =... | |
944ab744ce4ba3fb30ce94ac2ec581e4b481610f | add img to the dirs that get created. | dj/scripts/mkdirs.py | dj/scripts/mkdirs.py | #!/usr/bin/python
# Makes the dir tree to put files into
import os,sys
from process import process
from main.models import Client, Show, Location, Episode
class mkdirs(process):
def mkdir(self,dir):
""" makes the dir if it doesn't exist """
ret = False
print(dir, end=' ')
if os.path.exi... | Python | 0 | @@ -850,16 +850,20 @@
m/titles
+ img
%22%0A
|
4a30d30b82fbdccbb0f15ebb5c094b13ce791f7f | Add a utility class to normalize input | genderator/utils.py | genderator/utils.py | Python | 0.000002 | @@ -0,0 +1,544 @@
+from unidecode import unidecode%0A%0A%0Aclass Normalizer:%0A%0A def normalize(text):%0A text = Normalizer.remove_extra_whitespaces(text)%0A text = Normalizer.replace_hyphens(text)%0A # text = Normalizer.remove_accent_marks(text)%0A%0A return text.lower()%0A%0A @stati... | |
8b828e9c9daacd8bd6b5719e0ee50fc93f3c612d | add line-invoker, allows pipeline to be changed on the fly | line-invoker.py | line-invoker.py | Python | 0 | @@ -0,0 +1,1018 @@
+#!/usr/bin/python%0A%0Afrom __future__ import print_function%0A%0Aimport sys%0Aimport subprocess%0A%0A# A normal(ish) pipeline looks like the following:%0A# tailf input %7C grep -v foo %7C grep bar %7C cat %3E%3Eoutput%0A%0A# If we want to change the valu %22foo%22, %22bar%22 or otherwise change the... | |
80cb11187894870ba9fe40e09834522d7ea2ee10 | Create middleware.py | middleware.py | middleware.py | Python | 0.000007 | @@ -0,0 +1 @@
+%0A
| |
aadd5b5d60e1fa2939482790baa893d9624ad33b | Create mnist_lstm.py | mnist_lstm.py | mnist_lstm.py | Python | 0.000004 | @@ -0,0 +1,2658 @@
+from tensorflow.models.rnn import rnn_cell, rnn%0Aimport tensorflow as tf%0Aimport numpy as np%0Aimport input_data%0Asess = tf.Session() %0A%0A'''%0AClassify MNIST using LSTM running row by row. %0A%0AGood:%0A* No compilation time at all, which is cool.%0A%0ABad:%0A* Problem is that has all dimensi... | |
940c4f4238eac31f926e520dba473819abb44033 | Add a moksha.hub module with an initial OrbitedWidget | moksha/hub.py | moksha/hub.py | Python | 0 | @@ -0,0 +1,1935 @@
+# This file is part of Moksha.%0A#%0A# Moksha 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# (at your option) any later version.%0A# %0A# Moksha... | |
7780c235f0f357ab918f0c031e7dc51f6ca072a9 | Solve problem 20 | problem020.py | problem020.py | Python | 0.999999 | @@ -0,0 +1,273 @@
+#!/usr/bin/env python3%0A%0Afrom functools import *%0Aimport operator%0A%0Adef factorial(number):%0A assert number %3E= 1%0A return reduce(operator.mul, range(1, number+1))%0A%0Adef digits(number):%0A yield from (int(digit) for digit in str(number))%0A%0Aprint(sum(digits(factorial(100))))%0A... | |
50b47ecc52b390a7fc6749491b1895389280a4ec | Add more tests of BotTestExpectations, including some which we fail. | Tools/Scripts/webkitpy/layout_tests/layout_package/bot_test_expectations_unittest.py | Tools/Scripts/webkitpy/layout_tests/layout_package/bot_test_expectations_unittest.py | # Copyright (C) 2013 Google Inc. 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 of conditions and the ... | Python | 0.000002 | @@ -1678,93 +1678,1308 @@
#
-Expects newest result on left of string %22PFF%22, means it just passed after 2 failures.
+All result_string's in this file expect newest result%0A # on left: %22PFF%22, means it just passed after 2 failures.%0A%0A def _assert_is_flaky(self, results_string, should_be_flaky):%0A ... |
6fcb3adbcf85aa8039274f59d2b26401b5927fc4 | Create PowerofFour_001.py | kargtom/twodim/PowerofFour/PowerofFour_001.py | kargtom/twodim/PowerofFour/PowerofFour_001.py | Python | 0 | @@ -0,0 +1,90 @@
+def isPowerOfFour(n):%0A return n %3E 0 and n & n - 1 is 0 and n & 0x5555555555555555 != 0%0A
| |
8a7fda2acf57c135e7f401ebdd8f71c3609c0eca | Create tries.py | Python/tries.py | Python/tries.py | Python | 0.000001 | @@ -0,0 +1,1565 @@
+def make_trie(*args):%0A%09trie=%7B%7D%0A%09for word in args:%0A%09%09if type(word)!= str:%0A%09%09%09raise TypeError(%22Trie work only on strings%22)%0A%09%09# temp_trie and trie refer to the same dictionary object.%0A%09%09temp_trie=trie%0A%09%09for letter in word:%0A%09%09%09# here setdefault set... | |
23cf747a3ff24f75d3300547f4bfdecf10c4a325 | Add next traversal util function | scrapple/utils/config.py | scrapple/utils/config.py | Python | 0.000935 | @@ -0,0 +1,813 @@
+%22%22%22%0Ascrapple.utils.config%0A~~~~~~~~~~~~~~~~~~~~~%0A%0AFunctions related to traversing the configuration file%0A%22%22%22%0A%0Afrom __future__ import print_function%0A%0A%0Adef traverse_next(page, next, results):%0A for link in page.extract_links(next%5B'follow_link'%5D):%0A print(%... | |
56b3cf07fff4d3794dcdbf99f6d7faa629fa243e | fix string manipulation in render_templatefile() | scrapy/utils/template.py | scrapy/utils/template.py | """Helper functions for working with templates"""
import os
import re
import string
def render_templatefile(path, **kwargs):
with open(path, 'rb') as file:
raw = file.read()
content = string.Template(raw).substitute(**kwargs)
with open(path.rstrip('.tmpl'), 'wb') as file:
file.write(cont... | Python | 0.000007 | @@ -247,38 +247,104 @@
-with open(path.rstrip('.tmpl')
+render_path = path%5B:-len('.tmpl')%5D if path.endswith('.tmpl') else path%0A with open(render_path
, 'w
|
ec484a404752c60a7c88ae84f79b4792c777dfd4 | Define ESCO ua and eu tender models | openprocurement/tender/esco/models.py | openprocurement/tender/esco/models.py | Python | 0 | @@ -0,0 +1,582 @@
+from zope.interface import implementer%0Afrom schematics.types import StringType%0A%0Afrom openprocurement.api.models import ITender%0A%0Afrom openprocurement.tender.openua.models import (%0A Tender as BaseTenderUA,%0A)%0A%0Afrom openprocurement.tender.openeu.models import (%0A Tender as BaseTe... | |
82b9a66ea826b4463d82c69ba1703eab213efe83 | Add test for stack outputs | heat_integrationtests/functional/test_stack_outputs.py | heat_integrationtests/functional/test_stack_outputs.py | Python | 0.00006 | @@ -0,0 +1,2371 @@
+# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or a... | |
78df4f45ea4b8c04ba8f34d8fc356345998c616b | Add TelnetServer.py under version control. | TelnetServer.py | TelnetServer.py | Python | 0 | @@ -0,0 +1,2181 @@
+#!/usr/bin/env python%0A# coding: utf-8%0A%0Aimport socket%0Aimport threading%0A%0Awelcome_slogan = '''Welcome novice!%5Cr%5Cn%5C%0AType something and hit enter to see what happens.%5Cr%5Cn%5C%0ABe bold!%5Cr%5Cn%5Cr%5Cn'''%0Ahelp_message = '''Command Description%5Cr%5Cn%5C%0A================... | |
8b2eb3bece67a1eb81a6165238205b05361f2ec3 | fix key case | corehq/apps/ota/tasks.py | corehq/apps/ota/tasks.py | from celery.task import task
from couchdbkit.exceptions import ResourceNotFound
from casexml.apps.case.xml import V1
from casexml.apps.phone.restore import RestoreConfig
from corehq.apps.users.models import CommCareUser
from soil import DownloadBase
@task
def prime_restore(domain, usernames_or_ids, version=V1, cache_... | Python | 0.999689 | @@ -2193,16 +2193,16 @@
et%5B'
-MESSAGES
+messages
'%5D.a
|
eaeb02839913136909cccc9a99612a1eb7145b97 | support state hash in ota restore if specified | corehq/apps/ota/views.py | corehq/apps/ota/views.py | from corehq.apps.users.models import CouchUser
from django_digest.decorators import *
from casexml.apps.phone.restore import generate_restore_payload
@httpdigest
def restore(request, domain):
"""
We override restore because we have to supply our own
user model (and have the domain in the url)
"""
... | Python | 0 | @@ -135,23 +135,24 @@
restore_
-payload
+response
%0A%0A%0A%0A@htt
@@ -435,16 +435,58 @@
%221.0%22)%0A
+ state_hash = request.GET.get('state')%0A
user
@@ -771,24 +771,20 @@
%0A re
-sponse =
+turn
generat
@@ -797,15 +797,16 @@
ore_
-payload
+response
(cou
@@ -881,24 +881,25 @@
+
api_... |
dca0404e6f14194be3a5926e522bbeea375e8456 | add net spider rokic's version | crawler/discount_info.py | crawler/discount_info.py | Python | 0 | @@ -0,0 +1,1207 @@
+import json%0Aimport requests%0Afrom bs4 import BeautifulSoup%0A%0ADOMAIN = %22%22%0AAPI = %22http://%25s/api/%22 %25 (DOMAIN)%0ASTEAMDB_SALE_URL = %22https://steamdb.info/sales/?merged=true&cc=cn%22%0A%0Aheaders = %7B%0A 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'... | |
1602513f2ee508ed70ec08af90a94cf150d14189 | Add grep_token_logs.py | skolo/grep_token_logs.py | skolo/grep_token_logs.py | Python | 0.000297 | @@ -0,0 +1,2159 @@
+#!/usr/bin/env python%0A%0A# Copyright 2018 Google LLC.%0A#%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0A%0A%22%22%22Search the syslog on a jumphost to determine when auth tokens changed.%22%22%22%0A%0A%0Aimport sys%0A%0A%0ASYSLOG = '... | |
486263fff771a5f647d70d062e67022ae5031378 | Fix inverted sensors on the concord232 binary sensor component (#11261) | homeassistant/components/binary_sensor/concord232.py | homeassistant/components/binary_sensor/concord232.py | """
Support for exposing Concord232 elements as sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.concord232/
"""
import datetime
import logging
import requests
import voluptuous as vol
from homeassistant.components.binary_sensor im... | Python | 0 | @@ -3568,17 +3568,17 @@
state'%5D
-=
+!
= 'Norma
|
46c69a7eea1f9b5b7479e80cf3b1b8e224dbd7e5 | Fix : AD module crash when bad ldap entry. | shinken/modules/active_directory_ui.py | shinken/modules/active_directory_ui.py | #!/usr/bin/python
#Copyright (C) 2009 Gabes Jean, naparuba@gmail.com
#
#This file is part of Shinken.
#
#Shinken is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at yo... | Python | 0 | @@ -5542,28 +5542,28 @@
o for%22,
-accoun
+c.ge
t_name
+()
%0A%0A%0A%0A
|
417ff63118c967205ee630c5183b19a949a6c157 | Add migrations for indicadores. | indicadores/migrations/0002_auto_20170224_1535.py | indicadores/migrations/0002_auto_20170224_1535.py | Python | 0 | @@ -0,0 +1,431 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.2 on 2017-02-24 15:35%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('indicadores', '0001_initial'),%0A %5D%0A%0A o... | |
b7bf4586fea207453225a87fb85df59ccfc94e80 | Add missing migration related to django-simple-history update | jarbas/core/migrations/0032_auto_20170613_0641.py | jarbas/core/migrations/0032_auto_20170613_0641.py | Python | 0.000001 | @@ -0,0 +1,552 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.2 on 2017-06-13 09:41%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('core', '0031_add_index_together_for_reimbursement')... | |
7082f80d5be56073d9d2a66653188b2cee248a8e | add basic tests of search and matrix views | src/encoded/tests/test_search.py | src/encoded/tests/test_search.py | Python | 0 | @@ -0,0 +1,1779 @@
+# Use workbook fixture from BDD tests (including elasticsearch)%0Afrom .features.conftest import app_settings, app, workbook%0A%0A%0Adef test_search_view(workbook, testapp):%0A res = testapp.get('/search/').json%0A assert res%5B'@type'%5D == %5B'Search'%5D%0A assert res%5B'@id'%5D == '/sear... | |
2cd1da31b099cbf37552b2a049c3df6619e0e64f | Add helper enums for type encodings | rma/redis_types.py | rma/redis_types.py | Python | 0 | @@ -0,0 +1,1245 @@
+REDIS_ENCODING_ID_RAW = 0%0AREDIS_ENCODING_ID_INT = 1%0AREDIS_ENCODING_ID_EMBSTR = 2%0AREDIS_ENCODING_ID_HASHTABLE = 3%0AREDIS_ENCODING_ID_ZIPLIST = 4%0AREDIS_ENCODING_ID_LINKEDLIST = 5%0AREDIS_ENCODING_ID_QUICKLIST =6%0AREDIS_ENCODING_ID_INTSET = 7%0AREDIS_ENCODING_ID_SKIPLIST = 8%0A%0AREDIS_ENCODI... | |
901046879338b1bc19de59675c7eb513bbc2c517 | add problem 19 | euler019.py | euler019.py | Python | 0.001255 | @@ -0,0 +1,388 @@
+#!/usr/bin/env python%0A%0A%0Afirsts = %5B1%5D%0Ajan = 31%0Amar_dec = %5B31, 30, 31, 30, 31, 31, 30, 31, 30, 31%5D%0Afor year in range(1901,2001):%0A firsts.append(firsts%5B-1%5D + jan)%0A if year %25 4 == 0 and year %25 100 != 0 or year %25 400 == 0:%0A feb = 29%0A else:%0A feb = 28%0A fir... | |
dfa5bee0720f8d4b5f3ac2309915090239780045 | Test Flask file | flaskweb.py | flaskweb.py | Python | 0.000001 | @@ -0,0 +1,425 @@
+from flask import Flask, request, jsonify%0Aapp = Flask(__name__)%0A%0A@app.route(%22/hello/%3Cname%3E%22)%0Adef hello(name):%0A return %22Hello World! %25s%22 %25 name%0A%0A@app.route(%22/data/%22)%0Adef temptime():%0A arr = %7B%22temp%22: %5B20, 21, 21%5D,%22time%22:%5B10,20,30%5D,%22unit%22:... | |
02f84b8cf3c3dd77b6d84d9ccea979c8de23eaa5 | Add Awesome renderers | src/common/renderers.py | src/common/renderers.py | Python | 0 | @@ -0,0 +1,2953 @@
+import time%0Afrom rest_framework.renderers import JSONRenderer%0Afrom django.shortcuts import resolve_url%0Afrom django.template.loader import render_to_string%0Afrom django.utils.encoding import force_str%0Afrom django.utils.functional import Promise%0Afrom rest_framework.renderers import BaseRend... | |
80a435e3e382791b5615755d05c5353114650ecc | test only | hello.py | hello.py | Python | 0 | @@ -0,0 +1,263 @@
+#!/usr/bin/python%0A%0Aprint %22Content-type:text/html%5Cr%5Cn%5Cr%5Cn%22%0Aprint '%3Chtml%3E'%0Aprint '%3Chead%3E'%0Aprint '%3Ctitle%3EHello Word - First CGI Program%3C/title%3E'%0Aprint '%3C/head%3E'%0Aprint '%3Cbody%3E'%0Aprint '%3Ch2%3EHello Word! This is my first CGI program%3C/h2%3E'%0Aprint '%... | |
101f378fb536cdaf8f2c681f5b1fba669bf70631 | Add hex xor | hexor.py | hexor.py | Python | 0.000083 | @@ -0,0 +1,790 @@
+#!/usr/bin/python3%0A# -*- coding: utf-8 -*-%0A# xor 2 hex strings%0A%0Aimport string%0A%0Adef isHex(s):%0A '''Check if it is a hex string'''%0A if (len(s) == 0 or len(s) %25 2 != 0%0A or not all(c in string.hexdigits for c in s)):%0A return False%0A return Tru... | |
6a9d60a6e48b3231675e465c1a837c909a9e652a | Add forward2 | forward2.py | forward2.py | Python | 0.999904 | @@ -0,0 +1,1143 @@
+from convert import print_prob, load_image, checkpoint_fn, meta_fn%0Aimport tensorflow as tf%0A%0Aimport resnet%0A%0Aimport os%0A%0Alayers = 50%0A%0Aimg = load_image(%22data/cat.jpg%22)%0A%0Asess = tf.Session()%0A%0Afilename = checkpoint_fn(layers)%0Afilename = os.path.realpath(filename)%0A%0Aif lay... | |
aabeda2b604bc44996d0afc4cc149deb71157123 | Update wunderground.py | homeassistant/components/sensor/wunderground.py | homeassistant/components/sensor/wunderground.py | """Support for Wunderground weather service."""
from datetime import timedelta
import logging
import requests
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
from homeassistant.const import CONF_API_KEY
from homeassistant.const import TEMP_FAHRENHEIT
from homeassistant.const impo... | Python | 0 | @@ -4070,24 +4070,25 @@
a from Wunde
+r
ground.%22%22%22%0A%0A
@@ -4606,24 +4606,16 @@
ws_id +
-'.json',
%0A
@@ -4640,16 +4640,25 @@
+ '.json',
timeout
|
c794fbf00c5ba5b661f01fcbd0652105ed4c3904 | Add missing migration. | mc2/controllers/base/migrations/0005_field_defaults.py | mc2/controllers/base/migrations/0005_field_defaults.py | Python | 0.000002 | @@ -0,0 +1,644 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('base', '0004_marathonlabel'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterField(%0A ... | |
d478517c51c8428c5606bfa9dfd6f734aff5df13 | Fix races on recorder test (#11857) | tests/components/recorder/test_purge.py | tests/components/recorder/test_purge.py | """Test data purging."""
import json
from datetime import datetime, timedelta
from time import sleep
import unittest
from homeassistant.components import recorder
from homeassistant.components.recorder.const import DATA_INSTANCE
from homeassistant.components.recorder.purge import purge_old_data
from homeassistant.comp... | Python | 0.000001 | @@ -75,31 +75,8 @@
lta%0A
-from time import sleep%0A
impo
@@ -5959,32 +5959,69 @@
s
-leep(0.1
+elf.hass.data%5BDATA_INSTANCE%5D.block_till_done(
)%0A%0A
@@ -6449,16 +6449,53 @@
s
-leep(0.1
+elf.hass.data%5BDATA_INSTANCE%5D.block_till_done(
)%0A%0A
|
46a9c3789b86631258d881dacf6ae529ec277d70 | Add stats262.py | ielex/lexicon/management/commands/stats262.py | ielex/lexicon/management/commands/stats262.py | Python | 0.000001 | @@ -0,0 +1,1850 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.core.management import BaseCommand%0A%0Afrom ielex.lexicon.models import Language, %5C%0A Meaning, %5C%0A Lexeme, %5C%0A ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.