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 |
|---|---|---|---|---|---|---|---|
319d74685a0bd44ca0c62bf41dae2f9515b5e327 | Add tests for nilrt_ip._load_config | tests/pytests/unit/modules/test_nilrt_ip.py | tests/pytests/unit/modules/test_nilrt_ip.py | Python | 0 | @@ -0,0 +1,1861 @@
+import io%0A%0Aimport pytest%0Aimport salt.modules.nilrt_ip as nilrt_ip%0Afrom tests.support.mock import patch%0A%0A%0A@pytest.fixture(autouse=True)%0Adef setup_loader(request):%0A setup_loader_modules = %7Bnilrt_ip: %7B%7D%7D%0A with pytest.helpers.loader_mock(request, setup_loader_modules) a... | |
e810ecb5362496f72485220ab4e9cecd5467b3a6 | kill leftover webpagereplay servers. | build/android/pylib/utils/test_environment.py | build/android/pylib/utils/test_environment.py | # Copyright 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.
import logging
import os
import psutil
from pylib import android_commands
def _KillWebServers():
for retry in xrange(5):
for server in ['lighttpd', '... | Python | 0.000002 | @@ -194,16 +194,30 @@
t psutil
+%0Aimport signal
%0A%0Afrom p
@@ -246,16 +246,17 @@
mmands%0A%0A
+%0A
def _Kil
@@ -280,27 +280,96 @@
for
-retry in xrange(5):
+s in %5Bsignal.SIGTERM, signal.SIGINT, signal.SIGQUIT, signal.SIGKILL%5D:%0A signalled = %5B%5D
%0A
@@ -404,14 +404,12 @@
'web
--
page
--
repl
@@... |
d77cb643c7762401209f1f9d9693ee352e6672cb | Create mqttEampleRemoteBrain.py | home/kyleclinton/mqttEampleRemoteBrain.py | home/kyleclinton/mqttEampleRemoteBrain.py | Python | 0.000013 | @@ -0,0 +1,942 @@
+from java.lang import String%0Afrom time import sleep%0Api = Runtime.createAndStart(%22pi%22,%22RasPi%22)%0A%0A#Load Pub/Sub Service (MQTT)%0Aexecfile(%22../py_scripts/mqttPubSubConfig.py%22)%0A%0A%0A# Add in controller for head, neck and antenna servos SHOULD be using i2c 16 servo controller%0A#Load... | |
3fb4d7b630fb7a4b34dcc4e1b72947e61f73a80f | Create script to dowload requisite test urls. | TestData/download_test_data.py | TestData/download_test_data.py | Python | 0 | @@ -0,0 +1,2125 @@
+def set_test_db():%0A from sys import path%0A path.insert(0, %22..%22)%0A from MyEdgarDb import get_list_sec_filings, get_cik_ticker_lookup_db, lookup_cik_ticker%0A get_list_sec_filings (7, 'test_idx.db')%0A get_cik_ticker_lookup_db ('test_idx.db')%0A%0Adef download_test_data():%0A ... | |
df8206b01eb2298651099c5e701d269a0e6cd8c6 | add test case for tuple attribute error #35 | test/test_flake8.py | test/test_flake8.py | Python | 0 | @@ -0,0 +1,233 @@
+import subprocess%0A%0A%0Adef test_call_flake8(tmpdir):%0A tmp = tmpdir.join('tmp.py')%0A tmp.write('')%0A output = subprocess.check_output(%0A %5B'flake8', str(tmp)%5D,%0A stderr=subprocess.STDOUT,%0A )%0A assert output == b''%0A
| |
ecae1fa205c88d1d503663c5fbec80a1943146ad | add resources comparator | pynodegl-utils/pynodegl_utils/tests/cmp_resources.py | pynodegl-utils/pynodegl_utils/tests/cmp_resources.py | Python | 0.000001 | @@ -0,0 +1,2489 @@
+#!/usr/bin/env python%0A#%0A# Copyright 2020 GoPro Inc.%0A#%0A# Licensed to the Apache Software Foundation (ASF) under one%0A# or more contributor license agreements. See the NOTICE file%0A# distributed with this work for additional information%0A# regarding copyright ownership. The ASF licenses t... | |
885aac79c2e31fc74dc143fc2527e02c2c0a8941 | add duckduckgo crawler | scholarly_citation_finder/api/crawler/Duckduckgo.py | scholarly_citation_finder/api/crawler/Duckduckgo.py | Python | 0.999999 | @@ -0,0 +1,1829 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0Aimport requests%0Afrom bs4 import BeautifulSoup%0A%0Aclass Duckduckgo:%0A %0A API_URL = 'https://duckduckgo.com/html/'%0A CSS_RESULT_ELEMENT = 'a'%0A CSS_RESULT_ELEMENT_CLASS = 'large'%0A CSS_RESULT_TYPE_ELEMENT = 'span'%0A CSS_RESULT_T... | |
60f01c055405fea9e3672821a1188774f7517707 | add 140 | vol3/140.py | vol3/140.py | Python | 0.999989 | @@ -0,0 +1,191 @@
+if __name__ == %22__main__%22:%0A L = 30%0A sqrt5 = 5 ** 0.5%0A f = %5B7, 14, 50, 97%5D%0A for i in range(L - 4):%0A f.append(7 * f%5B-2%5D - f%5B-4%5D)%0A print sum(int(x / sqrt5) - 1 for x in f)%0A
| |
7d6b04bc60270d357fdf9401174ece249f9f3568 | add 153 | vol4/153.py | vol4/153.py | Python | 0.999996 | @@ -0,0 +1,540 @@
+import math%0Aimport fractions%0A%0Aif __name__ == %22__main__%22:%0A L = 10 ** 8%0A ans = 0%0A for i in xrange(1, L + 1):%0A ans += (L / i) * i%0A if i * i %3C L:%0A j = 1%0A while j %3C= i:%0A if fractions.gcd(i, j) == 1:%0A ... | |
f6f12b1194fde3fc4dc355535ca88f472962d3a3 | add camera color histogram | python/ocv4/camera_color_histogram.py | python/ocv4/camera_color_histogram.py | Python | 0 | @@ -0,0 +1,1631 @@
+#!/usr/bin/env python%0A%0A'''%0AVideo histogram sample to show live histogram of video%0A%0AKeys:%0A ESC - exit%0A%0A'''%0A%0A# Python 2/3 compatibility%0Afrom __future__ import print_function%0A%0Aimport numpy as np%0Aimport cv2 as cv%0A%0A# built-in modules%0Aimport sys%0A%0A# local modules... | |
3ebb2731d6389170e0bef0dab66dc7c4ab41152e | Add a unit-test for thread_pool.py. | thread_pool_test.py | thread_pool_test.py | Python | 0 | @@ -0,0 +1,706 @@
+import thread_pool%0Aimport unittest%0Afrom six.moves import queue%0A%0Aclass TestThreadPool(unittest.TestCase):%0A%0A def _producer_thread(self, results):%0A for i in range(10):%0A results.put(i)%0A%0A def _consumer_thread(self, results):%0A for i in range(10):%0A self.assertEqual(... | |
f6d4116ed5122868dbc10bf41dfc44053d0a0edf | write annotation parser for PASCAL VOC 2006 | src/pascal_utils.py | src/pascal_utils.py | Python | 0 | @@ -0,0 +1,1806 @@
+import re%0A%0A%0Adef which_one(str, arr):%0A for a in arr:%0A if a in str:%0A return a%0A return ''%0A%0A%0Aclass VOC2006AnnotationParser(object):%0A SKIP_CHARACTER = '#'%0A OBJECT_SUMMARY = 'Objects with ground truth'%0A PREPEND = 'PAS'%0A TRUNC = 'Trunc'%0A ... | |
c6b1cbddec20fae0daeece0ea859a7227e16e3bf | Add primitive name space registry for event types | common/shregistry.py | common/shregistry.py | Python | 0.000001 | @@ -0,0 +1,2558 @@
+#!/usr/local/bin/python3 -u%0A__author__ = 'Oliver Ratzesberger %3Chttps://github.com/fxstein%3E'%0A__copyright__ = 'Copyright (C) 2015 Oliver Ratzesberger'%0A__license__ = 'Apache License, Version 2.0'%0A%0A# ALL event types need to be registered here%0A# ATTENTION: type must be unique to avoi... | |
167872381e16090b1b47184a1a80bbe948d5fd91 | Add test and test_suite function to svm module | scikits/learn/machine/svm/__init__.py | scikits/learn/machine/svm/__init__.py | """
A Support Vector Machine, this module defines the following classes:
- `LibSvmCClassificationModel`, a model for C-SV classification
- `LibSvmNuClassificationModel`, a model for nu-SV classification
- `LibSvmEpsilonRegressionModel`, a model for epsilon-SV regression
- `LibSvmNuRegressionModel`, a model for nu-SV r... | Python | 0.000006 | @@ -1988,16 +1988,367 @@
redict import *%0A
+%0Afrom numpy.testing import NumpyTest%0Atest = NumpyTest().test%0A%0Adef test_suite(*args):%0A # XXX: this is to avoid recursive call to itself. This is an horrible hack,%0A # I have no idea why infinite recursion happens otherwise.%0A if len(args) %3E 0:%0A ... |
5a27a8e0c7ae2e0cef787db107305251d096d81f | Add test runner. | lib/rapidsms/tests/runtests.py | lib/rapidsms/tests/runtests.py | Python | 0 | @@ -0,0 +1,97 @@
+#!/usr/bin/python %0A%0Afrom test_component import *%0A%0Aif __name__ == %22__main__%22:%0A unittest.main()%0A
| |
2f9152d5cc0ad4123522b054dd2b6458c602b1fd | add script for dataset | moses/scripts/download_dataset.py | moses/scripts/download_dataset.py | Python | 0.000001 | @@ -0,0 +1,2144 @@
+import argparse%0Aimport os%0Aimport pandas as pd%0Afrom urllib import request%0A%0A%0Adef get_parser():%0A parser = argparse.ArgumentParser()%0A%0A parser.add_argument('--output_dir', type=str, default='./data',%0A help='Directory for downloaded dataset')%0A parse... | |
19712e8e7b9423d4cb4bb22c37c7d8d2ea0559c5 | Add example to show listing of USB devices | examples/list-usb.py | examples/list-usb.py | Python | 0 | @@ -0,0 +1,1316 @@
+#!/usr/bin/env python2%0A#%0A# This file is Public Domain and provided only for documentation purposes.%0A#%0A# Run : python2 ./list-usb.py%0A#%0A# Note: This will happily run with Python3 too, I just picked a common baseline%0A#%0A%0Aimport gi%0Agi.require_version('Ldm', '0.1')%0Afrom gi.repository... | |
b56690d046021e036b5b15c484d86c92f3519600 | Add partial evaluation tool to replace functools module for python < 2.5 | scikits/learn/common/myfunctools.py | scikits/learn/common/myfunctools.py | Python | 0.000009 | @@ -0,0 +1,548 @@
+# Last Change: Mon Aug 20 01:00 PM 2007 J%0A# Implement partial application (should only be used if functools is not%0A# available (eg python %3C 2.5)%0A%0Aclass partial:%0A def __init__(self, fun, *args, **kwargs):%0A self.fun = fun%0A self.pending = args%5B:%5D%0A self.kwarg... | |
6219211d529d2dd58693ea93e6b799fd36259fee | Add tests | djangae/tests/test_async_multi_query.py | djangae/tests/test_async_multi_query.py | Python | 0.000001 | @@ -0,0 +1,1471 @@
+from django.test import override_settings%0Afrom django.db import NotSupportedError%0Afrom django.db import models%0Afrom djangae.test import TestCase%0A%0A%0Aclass MultiQueryModel(models.Model):%0A field1 = models.IntegerField()%0A%0A%0Aclass AsyncMultiQueryTest(TestCase):%0A %22%22%22%0A ... | |
51e04ff17bccb4b71b8d5db4057a782fd2f8520c | Add script to synthesize all uploaded files. Patch by Dan Callahan. | tools/touch_all_files.py | tools/touch_all_files.py | Python | 0 | @@ -0,0 +1,1039 @@
+#!/usr/bin/python%0A%22%22%22%0AThis script touches all files known to the database, creating a skeletal%0Amirror for local development.%0A%22%22%22%0A%0Aimport sys, os%0Aimport store%0A%0Adef get_paths(cursor, prefix=None):%0A store.safe_execute(cursor, %22SELECT python_version, name, filename F... | |
e8b6c596a7627d1c4f3f6915236317b0730210a2 | Rename ds_tree_max_min_depth.py to ds_tree_balanced_bt.py | leetcode/ds_tree_balanced_bt.py | leetcode/ds_tree_balanced_bt.py | Python | 0.998882 | @@ -0,0 +1,1020 @@
+# @file Balanced Binary Tree%0A# @brief Given a binary tree, determine if it is height-balanced.%0A%0A# https://leetcode.com/problems/balanced-binary-tree/%0A%0A'''%0AGiven a binary tree, determine if it is height-balanced.%0A%0AFor this problem, a height-balanced binary tree is defined%0Aas a bina... | |
484e50b34c06785f1b1b48da5502f79ee5a2357b | add factories.py | tx_salaries/factories.py | tx_salaries/factories.py | Python | 0.000001 | @@ -0,0 +1,1310 @@
+import factory%0Afrom tx_people.models import Organization, Membership, Person, Post%0Afrom tx_salaries.models import Employee, EmployeeTitle, CompensationType, OrganizationStats%0A%0A%0A# tx_people factories%0Aclass OrganizationFactory(factory.DjangoModelFactory):%0A FACTORY_FOR = Organization%0... | |
92af518e15af3d70da98302d94eefb9e25c0a771 | Raise NotImplemented on Metric base class functions | metricsapp/models/base.py | metricsapp/models/base.py | import json
from django.db import models
from django.utils import timezone
from ..data import result_data
from jsonfield import JSONField
from model_utils.managers import InheritanceManager
import requests
from ..settings import conf
class Category(models.Model):
name = models.CharField(max_length=50)
def rate(sel... | Python | 0 | @@ -1666,36 +1666,27 @@
%0A%09%09r
-eturn result_data%5Bself.name%5D
+aise NotImplemented
%0A%0A%09d
@@ -1736,30 +1736,27 @@
%0A%09%09r
-eturn 50*self.severity
+aise NotImplemented
%0A%0A%09d
|
02d6dd700af4fad74592df5576c2ca5ea8bed5fe | Update hinton_diagram.py (#342) | scripts/hinton_diagram.py | scripts/hinton_diagram.py | #https://github.com/tonysyu/mpltools/blob/master/mpltools/special/hinton.py
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import collections
from matplotlib import transforms
from matplotlib import ticker
# TODO: Add yutils.mpl._coll to mpltools and use that for square collection.
class SquareCol... | Python | 0 | @@ -1895,15 +1895,12 @@
set_
-axis_bg
+face
colo
|
2633daf169d8fc3fbe3aa0d93b5126c1e835a2a0 | Fix the form line restriction | accounting/apps/books/forms.py | accounting/apps/books/forms.py | from django.forms import ModelForm, BaseInlineFormSet
from django.forms.models import inlineformset_factory
from .models import (
Organization,
TaxRate,
TaxComponent,
Invoice,
InvoiceLine,
Bill,
BillLine,
Payment)
class RequiredFirstInlineFormSet(BaseInlineFormSet):
"""
Used t... | Python | 0.998355 | @@ -1548,16 +1548,21 @@
nization
+Mixin
(object)
@@ -1563,16 +1563,16 @@
bject):%0A
-
%0A def
@@ -1732,124 +1732,446 @@
-self.fields%5B'tax_rate'%5D.queryset = (instance%0A .invoice%0A .organization%0A
+if isinstance(instance, InvoiceLine):%0A or... |
533559e20e377ce042591709e53d7dc7031d6205 | Add test for timer automatically inserted due to directive | tests/test_directives.py | tests/test_directives.py | """tests/test_directives.py.
Tests to ensure that directives interact in the etimerpected mannor
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without... | Python | 0 | @@ -1170,19 +1170,59 @@
%0Aimport
-hug
+sys%0Aimport hug%0A%0Aapi = sys.modules%5B__name__%5D
%0A%0A%0Adef t
@@ -1466,28 +1466,172 @@
nstance(timer.start, float)%0A
+%0A @hug.get()%0A def timer_tester(timer):%0A return timer.taken()%0A%0A assert isinstance(hug.test.get(api, 'timer_tester').data, flo... |
a3939b572c51b7a721b758cb5b93364e4b156c13 | Add script that dumps the python path | dev_tools/syspath.py | dev_tools/syspath.py | Python | 0.000002 | @@ -0,0 +1,173 @@
+#!/usr/bin/env python%0A%0Aimport sys%0A%0A# path%5B0%5D, is the directory containing the script that was used to invoke the Python interpreter%0Afor s in sorted(sys.path%5B1:%5D):%0A print s%0A
| |
f06a71a87daaaf0bc4b1f5701ce4c59805b70f6b | Format all local .json files for human readability | usr/bin/json_readable.py | usr/bin/json_readable.py | Python | 0 | @@ -0,0 +1,374 @@
+#!/usr/bin/env python%0A%0Aimport json, os%0A%0Afor filename in os.listdir('.'):%0A if os.path.isfile(filename) and os.path.splitext(filename)%5B1%5D.lower() == '.json':%0A with open(filename) as in_file:%0A data = json.load(in_file)%0A with open(filename, 'w') as out_file... | |
986e830986b32eb879f05423279c96cbfe27eb14 | Fix formatting of module import in subsample unit tests | skbio/stats/tests/test_subsample.py | skbio/stats/tests/test_subsample.py | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | Python | 0.000001 | @@ -892,109 +892,33 @@
ed=%5B
-%0A 'skbio.stats.__subsample'%0A
+'skbio.stats.__subsample'
%5D)%0A%0A
|
e736772d21aea0995a1948220e2dc2c6fa413fca | Add python zookeeper example | snippet/example/python/zookeeper.py | snippet/example/python/zookeeper.py | Python | 0.000235 | @@ -0,0 +1,2588 @@
+#!/usr/bin/env python%0D%0A# encoding: utf8%0D%0Afrom __future__ import absolute_import, print_function, unicode_literals, division%0D%0A%0D%0Aimport zookeeper%0D%0A%0D%0Adef refactor_path(f):%0D%0A def wrapper(*args, **kwargs):%0D%0A _refactor = kwargs.pop(%22refactor%22, True)%0D%0A ... | |
798d9f39e9440f4f09cf83816c294f8ad9c06c4b | input api-method dummy | wa/api/input.py | wa/api/input.py | Python | 0.999994 | @@ -0,0 +1,228 @@
+import sys%0A%0Adef main(vars):%0A import os%0A import pickle%0A for var in vars:%0A variables = %7B%7D%0A var_value = input(var + %22: %22)%0A variables%5Bvar%5D = var_value%0A%0Aif __name__ == %22builtins%22:%0A main(sys.argv%5B1:%5D)%0A
| |
101d334b80872c36adb5645ba0b3cda9b7c36a61 | Add compliance with rule E261 to camo.py. | zerver/lib/camo.py | zerver/lib/camo.py | from django.conf import settings
import codecs
import hashlib
import hmac
from typing import Text
# Encodes the provided URL using the same algorithm used by the camo
# caching https image proxy
def get_camo_url(url):
# type: (Text) -> Text
# Only encode the url if Camo is enabled
if settings.CAMO_URI == ... | Python | 0 | @@ -565,16 +565,17 @@
, %22hex%22)
+
# type:
|
c78dffb9b23e38fc980c06ff519e750f5d1e3678 | add day1_short_palindrome.py - might work :) | 10-days-of-stats/day1_short_palindrome.py | 10-days-of-stats/day1_short_palindrome.py | Python | 0.000008 | @@ -0,0 +1,517 @@
+#!/usr/bin/python3%0A%0A# let's try to not do string comparisons and maybe list indexing%0A# is faster than string indexing%0As = list(map(ord, list(input())))%0A%0Aslen = len(s)%0Afound = 0%0A%0A# baseline optimization only (don't know if there is more possible)%0Afor a in range(0, slen-3):%0A fo... | |
c0220578f4cd9b4c26879548751586615fe070e8 | Add some freesurfer tools | cortex/freesurfer.py | cortex/freesurfer.py | Python | 0 | @@ -0,0 +1,1932 @@
+import os%0Aimport struct%0Aimport tempfile%0Aimport shlex%0Aimport subprocess as sp%0A%0Aimport numpy as np%0A%0Aimport vtkutils_new as vtk%0A%0Adef parse_curv(filename):%0A with open(filename) as fp:%0A fp.seek(15)%0A return np.fromstring(fp.read(), dtype='%3Ef4').byteswap()%0A%0A... | |
81806c7c66f501075937832f546765fecbd312fc | Fix HOPE tests | custom/hope/tests.py | custom/hope/tests.py |
# Built-in imports
from datetime import datetime
# Django imports
from django.test import TestCase
# External libraries
from casexml.apps.case.models import CommCareCase
# CommCare HQ imports
from corehq.apps.domain.models import Domain
from corehq.apps.users.models import WebUser
from custom.hope.models import HOP... | Python | 0.000005 | @@ -1066,90 +1066,8 @@
%22%22%0A%0A
- hope_case._HOPE_admission_date%0A hope_case._HOPE_age_of_beneficiary%0A
@@ -1098,32 +1098,32 @@
anc_doses_given%0A
+
hope_cas
@@ -1347,32 +1347,70 @@
_tt_doses_given%0A
+ hope_case._HOPE_bcg_indicator%0A
hope_cas
@@ -1435,42 +1435,8 @... |
ed4d07fb2a7fa8f1dd30a2b7982940a5fe78275b | Add the analysis driver for the run step of the study | dakota_run_driver.py | dakota_run_driver.py | Python | 0.000003 | @@ -0,0 +1,1446 @@
+#! /usr/bin/env python%0A# Brokers communication between Dakota and SWASH through files.%0A#%0A# Arguments:%0A# $1 is 'params.in' from Dakota%0A# $2 is 'results.out' returned to Dakota%0A%0Aimport sys%0Aimport os%0Aimport shutil%0Afrom subprocess import call%0A%0A%0Adef driver():%0A %22%22%22... | |
ac5f30f9d58a25476c935d5266e9948b03efebf8 | Add simple fetch tests | observatory/dashboard/tests/test_fetch.py | observatory/dashboard/tests/test_fetch.py | Python | 0 | @@ -0,0 +1,1114 @@
+import pytest%0Afrom dashboard.models import Project, Blog, Repository%0Afrom emaillist.models import EmailAddress%0Afrom django.contrib.auth.models import User%0A%0A@pytest.mark.django_db%0Adef test_fetch_warning(client):%0A%0A user = User.objects.create_user('a', 'vagrant@test.rcos.rpi.edu', 'b... | |
7af99b98a9985aa1274c56ef8333b0c57a4679c9 | add simple redis queue processor. | src/pyramid_weblayer/queue.py | src/pyramid_weblayer/queue.py | Python | 0 | @@ -0,0 +1,3209 @@
+# -*- coding: utf-8 -*-%0A%0A%22%22%22Provides a %60%60QueueProcessor%60%60 utility that consumes and processes data%0A from one or more redis channels.%0A %0A %3E%3E%3E redis_client = '%3Credis.Redis%3E instance'%0A %3E%3E%3E input_channels = %5B'channel1', 'channeln'%5D%0A %3E%3E%... | |
1975e6ebd57aac379ad19f5d4675f8f598c03c66 | add utilNetworkIP | utilNetworkIP.py | utilNetworkIP.py | Python | 0.000024 | @@ -0,0 +1,432 @@
+import socket%0Aimport fcntl%0Aimport struct%0A%0A'''%0Av0.1 2015/11/28%0A%09- add NetworkIP_get_ipAddress_eth0()%0A%09- add get_ip_address()%0A'''%0A%0Adef get_ip_address(ifname):%0A s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)%0A return socket.inet_ntoa(fcntl.ioctl(%0A s.filen... | |
d8f5b31fab57cc009e87a8d62c8d03075f66e9bd | Add solution for Project Euler problem 72 (#3122) | project_euler/problem_072/sol2.py | project_euler/problem_072/sol2.py | Python | 0 | @@ -0,0 +1,1187 @@
+%22%22%22%0AProject Euler Problem 72: https://projecteuler.net/problem=72%0A%0AConsider the fraction, n/d, where n and d are positive integers. If n%3Cd and HCF(n,d)=1,%0Ait is called a reduced proper fraction.%0A%0AIf we list the set of reduced proper fractions for d %E2%89%A4 8 in ascending order ... | |
2245bebaa87a346fe52f1cada48a817ba7af08a2 | Update message.py | tendrl/commons/message.py | tendrl/commons/message.py | import datetime
from dateutil import parser
from inspect import getframeinfo
from inspect import stack
import json
import sys
is_collectd_imported = False
if '/usr/lib64/collectd' in sys.path:
is_collectd_imported = True
sys.path.remove('/usr/lib64/collectd')
import uuid
if is_collectd_imported:
sys.path.ap... | Python | 0.000001 | @@ -3123,17 +3123,50 @@
updates,
+ job updates should have flow id,
%0A
-
@@ -3315,32 +3315,41 @@
return False%0A
+ %0A
# Check
@@ -3513,32 +3513,32 @@
return False%0A
-
%0A
@@ -3522,32 +3522,135 @@
False%0A %0A
+ if self.job_id is not None:%0A ... |
dab192db863fdd694bb0adbce10fa2dd6c05353b | Make the cli work again. | jrnl/__init__.py | jrnl/__init__.py | #!/usr/bin/env python
# encoding: utf-8
"""
jrnl is a simple journal application for your command line.
"""
__title__ = 'jrnl'
__version__ = '1.0.3'
__author__ = 'Manuel Ebert'
__license__ = 'MIT License'
__copyright__ = 'Copyright 2013 Manuel Ebert'
from . import Journal
from . import jrnl
| Python | 0 | @@ -289,8 +289,30 @@
rt jrnl%0A
+from .jrnl import cli%0A
|
959c34eeaa2d16726e5c3b4c1b13a0fbad186395 | Update errno.py (caused an error with eval()) | src/Lib/errno.py | src/Lib/errno.py | """
This module makes available standard errno system symbols.
The value of each symbol is the corresponding integer value,
e.g., on most systems, errno.ENOENT equals the integer 2.
The dictionary errno.errorcode maps numeric codes to symbol names,
e.g., errno.errorcode[2] could be the string 'ENOENT'.
Symbols that ar... | Python | 0.000001 | @@ -2747,19 +2747,19 @@
num))%0A%0Ae
-val
+xec
(';'.joi
|
b7ea4cde920a69add4cbd4cfb76c651ec77910ce | Create __init__.py | bse/data/__init__.py | bse/data/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
ed36937ff6ccb2e676236b2bd128a2bb8fa9a760 | add format_html util | dimagi/utils/html.py | dimagi/utils/html.py | Python | 0.000002 | @@ -0,0 +1,396 @@
+from __future__ import absolute_import%0Afrom django.utils.html import conditional_escape%0Afrom django.utils.safestring import mark_safe%0A%0Adef format_html(format_string, *args, **kwargs):%0A%0A escaped_args = map(conditional_escape, args)%0A escaped_kwargs = dict(%5B(key, conditional_escape... | |
8a668efbc266802a4f4e23c936d3589b230d9528 | Add blink example on two different boards | nanpy/examples/blink_2boards.py | nanpy/examples/blink_2boards.py | Python | 0 | @@ -0,0 +1,639 @@
+#!/usr/bin/env python%0A%0A# Author: Andrea Stagi %3Cstagi.andrea@gmail.com%3E%0A# Description: keeps your led blinking on 2 boards%0A# Dependencies: None%0A%0Afrom nanpy import (ArduinoApi, SerialManager)%0Afrom time import sleep%0A%0A%0Adevice_1 = '/dev/tty.usbmodem1411'%0Adevice_2 = '/dev/tty.usbm... | |
61a005ffbc988b6a20441841112890bb397f8ca3 | Create stub for 2016 NFLPool player picks | 2016_player_picks.py | 2016_player_picks.py | Python | 0 | @@ -0,0 +1,464 @@
+%0A%0Astone = %7B%22firstname%22: %22chris%22, %22lastname%22: %22stone%22, %22timestamp%22: %229/6/2016%22, %22email%22: %22stone@usisales.com%22,%0A %22afc_east_1%22: %22Patriots%22, %22afc_east_2%22: %22Jets%22, %22afc_east_last%22: %22Bills%22, %22afc_north_1%22: %22Steelers%22,%0A ... | |
893e4292f6b1799bf5f1888fcbad41ec8b5a5951 | Use Q-learning to learn all state-action values via self-play | examples/tic_ql_tabular_selfplay_all.py | examples/tic_ql_tabular_selfplay_all.py | Python | 0 | @@ -0,0 +1,641 @@
+'''%0AIn this example we use Q-learning via self-play to learn%0Athe value function of all Tic-Tac-Toe positions.%0A'''%0Afrom capstone.environment import Environment%0Afrom capstone.game import TicTacToe%0Afrom capstone.mdp import GameMDP%0Afrom capstone.rl import QLearningSelfPlay%0Afrom capstone.r... | |
af9b64bcf99d0e2c13b9b6b05a6b4029a0bb7d28 | Add theimdbapi provider, it's faster than myapifilms. | providers/moviedata/theimdbapi.py | providers/moviedata/theimdbapi.py | Python | 0 | @@ -0,0 +1,1633 @@
+import re%0Afrom providers.moviedata.provider import MoviedataProvider%0Afrom application import ACCESS_KEYS, APPLICATION as APP%0Atry:%0A from urllib import urlencode # Python 2.X%0Aexcept ImportError:%0A from urllib.parse import urlencode # Python 3+%0A%0AIDENTIFIER = %22theimdbapi%22%0A%0... | |
a8419c46ceed655a276dad00a24e21f300fda543 | Add py solution for 513. Find Bottom Left Tree Value | py/find-bottom-left-tree-value.py | py/find-bottom-left-tree-value.py | Python | 0.000235 | @@ -0,0 +1,483 @@
+# Definition for a binary tree node.%0A# class TreeNode(object):%0A# def __init__(self, x):%0A# self.val = x%0A# self.left = None%0A# self.right = None%0A%0Aclass Solution(object):%0A def findBottomLeftValue(self, root):%0A %22%22%22%0A :type root: TreeNod... | |
1e45505a94f23198d0ec464107c12d29d4d9aa16 | Add tests for libdft | pyscf/lib/dft/test/test_libdft.py | pyscf/lib/dft/test/test_libdft.py | Python | 0 | @@ -0,0 +1,1578 @@
+#!/usr/bin/env python%0A%0Aimport unittest%0Aimport ctypes%0Aimport itertools%0Aimport numpy%0Afrom pyscf.dft.numint import libdft%0A%0Aclass KnownValues(unittest.TestCase):%0A def test_empty_blocks(self):%0A ao_loc = numpy.array(%5B0,51,60,100,112,165,172%5D, dtype=numpy.int32)%0A%0A ... | |
d2aca979f2c8a711bbc139675cf699b6ce5ce53d | Update keys-and-rooms.py | Python/keys-and-rooms.py | Python/keys-and-rooms.py | # There are N rooms and you start in room 0.
# Each room has a distinct number in 0, 1, 2, ..., N-1,
# and each room may have some keys to access the next room.
#
# Formally, each room i has a list of keys rooms[i],
# and each key rooms[i][j] is an integer in [0, 1, ..., N-1]
# where N = rooms.length.
# A key rooms[i][... | Python | 0.000001 | @@ -1,8 +1,38 @@
+# Time: O(n!)%0A# Space: O(n)%0A%0A
# There
|
29a2dcf4ab6684187d95e0faab171b5e071e1eee | Create main.py | python/using_sqlalchemy01/main.py | python/using_sqlalchemy01/main.py | Python | 0.000001 | @@ -0,0 +1,368 @@
+from .models import User%0Afrom .database import session_scope%0A%0Aif __name__ == '__main__':%0A with session_scope() as session:%0A users = session.query( User ).order_by( User.id )%0A %0A # Remove all object instances from this Session to make them available to accessed by ... | |
95ff080685f01cbb368d9467f67076ce9f3eae08 | add generic resource creator | stacker_blueprints/generic.py | stacker_blueprints/generic.py | Python | 0 | @@ -0,0 +1,2244 @@
+%22%22%22 Load dependencies %22%22%22%0Afrom troposphere import (%0A Ref, Output%0A)%0A%0Afrom stacker.blueprints.base import Blueprint%0Afrom stacker.blueprints.variables.types import (%0A CFNString,%0A CFNCommaDelimitedList,%0A)%0A%0Aclass generic_resource_creator(Blueprint):%0A %22%22... | |
3dcf737fa6a6467e1c96d31325e26ecf20c50320 | Add test cases for the logger | test/test_logger.py | test/test_logger.py | Python | 0.000002 | @@ -0,0 +1,1039 @@
+# encoding: utf-8%0A%0A%22%22%22%0A.. codeauthor:: Tsuyoshi Hombashi %3Ctsuyoshi.hombashi@gmail.com%3E%0A%22%22%22%0A%0Afrom __future__ import print_function%0Afrom __future__ import unicode_literals%0A%0Aimport logbook%0Aimport pytest%0Afrom sqliteschema import (%0A set_logger,%0A set_log_lev... | |
b410facc9e7882ecec1bc1029caa3f35a3a28d03 | Test for bundle API | tests/bundle_api.py | tests/bundle_api.py | Python | 0 | @@ -0,0 +1,2667 @@
+#!/usr/bin/env python%0A%0A# pylint: disable-msg=C0103%0A%0A%22%22%22Implements an Execution Manager for the AIMES demo.%0A%22%22%22%0A%0A__author__ = %22Matteo Turilli, Andre Merzky%22%0A__copyright__ = %22Copyright 2014, RADICAL%22%0A__license__ = %22MIT%22%0A%0Aimport os%0A%0Aimport radical.utils... | |
8b0b7c19d2e2c015fd8ba7d5408b23334ee8874f | Add test case for configure failure. | test/Configure/VariantDir2.py | test/Configure/VariantDir2.py | Python | 0 | @@ -0,0 +1,1596 @@
+#!/usr/bin/env python%0A#%0A# __COPYRIGHT__%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining%0A# a copy of this software and associated documentation files (the%0A# %22Software%22), to deal in the Software without restriction, including%0A# without limitation the rights ... | |
1fd09e7328b1ebf41bc0790f2a96c18207b10077 | Add sine wave sweep test | tests/test-sweep.py | tests/test-sweep.py | Python | 0 | @@ -0,0 +1,1834 @@
+#!/usr/bin/env python%0Atry:%0A from cStringIO import StringIO%0Aexcept ImportError:%0A from io import StringIO%0A%0Aclass Makefile(object):%0A def __init__(self):%0A self._fp = StringIO()%0A self._all = set()%0A self._targets = set()%0A def add_default(self, x):%0A ... | |
93b65dd6707093487dc702fd94cdb3c6017d873b | add unit tests for translate_ix_member_name in ixapi.py | tests/test_ixapi.py | tests/test_ixapi.py | Python | 0 | @@ -0,0 +1,1714 @@
+from pyixia.ixapi import translate_ix_member_name%0Afrom nose.tools import eq_%0A%0Adef test_translate_ix_member_name():%0A eq_(translate_ix_member_name('A'), 'a')%0A eq_(translate_ix_member_name('b'), 'b')%0A eq_(translate_ix_member_name('AA'), 'aa')%0A eq_(translate_ix_member_name('bb'... | |
2e4111dda23e6d686c188cf832f7b6c7c19ea14b | Test ReadLengthStatistics | tests/test_stats.py | tests/test_stats.py | Python | 0 | @@ -0,0 +1,1517 @@
+from cutadapt.statistics import ReadLengthStatistics%0A%0A%0Aclass TestReadLengthStatistics:%0A def test_empty_on_init(self):%0A rls = ReadLengthStatistics()%0A assert rls.written_reads() == 0%0A assert rls.written_bp() == (0, 0)%0A lengths = rls.written_lengths()%0A ... | |
1165673d784eab36edcdc4ed4caf22dbd222874a | Add some preliminary code and function to enlarge image | whois-scraper.py | whois-scraper.py | Python | 0 | @@ -0,0 +1,515 @@
+from lxml import html%0Afrom PIL import Image%0Aimport requests%0A%0Adef enlarge_image(image_file):%0A%09image = Image.open(image_file)%0A%09enlarged_size = map(lambda x: x*2, image.size)%0A%09enlarged_image = image.resize(enlarged_size)%0A%0A%09return enlarged_image%0A%0Adef extract_text(image_file)... | |
65b611d3cc67d0f12007ba0eb87e2b3d2a074ff3 | Fix sanity. Adding future imports. | tensorflow/contrib/tpu/python/tpu/error_handling.py | tensorflow/contrib/tpu/python/tpu/error_handling.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Python | 0.000001 | @@ -747,16 +747,126 @@
ds.%22%22%22%0A%0A
+from __future__ import absolute_import%0Afrom __future__ import division%0Afrom __future__ import print_function%0A%0A
import c
|
d0cb5c633b5447c22b1d27da93e82151620a30e4 | Update DOI metadata for a node if it has a DOI | website/project/tasks.py | website/project/tasks.py | from django.apps import apps
import logging
import urlparse
import random
import requests
from framework.celery_tasks import app as celery_app
from website import settings, mails
from website.util.share import GraphNode, format_contributor
logger = logging.getLogger(__name__)
@celery_app.task(ignore_results=True)... | Python | 0.000002 | @@ -1210,24 +1210,121 @@
hare(node)%0A%0A
+ if node.get_identifier_value('doi'):%0A node.request_identifier_update(category='doi')%0A%0A
def update_n
|
8f4d557023a84f1b532fe0843615179ebf3194ec | add setup.py | DateObjects/setup.py | DateObjects/setup.py | Python | 0.000001 | @@ -0,0 +1,945 @@
+# coding: utf-8%0Afrom setuptools import setup%0Aimport os%0A%0A%0AREADME = os.path.join(os.path.dirname(__file__), 'README.md')%0A%0Asetup(name='date-objects',%0A version='1.0',%0A description='helper for manipulating dates.',%0A long_description=open(README).read(),%0A author=%2... | |
7d1f6125d1f56b871e8d6515e7dd1844e36968b1 | Add exception support, most code transferred from driver's code | zvmsdk/exception.py | zvmsdk/exception.py | Python | 0.000002 | @@ -0,0 +1,2511 @@
+import config%0Aimport log%0Aimport six%0A%0ACONF = config.CONF%0ALOG = log.LOG%0A%0A%0Aclass BaseException(Exception):%0A %22%22%22%0A Inherit from this class and define a 'msg_fmt' property.%0A That msg_fmt will get printf'd with the keyword arguments%0A provided to the constructor.%0A... | |
1d1f9d5d8f4873d6a23c430a5629eaeddfd50d2a | Add network set default route view | subiquity/ui/views/network_default_route.py | subiquity/ui/views/network_default_route.py | Python | 0 | @@ -0,0 +1,2562 @@
+# Copyright 2015 Canonical, Ltd.%0A#%0A# This program is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as%0A# published by the Free Software Foundation, either version 3 of the%0A# License, or (at your option) any later version.%... | |
8b8db4f78610b6c8b72270275a621d529091a74f | Set account_credit_control_dunning_fees to installable | account_credit_control_dunning_fees/__openerp__.py | account_credit_control_dunning_fees/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publi... | Python | 0.000001 | @@ -2253,20 +2253,19 @@
lable':
-Fals
+Tru
e,%0A 'aut
|
d7c46e9bc205d8f5a3cf7e1871547eff8ae7164c | Implement performance testing script | tools/test-performance.py | tools/test-performance.py | Python | 0.000002 | @@ -0,0 +1,1090 @@
+#!/usr/bin/python3%0A%0Aimport asyncio%0Aimport random%0A%0Ahost = 'localhost'%0Aport = 5027%0A%0AmessageLogin = bytearray.fromhex('000F313233343536373839303132333435')%0AmessageLocation = bytearray.fromhex('000000000000002b080100000140d4e3ec6e000cc661d01674a5e0fffc00000900000004020100f0000242322318... | |
2c57f2143e21fa3d006d4e4e2737429fb60b4797 | Call pip install before running server. | tornado/setup_pg.py | tornado/setup_pg.py | from os.path import expanduser
from os import kill
import subprocess
import sys
import time
python = expanduser('~/FrameworkBenchmarks/installs/py2/bin/python')
cwd = expanduser('~/FrameworkBenchmarks/tornado')
def start(args, logfile, errfile):
subprocess.Popen(
python + " server.py --port=8080 --postg... | Python | 0 | @@ -1,54 +1,13 @@
-from os.path import expanduser%0Afrom os import kill
+import os
%0Aimp
@@ -50,17 +50,26 @@
e%0A%0A%0A
-python =
+bin_dir = os.path.
expa
@@ -118,104 +118,333 @@
/bin
-/
+')%0A
python
-')%0Acwd = expanduser('~/FrameworkBenchmarks/tornado')%0A%0A%0Adef start(args, logfile, errfile):
+ = os.path.e... |
046920217192081d628370898857581fb8d5ec28 | Fix wrong teleport message (#3935) | pokemongo_bot/cell_workers/follow_path.py | pokemongo_bot/cell_workers/follow_path.py | # -*- coding: utf-8 -*-
import gpxpy
import gpxpy.gpx
import json
from pokemongo_bot.base_task import BaseTask
from pokemongo_bot.cell_workers.utils import distance, i2f, format_dist
from pokemongo_bot.human_behaviour import sleep
from pokemongo_bot.step_walker import StepWalker
from pgoapi.utilities import f2i
clas... | Python | 0 | @@ -580,24 +580,16 @@
points)%0A
-
%0A
@@ -2707,28 +2707,16 @@
'lng'%5D)%0A
-
%0A
@@ -4080,18 +4080,15 @@
ed=%22
-Teleported
+Walking
fro
|
640c86e17b10d8f892a4036ade4ce7b8dca30347 | Implement dragon-blood-clan module. | gygax/modules/dbc.py | gygax/modules/dbc.py | Python | 0 | @@ -0,0 +1,1025 @@
+# -*- coding: utf-8 -*-%0A%0A%22%22%22%0A:mod:%60gygax.modules.dbc%60 --- Module for playing Dragon-Blood-Clan.%0A==================================================================%0A%22%22%22%0A%0Aimport gygax.modules.roll as roll%0A%0Adef dbc(bot, sender, text):%0A need = 6 # The next die... | |
2d81274953629e34cc4b0232782cb910d1d459c9 | Add process_watcher mod (triggers Process.Creation event) | modder/mods/process_watcher.py | modder/mods/process_watcher.py | Python | 0 | @@ -0,0 +1,1332 @@
+# coding: utf-8%0Aimport atexit%0Aimport platform%0A%0Afrom modder import on, trigger%0A%0Aif platform.system() == 'Windows':%0A import pythoncom%0A import wmi%0A%0A @on('Modder.Started')%0A def watch_process_creation(event):%0A pythoncom.CoInitialize()%0A atexit.register(p... | |
03618b710146cdfacb7a8913a65809227e71546c | add test | tests/transforms_tests/image_tests/test_ten_crop.py | tests/transforms_tests/image_tests/test_ten_crop.py | Python | 0.000002 | @@ -0,0 +1,616 @@
+import unittest%0A%0Aimport numpy as np%0A%0Afrom chainer import testing%0Afrom chainercv.transforms import ten_crop%0A%0A%0Aclass TestTenCrop(unittest.TestCase):%0A%0A def test_ten_crop(self):%0A img = np.random.uniform(size=(3, 48, 32))%0A%0A out = ten_crop(img, (48, 32))%0A ... | |
4835cac3b5ea15671f3da25cbc6e6db4bad725c9 | Create crawl-twse.py | crawl/crawl-twse.py | crawl/crawl-twse.py | Python | 0.000001 | @@ -0,0 +1,330 @@
+req=requests.get(%22http://www.twse.com.tw/ch/trading/fund/BFI82U/BFI82U.php?report1=day&input_date=105%252F05%252F31&mSubmit=%25ACd%25B8%25DF&yr=2016&w_date=20160530&m_date=20160501%22)%0Areq.encoding='utf-8'%0Ahtml=req.text.encode('utf-8')%0Asoup=BeautifulSoup(html,%22html.parser%22)%0Afor td in so... | |
bd597a8f34d6f95bc445550bcc239ff67d0321f4 | Add missing file. | tests/tests/utils.py | tests/tests/utils.py | Python | 0.000001 | @@ -0,0 +1,346 @@
+from django.db import connection%0Afrom django.utils import six%0A%0A%0Adef get_table_list():%0A with connection.cursor() as cursor:%0A table_list = connection.introspection.get_table_list(cursor)%0A if table_list and not isinstance(table_list%5B0%5D, six.string_types):%0A table_l... | |
4592684c869780d81cb3521ee57d4efab8138c74 | Fix event | cupy/cuda/stream.py | cupy/cuda/stream.py | from cupy.cuda import runtime
class Event(object):
"""CUDA event, a synchronization point of CUDA streams.
This class handles the CUDA event handle in RAII way, i.e., when an Event
instance is destroyed by the GC, its handle is also destroyed.
Args:
block (bool): If True, the event blocks o... | Python | 0.998788 | @@ -1,8 +1,23 @@
+import ctypes%0A%0A
from cup
@@ -802,32 +802,68 @@
process=False):%0A
+ self.ptr = runtime.Event()%0A%0A
if inter
@@ -997,18 +997,19 @@
((block
-or
+and
runtime
@@ -1013,27 +1013,25 @@
ime.
-EVENT_BLOCKING_SYNC
+eventBlockingSync
) %7C%0A
@@ -1062,18 +1062,19 @@
_timing
-or
+... |
be904e21db2012ac8f72a141afd9b93da2bfb262 | Create http responses | monarch/base/http/responses.py | monarch/base/http/responses.py | Python | 0 | @@ -0,0 +1,3201 @@
+# Copyright (C) 2015 David Barrag%C3%A1n %3Cbameda@dbarragan.com%3E%0A#%0A# This program is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as%0A# published by the Free Software Foundation, either version 3 of the%0A# License, or (... | |
72fcb82d33c4a4317630b6f2c7985e69ff9d3ce3 | add some simple tests for lru_cache | src/unittest/python/backport_tests.py | src/unittest/python/backport_tests.py | Python | 0 | @@ -0,0 +1,1158 @@
+#!/usr/bin/env python%0Afrom __future__ import print_function%0A%0Aimport sys%0Aimport unittest%0A%0Afrom backports import functools_lru_cache%0A%0Aclass Test(unittest.TestCase):%0A def test_with_bound_cache(self):%0A @functools_lru_cache.lru_cache()%0A def cachy(*args):%0A ... | |
75a2c6fb7074e316908d12cfd6f1e03d9e0a1ba6 | add new tool to generate new pipeline easily (outside of sequana repository) | sequana/scripts/start_pipeline.py | sequana/scripts/start_pipeline.py | Python | 0 | @@ -0,0 +1,1750 @@
+# -*- coding: utf-8 -*-%0A#%0A# This file is part of Sequana software%0A#%0A# Copyright (c) 2016 - Sequana Development Team%0A#%0A# File author(s):%0A# Thomas Cokelaer %3Cthomas.cokelaer@pasteur.fr%3E%0A# Dimitri Desvillechabrol %3Cdimitri.desvillechabrol@pasteur.fr%3E, %0A# %3... | |
48c139172e2eab43919ac9589ee58e3ff2009887 | Work in progress | lexicon/providers/azure.py | lexicon/providers/azure.py | Python | 0.000003 | @@ -0,0 +1,2176 @@
+import json%0Aimport requests%0A%0Afrom lexicon.providers.base import Provider as BaseProvider%0A%0AMANAGEMENT_URL = 'https://management.azure.com'%0AAPI_VERSION = '2018-03-01-preview'%0ANAMESERVER_DOMAINS = %5B'azure.com'%5D%0A%0A%0Adef provider_parser(subparser):%0A subparser.add_argument('--au... | |
4485e7dd4b6d5a6199d99cdc9a852ff551fc384b | bump version number | client/version.py | client/version.py | ELECTRUM_VERSION = "0.37"
SEED_VERSION = 4 # bump this everytime the seed generation is modified
| Python | 0.000004 | @@ -20,9 +20,9 @@
%220.3
-7
+8
%22%0ASE
|
e4979853bab394902394a35778d970ca2ccb20cb | Fix import of File class | tvrenamr/frontend.py | tvrenamr/frontend.py | #!/usr/bin/env python
import logging
import os
import sys
from .config import Config
from .episode import File
from .errors import *
from .logs import start_logging
from .main import TvRenamr
from .options import OptionParser
log = logging.getLogger('FrontEnd')
parser = OptionParser()
options, args = parser.parse... | Python | 0.000002 | @@ -84,34 +84,8 @@
fig%0A
-from .episode import File%0A
from
@@ -151,16 +151,22 @@
n import
+ File,
TvRenam
|
6486487dc1fc4972dcd18bc0e92bcae602f4d900 | Create blacklist.py | cogs/blacklist.py | cogs/blacklist.py | Python | 0.000006 | @@ -0,0 +1 @@
+%0A
| |
b02e308dfc2993123486a5660b6d14c98f19b389 | Create Hamel_ZipCode_API.py | Hamel_ZipCode_API.py | Hamel_ZipCode_API.py | Python | 0.000005 | @@ -0,0 +1,3001 @@
+def back_out_unicode(stringval):%0A return str(stringval.encode('utf-8').decode('ascii', 'ignore'))%0A%0Adef zip_info(zipcode):%0A %22%22%22%0A Takes a zip code and goes to www.uszip.com/zip/*zipcode and%0A screen scrapes relevant information down. *zipcode is the 5-digit zipcode param... | |
9ec957af0c3d57dff4c05c1b7ed3e66e1c033f6b | Add nagios check for idot snowplow ingest | nagios/check_idot_snowplows.py | nagios/check_idot_snowplows.py | Python | 0 | @@ -0,0 +1,656 @@
+%22%22%22%0A Nagios check to see how much snowplow data we are currently ingesting%0A%22%22%22%0Aimport sys%0Aimport os%0Aimport psycopg2%0A%0APOSTGIS = psycopg2.connect(database='postgis', host='iemdb', user='nobody')%0Apcursor = POSTGIS.cursor()%0A%0Apcursor.execute(%22%22%22%0A select count(*) fro... | |
661e69ece73a609d230384874da9722de385d854 | Change links to a dictionary, iterator instead of lambda | uoftscrapers/scrapers/libraries/__init__.py | uoftscrapers/scrapers/libraries/__init__.py | from ..utils import Scraper
from bs4 import BeautifulSoup, NavigableString
from datetime import datetime, date
from collections import OrderedDict
import urllib.parse as urlparse
from urllib.parse import urlencode
import re
class Libraries:
"""A scraper for the Libraries at the University of Toronto."""
host =... | Python | 0 | @@ -382,16 +382,22 @@
tags = %7B
+%0A %09
'St. Geo
@@ -410,16 +410,22 @@
'UTSG',
+%0A %09
'U of T
@@ -445,16 +445,22 @@
'UTM',
+%0A %09
'U of T
@@ -479,16 +479,22 @@
: 'UTSC'
+%0A %09
%7D%0A%0A @
@@ -626,16 +626,57 @@
cation)%0A
+ %09return Libraries.get_library_link()%0A
%09# %5B
@... |
717b20e298547685ed0685bd09a4fac541034910 | Add an example map flow | example/map_flows.py | example/map_flows.py | Python | 0.000001 | @@ -0,0 +1,435 @@
+from taskin import task%0A%0A%0Adef get_servers(data):%0A return %5B%0A 'foo.example.com',%0A 'bar.example.com',%0A %5D%0A%0A%0Adef create_something(data):%0A servers, name = data%0A for server in servers:%0A print('Creating: https://%25s/%25s' %25 (server, name))%0A%... | |
cd2df0032a3978444d6bd15e3b49a20bef495b75 | add blastp | Modules/f10_blast.py | Modules/f10_blast.py | Python | 0.000433 | @@ -0,0 +1,1759 @@
+import subprocess,os%0A%0Adef makeblastdb(fastaFile,datatype,outputname):%0A %22%22%22%0A this function build database given a fasta file%0A %0A * fastaFile: can be gzipped or not%0A %22%22%22%0A if fastaFile.endswith('.gz'):%0A cmd = ('gunzip -c %7Binput%7D %7C makeblastdb ... | |
7dac3075874a79d51d1b9d0c1551eec9a988f526 | Create Roman_to_Integer.py | Array/Roman_to_Integer.py | Array/Roman_to_Integer.py | Python | 0.000617 | @@ -0,0 +1,671 @@
+Given a roman numeral, convert it to an integer.%0AInput is guaranteed to be within the range from 1 to 3999.%0A%0Aclass Solution:%0A # @return an integer%0A def romanToInt(self, s):%0A numerals = %7B %22M%22: 1000, %0A %22D%22: 500, %0A %22C%22: 1... | |
c810882385e034ca0e888ce093b227198dbb5f76 | Create GPIOTutorialtempLogger.py | GPIOTutorialtempLogger.py | GPIOTutorialtempLogger.py | Python | 0.000004 | @@ -0,0 +1,748 @@
+import RPi.GPIO as GPIO%0Aimport time as time%0AGPIO.setmode (GPIO.BCM)%0AGPIO.setup (22, GPIO.IN )%0AGPIO.setup (17,GPIO.OUT )%0A%0Awhile True:%0A if GPIO.input(22):%0A break%0A%0Aprint %22start%22%0A%0Adatafile = open (%22tempreading.log%22,%22w%22)%0A%0Awhile True:%0A GPIO.output (17,... | |
7b54ac1d1bf8cf6e9869e716940814d2d56cb1de | Create Watchers.py | examples/Watchers.py | examples/Watchers.py | Python | 0.000001 | @@ -0,0 +1,703 @@
+%0Alos = %5B%5D%0Aurl = 'https://stocktwits.com/symbol/'%0Aworkbook = openpyxl.load_workbook('Spreadsheet.xlsx')%0Aworksheet = workbook.get_sheet_by_name(name = 'Sheet1') %0Afor col in worksheet%5B'A'%5D:%0A los.append(col.value)%0Alos2 = %5B%5D%0Aprint(los)%0A%0A%0Afor i in los:%0A stocksite = ... | |
b44977653e57077118cb0eb0d549758f52beed35 | Add basic example | examples/examples.py | examples/examples.py | Python | 0.000159 | @@ -0,0 +1,158 @@
+from pyrho import *%0A%0ARhO = models%5B'6'%5D()%0AProt = protocols%5B'step'%5D()%0AProt.phis = %5B1e16, 1e15, 1e14%5D%0ASim = simulators%5B'Python'%5D(Prot, RhO)%0ASim.run()%0ASim.plot()%0A
| |
61139332ce1bcfd145f16b8f3c411e178db4054c | Add some unit tests for the hashing protocol of dtype (fail currently). | numpy/core/tests/test_dtype.py | numpy/core/tests/test_dtype.py | Python | 0.000115 | @@ -0,0 +1,2447 @@
+import numpy as np%0Afrom numpy.testing import *%0A%0Aclass TestBuiltin(TestCase):%0A def test_run(self):%0A %22%22%22Only test hash runs at all.%22%22%22%0A for t in %5Bnp.int, np.float, np.complex, np.int32, np.str, np.object,%0A np.unicode%5D:%0A dt = np... | |
3d11000488ca20e7e34a9f7030a16e69a6b4052f | add examples for trainig 3 | 3-python-intermediate/examples/list_comprehension.py | 3-python-intermediate/examples/list_comprehension.py | Python | 0 | @@ -0,0 +1,386 @@
+%0Aodd = %5Bi for i in range(10) if i %25 2%5D%0Aprint(odd) # %5B1, 3, 5, 7, 9%5D%0A%0Aodd_squares = %5Bi ** 2 for i in odd%5D%0Aprint(odd_squares) # %5B1, 9, 25, 49, 81%5D%0A%0A%0Afirst_names = %5B'Bruce', 'James', 'Alfred'%5D%0Alast_names = %5B'Wayne', 'Gordon', 'Pennyworth'%5D%0A%0Aheroes = %5B'... | |
0886a4efd7b7703d72be4319d7b0295d3bc64151 | Create Tensor_Case.py | Tensor_Case.py | Tensor_Case.py | Python | 0.000039 | @@ -0,0 +1,553 @@
+import tensorflow as tf%0A%0Asess = tf.InteractiveSession()%0Ax = tf.random_uniform(%5B%5D)%0Ay = tf.random_uniform(%5B%5D)%0Aout1 = tf.cond(tf.greater(x,y), lambda:tf.add(x,y), lambda:(tf.subtract(x,y)))%0Aprint(x.eval(), y.eval(), out1.eval())%0A%0Ax = tf.random_uniform(%5B%5D,-1,1)%0Ay = tf.random... | |
dfa492ffc2148d8ffa5c14145e0092be60ef44eb | add an example for pipeline | examples/pipeline.py | examples/pipeline.py | Python | 0.000001 | @@ -0,0 +1,879 @@
+import tornado%0Aimport tornadis%0A%0A%0A@tornado.gen.coroutine%0Adef pipeline_coroutine():%0A # Let's get a connected client%0A client = tornadis.Client()%0A yield client.connect()%0A%0A # Let's make a pipeline object to stack commands inside%0A pipeline = tornadis.Pipeline()%0A pi... | |
b75601e0c6bbb83dba4544f9d80b6f71c75fcdec | add missing ordered field to startup program interest | web/impact/impact/migrations/0003_add_ordered_field_to_startup_program_interest.py | web/impact/impact/migrations/0003_add_ordered_field_to_startup_program_interest.py | Python | 0 | @@ -0,0 +1,495 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.3 on 2018-01-30 10:37%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('impact', '0002_set_models_to_managed'),%0A %5D%0... | |
105e5adbb7831442c9925aa812f711a9f020dfa4 | Fix login tests for proper handling of LDAP exceptions. | okupy/tests/unit/test_login.py | okupy/tests/unit/test_login.py | # vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python
from django.conf import settings
from django.contrib.auth.models import User
from django.core import mail
from django.core.urlresolvers import resolve
from django.template import RequestContext
from django.test.utils import override_settings
from base64 import b64e... | Python | 0 | @@ -5803,16 +5803,46 @@
GIN_BOB,
+%0A
message
@@ -5966,39 +5966,84 @@
ge(response,
- 'Login failed'
+%0A %22Can't contact the LDAP server or the database%22
, 40)%0A%0A d
@@ -6077,27 +6077,24 @@
raises_l
-ogin_failed
+daperror
_in_logi
@@ -6331,39 +6331,84 @@
ge(respon... |
c3e7b563c3eeb24aa269f23672b8f469470908b7 | Add an option to redirect user to a page if the key is already expired. | onetime/views.py | onetime/views.py | from datetime import datetime
from django.http import HttpResponseRedirect, HttpResponseGone
from django.shortcuts import get_object_or_404
from django.contrib.auth import login
from django.conf import settings
from onetime import utils
from onetime.models import Key
def cleanup(request):
utils.cleanup()
def lo... | Python | 0 | @@ -329,19 +329,45 @@
est, key
+, redirect_expired_to=None
):%0A
-
data
@@ -402,16 +402,36 @@
y=key)%0A%0A
+ expired = False%0A
if d
@@ -495,33 +495,22 @@
-return HttpResponseGone()
+expired = True
%0A
@@ -573,16 +573,179 @@
.now():%0A
+ expired = True%0A%0A if expired:%0A if... |
92077ecd268a6ca04f2b413fd3535d4cc358c97b | Create serializers.py | app/grandchallenge/algorithms/serializers.py | app/grandchallenge/algorithms/serializers.py | Python | 0.000002 | @@ -0,0 +1,510 @@
+from rest_framework import serializers%0Afrom grandchallenge.algorithms.models import Algorithm, Job, Result%0A%0A%0Aclass AlgorithmSerializer(serializers.ModelSerializer):%0A class Meta:%0A model = Algorithm%0A fields = %5B'pk'%5D%0A%0A%0Aclass ResultSerializer(serializers.ModelSeri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.