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 |
|---|---|---|---|---|---|---|---|
d199510ab03975832b262cbc2160c3d6f3371e8d | Add solution in Python | codeforces/dominated_subarray.py | codeforces/dominated_subarray.py | Python | 0.004351 | @@ -0,0 +1,1460 @@
+def read_first_line():%0A return int(input())%0A%0A%0Adef read_cases(number_of_cases):%0A cases = %5B%5D%0A for i in range(number_of_cases):%0A line = input()%0A if i %25 2 == 1:%0A case = %5Bint(string) for string in line.strip().split(' ')%5D%0A cases.a... | |
6a8ff154b8468d61b18d390db9e710fc0b224ac7 | Add Left-Handed toons crawler | comics/comics/lefthandedtoons.py | comics/comics/lefthandedtoons.py | Python | 0 | @@ -0,0 +1,730 @@
+%0Afrom comics.aggregator.crawler import CrawlerBase, CrawlerResult%0Afrom comics.meta.base import MetaBase%0A%0Aclass Meta(MetaBase):%0A name = 'Left-Handed Toons'%0A language = 'en'%0A url = 'http://www.lefthandedtoons.com/'%0A start_date = '2007-01-14'%0A rights = 'Justin & Drew'%0A... | |
59e8fe848da5cfa3874c82776205082764efbe63 | Enable Jenkins Python3 monster for i19 | tests/test_python3_regression.py | tests/test_python3_regression.py | Python | 0 | @@ -0,0 +1,392 @@
+from __future__ import absolute_import, division, print_function%0A%0Adef test_no_new_python3_incompatible_code_is_introduced_into_this_module():%0A import i19%0A import pytest%0A import dials.test.python3_regression as py3test%0A result = py3test.find_new_python3_incompatible_code(i19)%0A if re... | |
0c3f3c444d863ec4acff704efee71a29ab8cdf34 | Add ip_reverse module | plugins/modules/ip_reverse.py | plugins/modules/ip_reverse.py | Python | 0 | @@ -0,0 +1,2118 @@
+#!/usr/bin/python%0Afrom __future__ import (absolute_import, division, print_function)%0A%0Afrom ansible.module_utils.basic import AnsibleModule%0A%0A__metaclass__ = type%0A%0ADOCUMENTATION = '''%0A---%0Amodule: ip_reverse%0Ashort_description: Modify reverse on IP%0Adescription:%0A - Modify rever... | |
c5ac422ff1e4628ad8ea53e4f1442e6a70bf959f | add first command test | tests/test_commands.py | tests/test_commands.py | Python | 0.000016 | @@ -0,0 +1,598 @@
+import unittest%0A%0A%0Aclass CreateRangeVotingCommand():%0A def __init__(self, question, choices):%0A self.question = question%0A self.choices = choices%0A%0A%0Aclass CreateRangeVotingCommandTestCase(unittest.TestCase):%0A def test_has_choices_and_question(self):%0A questi... | |
391e145b6e82aaa87e2ab23cfea53cb7ae98bc2a | Add a work-in-progress parser for the ClientHello message. | tlsenum/parse_hello.py | tlsenum/parse_hello.py | Python | 0.000006 | @@ -0,0 +1,828 @@
+import construct%0A%0Afrom tlsenum import hello_constructs%0A%0A%0Aclass ClientHello(object):%0A%0A @property%0A def protocol_version(self):%0A return self._protocol_version%0A%0A @protocol_version.setter%0A def protocol_version(self, protocol_version):%0A assert protocol_ve... | |
764bad33b598841333d4d1674bf5667957ada551 | Add a no-op measurement | tools/perf/measurements/no_op.py | tools/perf/measurements/no_op.py | Python | 0.000014 | @@ -0,0 +1,550 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0Afrom telemetry.page import page_measurement%0A%0Aclass NoOp(page_measurement.PageMeasurement):%0A def __init__(self):%0A super... | |
a704a1964659a45b007e696ed1547b563dcffa4f | create 2.py | 2.py | 2.py | Python | 0 | @@ -0,0 +1,10 @@
+# content%0A
| |
a1db6c4379c787124d7ee825adbcc76d2069a3c6 | Add check to travis to make sure new boards are built, fix #1886 | tools/travis_new_boards_check.py | tools/travis_new_boards_check.py | Python | 0 | @@ -0,0 +1,1192 @@
+#! /usr/bin/env python3%0A%0Aimport os%0Aimport re%0Aimport json%0A%0Aimport build_board_info%0A%0A# Get boards in json format%0Aboards_info_json = build_board_info.get_board_mapping()%0A# print(boards_info_json)%0A%0A# TODO (Carlos) Find all the boards on the json format%0A%0A# We need to know the ... | |
9a1c9e2cbe7f9b9decbe93d567458b6a6976e420 | complete 14 longest collatz sequence | 14-longest-collatz-sequence.py | 14-longest-collatz-sequence.py | Python | 0.000092 | @@ -0,0 +1,588 @@
+from functools import lru_cache%0A%0Adef sequence(n):%0A 'bad idea'%0A while n is not 1:%0A yield n%0A n = 3*n+1 if n%252 else n/2%0A yield n%0A%0Adef next_num(n):%0A if n %25 2:%0A return 3 * n + 1%0A else:%0A return n / 2%0A%0A@lru_cache(None)%0Adef collat... | |
9392f7215c77749f94908e8f4c0899a712177bfe | Hello, Flask | app.py | app.py | Python | 0.999123 | @@ -0,0 +1,146 @@
+from flask import Flask%0A%0Aapp = Flask(__name__)%0A%0A@app.route('/')%0Adef index():%0A return %22Hello, world!%22%0A%0Aif __name__ == '__main__':%0A app.run()%0A
| |
3f5a752a7978c2432ce3106492d771c00a5f1279 | Create geo.py | geo.py | geo.py | Python | 0.000006 | @@ -0,0 +1,964 @@
+import requests%0A%0A%0Adef example():%0A # grab some lat/long coords from wherever. For this example,%0A # I just opened a javascript console in the browser and ran:%0A #%0A # navigator.geolocation.getCurrentPosition(function(p) %7B%0A # console.log(p);%0A # %7D)%0A #%0A la... | |
1110311ef90a45497af4cdfb8558d1b05fc799d0 | add a script to run the server | run.py | run.py | Python | 0.000001 | @@ -0,0 +1,1174 @@
+#!/usr/bin/env python%0A# coding: utf-8%0A%0Aimport bottle%0Afrom logging import info%0A%0Afrom devmine import Devmine%0Afrom devmine.config import (%0A environment,%0A settings%0A)%0A%0A%0Adef main():%0A info('Devmine server started')%0A db_url = settings.db_url%0A server = settings.... | |
e007695e38b2207c9229856c95f37a12e740cb91 | Add view demographics tests | radar/tests/permissions/test_can_user_view_demographics.py | radar/tests/permissions/test_can_user_view_demographics.py | Python | 0 | @@ -0,0 +1,2350 @@
+from radar.permissions import can_user_view_demographics%0Afrom radar.roles import COHORT_RESEARCHER, COHORT_SENIOR_RESEARCHER, ORGANISATION_CLINICIAN%0Afrom helpers.permissions import make_cohorts, make_user, make_patient, make_organisations%0A%0A%0Adef test_admin():%0A patient = make_patient()%... | |
a46f2b8e42852b3c51d31c9402328c82d5d1f78c | Create new package. (#8144) | var/spack/repos/builtin/packages/swap-assembler/package.py | var/spack/repos/builtin/packages/swap-assembler/package.py | Python | 0 | @@ -0,0 +1,1835 @@
+##############################################################################%0A# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
2904992eb431ac4a92442ccb1fcff5715ae8c7fa | add migrations for new policy parameters | webapp/apps/taxbrain/migrations/0035_auto_20161110_1624.py | webapp/apps/taxbrain/migrations/0035_auto_20161110_1624.py | Python | 0 | @@ -0,0 +1,990 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0Aimport webapp.apps.taxbrain.models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('taxbrain', '0034_auto_20161004_1953'),%0A %5D%0A%0A operati... | |
b068e4f8c3e5e8d7a0f1c45d5f1b6ac424b44153 | Make validate recipients to ignore empty values | src/ggrc/models/comment.py | src/ggrc/models/comment.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: andraz@reciprocitylabs.com
# Maintained By: andraz@reciprocitylabs.com
"""Module containing comment model and comment related mixins."""
from sqla... | Python | 0.000001 | @@ -877,16 +877,60 @@
.%0A %22%22%22%0A
+ # pylint: disable=too-few-public-methods%0A%0A
VALID_
@@ -1351,86 +1351,274 @@
alue
- and set(value.split(',')).issubset(self.VALID_RECIPIENTS):%0A return
+:%0A value = set(name for name in value.split(%22,%22) if name)%0A%0A if value and value.issubset(sel... |
8840340bbd8310cf03f12accbb51dd81921ccf86 | Fix use of `format` for unicode | src/ggrc/models/request.py | src/ggrc/models/request.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: vraj@reciprocitylabs.com
from ggrc import db
from .mixins import deferred, Base, Described
class Request(... | Python | 0.001803 | @@ -1923,16 +1923,17 @@
return
+u
'Request
|
dbc761530b77c606038f62ed498c192b67321e8f | Test co2 load_data for Python 3. | statsmodels/datasets/tests/test_data.py | statsmodels/datasets/tests/test_data.py | Python | 0 | @@ -0,0 +1,160 @@
+from statsmodels.datasets import co2%0A%0Adef test_co2_python3():%0A # this failed in pd.to_datetime on Python 3 with pandas %3C= 0.12.0%0A dta = co2.load_pandas()%0A
| |
efc935b030750c26e24217d5f97dde1dc8a7ea66 | add script to clone mvn dependency to local from gradle | python/mirror-mvn-dependency.py | python/mirror-mvn-dependency.py | Python | 0 | @@ -0,0 +1,2556 @@
+#!/usr/bin/python%0A%22%22%22%0AThis script is used to make a mirror maven repository from a gradle build%0A%0A1. make sure your project can be build correctly%0A2. run this script in your project root directory%0A3. add following code to your gradle file%0A%0A%09buildscript %7B%0A%09%09repositories... | |
1b2c67a0d4a237ce56dc40616b1a023b515aee0f | add setup.py | sldc/setup.py | sldc/setup.py | Python | 0.000001 | @@ -0,0 +1,222 @@
+from distutils.core import setup%0A%0Asetup(name=%22sldc%22,%0A version=%221.0%22,%0A description=%22Segment Locate Dispatch Classify workflow%22,%0A author=%22Romain Mormont%22,%0A author_email=%22romain.mormont@gmail.com%22,%0A )%0A
| |
bb065a747215b6665eec78c5141b0a0d82296dac | Add migration to replace '<removed>' with '<removed>@{uuid}.com'.format(uuid=str(uuid4())) in contact_information.email to pass validation | migrations/versions/1400_repair_contact_information_emails_post_data_retention_removal.py | migrations/versions/1400_repair_contact_information_emails_post_data_retention_removal.py | Python | 0.000054 | @@ -0,0 +1,1471 @@
+%22%22%22Replace '%3Cremoved%3E' with '%3Cremoved%3E@%7Buuid%7D.com'.format(uuid=str(uuid4())) in contact_information to pass validation.%0A%0ARevision ID: 1400%0ARevises: 1390%0ACreate Date: 2019-10-29 09:09:00.000000%0A%0A%22%22%22%0Afrom uuid import uuid4%0Afrom alembic import op%0Aimport sqlalch... | |
434827540d4e11254615cd52b7efb36b746f9d0d | Create tf_simple_LR.py | tf_simple_LR.py | tf_simple_LR.py | Python | 0.000401 | @@ -0,0 +1,1144 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Mon Aug 1 19:50:54 2016%0A%0A@author: max%0A%22%22%22%0A%0Aimport tensorflow as tf%0Aimport numpy as np%0A%0Aimport matplotlib.pylab as m%0A%0Ax_data = np.linspace(0.0,1.0,num = 500,dtype='float32')%0Ax_data = np.reshape(x_data,(500,))%0Ay_data = np.... | |
3fb15a0e2fd4b1c9d6fb90ea5db92e99fda578c7 | Create topKFrequent.py | topKFrequent.py | topKFrequent.py | Python | 0 | @@ -0,0 +1,775 @@
+#%0A# Given a non-empty array of integers, return the k most frequent elements.%0A# %0A# For example,%0A# Given %5B1,1,1,2,2,3%5D and k = 2, return %5B1,2%5D.%0A# %0A# Note: %0A# You may assume k is always valid, 1 %E2%89%A4 k %E2%89%A4 number of unique elements.%0A# Your algo... | |
3190b1e90c4f5de71e766fc97acb6c03b5c6888b | Create tweet-ip.py | tweet-ip.py | tweet-ip.py | Python | 0.002257 | @@ -0,0 +1,1469 @@
+from twitter import *%0Aimport subprocess%0Afrom random import randint%0Aimport time%0A%0Aimport urllib2%0A%0Adef internet_on():%0A try:%0A response=urllib2.urlopen('http://twitter.com',timeout=1)%0A return True%0A except urllib2.URLError as err: pass%0A return False%0A%0Adef ... | |
d7a5743bf92627280c2067be7dc496cd81b8353c | add unit tests file | unit_tests.py | unit_tests.py | Python | 0 | @@ -0,0 +1,117 @@
+import pytest%0A%0Ar = pytest.main(%5B%22-s%22, %22tests/unit%22%5D)%0Aif r:%0A raise Exception(%22There were test failures or errors.%22)
| |
5a2042ebd62cefdda82b6e288b4b6d5b0f527fcd | Add script to add uplaoders to a repo | repomgmt/management/commands/repo-add-uploader.py | repomgmt/management/commands/repo-add-uploader.py | Python | 0 | @@ -0,0 +1,1140 @@
+#%0A# Copyright 2012 Cisco Systems, Inc.%0A#%0A# Author: Soren Hansen %3Csorhanse@cisco.com%3E%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A... | |
09c8399092c3c97be068051306fda057170cf290 | Add LPC residual computation. | scikits/talkbox/linpred/common.py | scikits/talkbox/linpred/common.py | Python | 0 | @@ -0,0 +1,972 @@
+from scipy.signal import lfilter%0Afrom scikits.talkbox.linpred import lpc%0A%0Adef lpcres(signal, order, axis = -1):%0A %22%22%22Compute the LPC residual of a signal.%0A%0A The LPC residual is the 'error' signal from LPC analysis, and is defined%0A as:%0A%0A res%5Bn%5D = x%5Bn%5D - x... | |
1afe54b237724ce8f06379ef461e5d849ddeec74 | Add Persian Badwords | revscoring/languages/persian.py | revscoring/languages/persian.py | import warnings
import enchant
from .language import Language, LanguageUtility
DICTIONARY = enchant.Dict("fa")
def is_misspelled_process():
def is_misspelled(word):
return not DICTIONARY.check(word)
return is_misspelled
is_misspelled = LanguageUtility("is_misspelled", is_misspelled_process,
... | Python | 0.999746 | @@ -111,134 +111,563 @@
a%22)%0A
-%0Adef is_misspelled_process():%0A def is_misspelled(word):%0A return not DICTIONARY.check(word)%0A return is_misspelled%0A
+BADWORDS = set(%5B%0A %22%DA%A9%DB%8C%D8%B1%D9%85%22, %22%D8%A7%DB%8C%D8%AA%D8%A7%D9%84%DB%8C%DA%A9%22, %22%DA%A9%D9%88%D9%86%DB%8C%22, %22%DA%A... |
4fe8df5d09c554b45d5097ca0574b47703c9b581 | Add another simpler test for %f | tests/strings/string_format_f_simple.py | tests/strings/string_format_f_simple.py | Python | 0.000159 | @@ -0,0 +1,152 @@
+a = 1.123456%0Ab = 10%0Ac = -30%0Ad = 34%0Ae = 123.456789%0Af = 892122.129899%0A%0A# form 0%0As = %22b=%25f%22 %25 a%0Aprint s%0A%0A# form 1%0As = %22b,c,d=%25f+%25f+%25f%22 %25 (a, e, f)%0Aprint s%0A
| |
215822f6edb48f156a15548ff40d21d76e14d692 | Add markdown as submodule | dash_core_components/markdown/__init__.py | dash_core_components/markdown/__init__.py | Python | 0.000005 | @@ -0,0 +1,338 @@
+from .Markdown import Markdown%0A%0Afrom .. import _js_dist%0Afrom .. import _css_dist%0A%0A_js_dist.append(%0A %7B%0A 'relative_package_path': 'highlight.pack.js',%0A 'namespace': 'dash_core_components'%0A %7D%0A)%0A%0A_css_dist.append(%0A %7B%0A 'relative_package_path'... | |
3657eed1c0f0cf29be85bce03983e5b2c2581b9b | test showing bug in cyl mesh face inner product | tests/mesh/test_cylMeshInnerProducts.py | tests/mesh/test_cylMeshInnerProducts.py | Python | 0 | @@ -0,0 +1,1986 @@
+from SimPEG import Mesh%0Aimport numpy as np%0Aimport sympy%0Afrom sympy.abc import r, t, z%0Aimport unittest%0A%0ATOL = 1e-1%0A%0Aclass CylInnerProducts_Test(unittest.TestCase):%0A%0A def test_FaceInnerProduct(self):%0A # Here we will make up some j vectors that vary in space%0A # ... | |
8ad86651a9d07984c0b1afb0ec7e400288ac6d2e | add pyRpc2 | python/proto/pyRpc2/__init__.py | python/proto/pyRpc2/__init__.py | Python | 0.999108 | @@ -0,0 +1,1396 @@
+#!/usr/bin/env python%0A# -*- encoding: utf-8 -*-%0A#%0A# Copyright (c) 2016 ASMlover. All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that the following conditions%0A# are met:%0A#%0A# * Redistributions of sou... | |
89e158a7baf24666754b723695bc1f2a728f7ef1 | Test initialization of categorical node | bayespy/inference/vmp/nodes/tests/test_categorical.py | bayespy/inference/vmp/nodes/tests/test_categorical.py | ######################################################################
# Copyright (C) 2014 Jaakko Luttinen
#
# This file is licensed under Version 3.0 of the GNU General Public
# License. See LICENSE for a text of the license.
######################################################################
####################... | Python | 0 | @@ -6503,24 +6503,468 @@
%5B7, 12%5D%5D)%0A%0A pass%0A
+%0A%0A def test_initialization(self):%0A %22%22%22%0A Test initialization of categorical nodes%0A %22%22%22%0A%0A # Test initialization from random%0A Z = Categorical(%5B%5B0.0, 1.0, 0.0%5D,%0A ... |
47c2a98d28c8e592035761b4ecfcd1026038fd14 | Add an option to not automatically record interaction for gesture actions. | tools/telemetry/telemetry/page/actions/gesture_action.py | tools/telemetry/telemetry/page/actions/gesture_action.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.
from telemetry.page.actions import page_action
from telemetry.page.actions import wait
from telemetry import decorators
from telemetry.page.actions import ac... | Python | 0.000018 | @@ -535,16 +535,130 @@
ibutes)%0A
+ if not hasattr(self, 'automatically_record_interaction'):%0A self.automatically_record_interaction = True%0A%0A
if h
@@ -1167,24 +1167,73 @@
__.__name__%0A
+%0A if self.automatically_record_interaction:%0A
runner.B
@@ -1290,16 +1290,17 @@
MOOTH%5D)%0A
+%0A
... |
20a191ad9325909434a6ca806ef69c515cbce6a8 | add new package (#24749) | var/spack/repos/builtin/packages/py-neurokit2/package.py | var/spack/repos/builtin/packages/py-neurokit2/package.py | Python | 0 | @@ -0,0 +1,1183 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0Afrom spack import *%0A%0A%0Aclass PyNeurokit2(PythonPackage):%0A %22%22%22The Python Tool... | |
2322b349aac06395382d26a95b5d965ab0f0b326 | Test save, load functionality in Statespace | statsmodels/tsa/statespace/tests/test_save.py | statsmodels/tsa/statespace/tests/test_save.py | Python | 0 | @@ -0,0 +1,2295 @@
+%22%22%22%0ATests of save / load / remove_data state space functionality.%0A%22%22%22%0A%0Afrom __future__ import division, absolute_import, print_function%0A%0Aimport numpy as np%0Aimport pandas as pd%0Aimport os%0A%0Afrom statsmodels import datasets%0Afrom statsmodels.tsa.statespace import (sarima... | |
58624ba3b267fdc0e1ae6d8509c0a1315f22c22f | Initialize P4_autoDownloadTorrent | books/AutomateTheBoringStuffWithPython/Chapter16/PracticeProjects/P4_autoDownloadTorrent.py | books/AutomateTheBoringStuffWithPython/Chapter16/PracticeProjects/P4_autoDownloadTorrent.py | Python | 0.000004 | @@ -0,0 +1,741 @@
+# Write a program that checks an email account every 15 minutes for any instructions%0A# you email it and executes those instructions automatically.%0A#%0A# For example, BitTorrent is a peer-to-peer downloading system. Using free BitTorrent%0A# software such as qBittorrent, you can download large med... | |
db2135d269058ed381239e725797322b95072d3f | Predict some data similar to problem on assignment | outlier_detection/svm_classification_with_synthetic_data.py | outlier_detection/svm_classification_with_synthetic_data.py | Python | 0.999856 | @@ -0,0 +1,1017 @@
+import numpy as np%0Afrom matplotlib import pyplot as plt%0Aimport matplotlib.font_manager%0Afrom sklearn import svm%0A%0A%0Adef main():%0A tests = 20%0A%0A # Generate train data%0A X = (np.random.randn(120, 2) * %0A np.array(%5B0.08, 0.02%5D) + %0A np.array(%5B0.3, 0.6%... | |
a2f20be78ad54a6fe118b197cc416dcfdfb6dddf | add tf test file | TF-Demo/AlexNetDemo/test_tf.py | TF-Demo/AlexNetDemo/test_tf.py | Python | 0 | @@ -0,0 +1,726 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A# Author: violinsolo%0A# Created on 28/12/2017%0A%0Aimport tensorflow as tf%0Aimport numpy as np%0A%0Ax = %5B%5D%0Afor i in range(0, 20):%0A x += %5Bi%5D%0A%0Aprint x%0A%0A# trans to float32%0Ax1 = np.asarray(x, dtype=np.float32)%0Aprint 'new x:'%0Apri... | |
404f95c637590e6fa5b51a3246c5bdc56a602ba4 | Add an e2e test | test_caniusepython3.py | test_caniusepython3.py | # Copyright 2014 Google Inc. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | Python | 0.000741 | @@ -617,16 +617,26 @@
as ciu%0A%0A
+import io%0A
import t
@@ -659,16 +659,37 @@
nittest%0A
+import unittest.mock%0A
%0A%0AEXAMPL
@@ -5090,16 +5090,162 @@
ects))%0A%0A
+ @unittest.mock.patch('sys.stdout', io.StringIO())%0A def test_e2e(self):%0A ciu.main(%5B'--projects', 'numpy,scipy,matplotlib,ipython... |
0e2a2b8c173d382da9e256a91b10e267228bbd2c | Update import_timeseries.py | ddsc_core/management/commands/import_timeseries.py | ddsc_core/management/commands/import_timeseries.py | #from adaptor.model import CsvDbModel
from django.core.management.base import BaseCommand
from ddsc_core.models.models import Timeseries, Source, Location, IdMapping
from django.contrib.auth.models import User
from ddsc_core.models.aquo import Unit, Parameter, Compartment, MeasuringDevice, MeasuringMethod
from dds... | Python | 0.000001 | @@ -393,16 +393,23 @@
security
+.models
import
|
f81a8d33c4865f51750ae4168e0646979e6eb262 | Translate original pseudocode algorithms | hearsay.py | hearsay.py | Python | 0.999999 | @@ -0,0 +1,2100 @@
+__all__ = %5B'Detect', 'DistToReference', 'Dist', 'ProbClass'%5D%0A%0A%0Aimport math%0A%0A%0Adef Detect(s_inf, N_obs, R_pos, R_neg, gamma=1, theta=1, D_req=1):%0A %22%22%22Algorithm 1%0A%0A Perform online binary classification on the infinite stream s_inf using%0A sets of positive and negat... | |
9ad5cf7a663b83b725f0ae19d5190e0d6634fbb4 | exhaustive n by m test | blaze/api/tests/test_into_exhaustive.py | blaze/api/tests/test_into_exhaustive.py | Python | 0.999616 | @@ -0,0 +1,967 @@
+from __future__ import absolute_import, division, print_function%0A%0Afrom dynd import nd%0Aimport numpy as np%0Afrom pandas import DataFrame%0A%0Afrom blaze.api.into import into, discover%0Afrom datashape import dshape%0Aimport blaze%0Afrom blaze import Table%0Aimport bcolz%0A%0A%0AL = %5B(1, 'Alice... | |
5856ceb23cf639ee1cc3ea45d81a1917c0ef031d | Make a pnacl-finalize tool, that runs the final steps for pnacl ABI stability. | pnacl/driver/pnacl-finalize.py | pnacl/driver/pnacl-finalize.py | Python | 0.000665 | @@ -0,0 +1,1826 @@
+#!/usr/bin/python%0A# Copyright (c) 2013 The Native Client Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A#%0A# IMPORTANT NOTE: If you make local mods to this file, you must run:%0A# %25 pnacl/build.sh driv... | |
7f65c70b786024e8213c56448f8d715bda8c0197 | add jsonrpc | skitai/saddle/jsonrpc_executor.py | skitai/saddle/jsonrpc_executor.py | Python | 0.000002 | @@ -0,0 +1,2278 @@
+from . import wsgi_executor%0D%0Atry:%0D%0A import jsonrpclib%0D%0Aexcept ImportError:%0D%0A pass%0D%0Afrom aquests.protocols.http import respcodes%0D%0A%0D%0Aclass Executor (wsgi_executor.Executor): %0D%0A def __call__ (self):%0D%0A request = self.env %5B%22skitai.was%22%5D.reque... | |
26ff3cbfcd9aee35da3645573c01717518467e8d | Create main.py | unit-3-mixed-reading-and-assignment-lessons/lesson-4-assignment-multiple-code-blocks/main.py | unit-3-mixed-reading-and-assignment-lessons/lesson-4-assignment-multiple-code-blocks/main.py | Python | 0.000001 | @@ -0,0 +1,381 @@
+class Operation(object):%0A def __init__(self, *args):%0A # Do something here%0A pass%0A%0A def operate(self):%0A raise NotImplementedError()%0A%0A%0Aclass AddOperation(Operation):%0A # The only method present in this class%0A def operate(self):%0A pass%0A%0A%0... | |
c95772e8b3119f464dba4b8fd864812a525a4379 | add tests | tests/test_core.py | tests/test_core.py | Python | 0 | @@ -0,0 +1,593 @@
+# -*- coding: utf-8 -*-%0Afrom saltmill import Mill%0Afrom pepper import PepperException%0Aimport pytest%0A%0A%0Adef test_login():%0A mill = Mill()%0A mill.login()%0A%0Adef test_auto_login():%0A mill = Mill()%0A MSG = 'This is a test.'%0A ret = mill.local('*', 'test.echo',MSG)%0A as... | |
83cfb4d135b5eb3eaa4efb3f74ce13d44afb4c5a | Add a test for __main__ | tests/test_main.py | tests/test_main.py | Python | 0.00053 | @@ -0,0 +1,168 @@
+import pytest%0A%0Afrom cutadapt.__main__ import main%0A%0A%0Adef test_help():%0A with pytest.raises(SystemExit) as e:%0A main(%5B%22--help%22%5D)%0A assert e.value.args%5B0%5D == 0%0A%0A
| |
0a5ab42263c508cb46e59dfeab00b6b3c2591120 | Fix message | tests/twisted/connect/test-nonblocking-tls.py | tests/twisted/connect/test-nonblocking-tls.py |
"""
Test connecting to a server with 2 accounts. Check one account does not block
the second account.
"""
import os
import sys
import dbus
import servicetest
import twisted
from twisted.words.xish import domish, xpath
from twisted.words.protocols.jabber import xmlstream
from gabbletest import make_connection, make_... | Python | 0.000001 | @@ -566,21 +566,23 @@
est-
-connect-twice
+nonblocking-tls
.py
|
0275556bcb29f4468c4a7e5b0771686c031e3c94 | Add context test. | demos/context.py | demos/context.py | Python | 0.000003 | @@ -0,0 +1,335 @@
+#!/usr/bin/env python%0A%0Aimport fluidsynth%0A%0Asettings = fluidsynth.FluidSettings()%0A%0Asettings%5B%22synth.chorus.active%22%5D = %22off%22%0Asettings%5B%22synth.reverb.active%22%5D = %22off%22%0Asettings%5B%22synth.sample-rate%22%5D = 22050%0A%0Asynth = fluidsynth.FluidSynth(settings)%0A%0Adriv... | |
eb15e17e99212f2d779ef33a1a9dfa7293ad96ad | Add `ProtectedFieldsMixin` for use with `ChangeProtected`s | shoop/core/utils/form_mixins.py | shoop/core/utils/form_mixins.py | Python | 0 | @@ -0,0 +1,2227 @@
+# -*- coding: utf-8 -*-%0A# This file is part of Shoop.%0A#%0A# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.%0A#%0A# This source code is licensed under the AGPLv3 license found in the%0A# LICENSE file in the root directory of this source tree.%0A%0Afrom django.utils.translation import ug... | |
9a82eb7fe4f587b00cca155b84a36c6d590e0e16 | Add tests to patterns | tests/test_patterns.py | tests/test_patterns.py | Python | 0.000001 | @@ -0,0 +1,2488 @@
+from bottery import patterns%0A%0A%0Adef test_message_handler_check_positive_match():%0A message = type('Message', (), %7B'text': 'ping'%7D)%0A handler = patterns.MessageHandler(pattern='ping')%0A assert handler.check(message)%0A%0A%0Adef test_message_handler_check_negative_match():%0A m... | |
2087394a69b3d4ca47e441b2561a0645c9a99e68 | Add test_recharge | tests/test_recharge.py | tests/test_recharge.py | Python | 0 | @@ -0,0 +1,325 @@
+import pastas as ps%0Aimport pandas as pd%0A%0Adef test_linear():%0A index = pd.date_range(%222000-01-01%22, %222000-01-10%22)%0A prec = pd.Series(%5B1, 2%5D * 5, index=index)%0A evap = prec / 2%0A rm = ps.RechargeModel(prec=prec, evap=evap, rfunc=ps.Exponential,%0A ... | |
170373e6f0a1a416a50e16a3fbfb6a2da2b2e700 | Add Site traversal object | usingnamespace/api/traversal/v1/site.py | usingnamespace/api/traversal/v1/site.py | Python | 0 | @@ -0,0 +1,1890 @@
+import logging%0Alog = logging.getLogger(__name__)%0A%0Afrom pyramid.compat import string_types%0A%0Afrom .... import models as m%0A%0Aclass Site(object):%0A %22%22%22Site%0A%0A Traversal object for a site ID%0A %22%22%22%0A%0A __name__ = None%0A __parent__ = None%0A%0A def __init_... | |
97fe3384b0e614e17010623af5bccf515ce21845 | Migrate jupyter_{notebook => server}_config.py | .jupyter/jupyter_server_config.py | .jupyter/jupyter_server_config.py | Python | 0.000001 | @@ -0,0 +1,702 @@
+# https://jupyter-server.readthedocs.io/en/stable/operators/migrate-from-nbserver.html%0A%0A#c.ServerApp.browser = 'chromium-browser'%0A#c.ServerApp.terminado_settings = %7B %22shell_command%22: %5B%22/usr/bin/env%22, %22bash%22%5D %7D%0Ac.ServerApp.open_browser = False%0Ac.ServerApp.port_retries = 0... | |
d4541113581433b63f19f23a9bde249acf8324a8 | Add a vizualization tool | tools/visualize.py | tools/visualize.py | Python | 0.000011 | @@ -0,0 +1,1033 @@
+#!/usr/bin/python%0A%0Aimport matplotlib.pyplot as plt%0Aimport sys%0A%0Aif len(sys.argv) %3C 2:%0A print %22Usage: vizualize.py file1%5B:label1%5D file2%5B:label2%5D ...%22%0A%0Acolors = %5B'g', 'b', 'r', '#F800F0', '#00E8CC', '#E8E800'%5D%0Amarkers = %7B 'I' : '*', 'P' : 's', 'B' : 'o' %7D%0A%0... | |
5fc7fa839616213d07ad85e164f6639ff1225065 | Add override for createsuperuser | src/sentry/management/commands/createsuperuser.py | src/sentry/management/commands/createsuperuser.py | Python | 0.000001 | @@ -0,0 +1,418 @@
+from __future__ import absolute_import, print_function%0A%0Afrom django.core.management import call_command%0Afrom django.contrib.auth.management.commands.createsuperuser import Command%0A%0A%0Aclass Command(Command):%0A help = 'Performs any pending database migrations and upgrades'%0A%0A def h... | |
4f2df39d909632e0d7a25c739daf8f2c1fa52cbb | Use prints and str.format | tvrenamr/config.py | tvrenamr/config.py | import logging
import sys
from yaml import safe_load
from .errors import ShowNotInConfigException
class Config(object):
def __init__(self, config):
self.log = logging.getLogger('Config')
self.config = self._load_config(config)
self.log.debug('Config loaded')
self.defaults = s... | Python | 0.000001 | @@ -1529,35 +1529,36 @@
print
-
+(
''
+)
%0A pri
@@ -1555,33 +1555,32 @@
print
- '-' *
+('-'*
79
+)
%0A
@@ -1585,17 +1585,17 @@
print
-
+(
' Malfor
@@ -1634,16 +1634,17 @@
easons:'
+)
%0A
@@ -1657,17 +1657,17 @@
rint
-
+(
'-' * 79
%0A
@@ -1662,16 +16... |
7f860b23975150642bd6f8d244bce96d401603b0 | Improve the help text for the rdp options | nova/conf/rdp.py | nova/conf/rdp.py | # Copyright 2015 OpenStack Foundation
# 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 requ... | Python | 0.957736 | @@ -760,15 +760,19 @@
elp=
-'
+%22%22%22%0A
Enable
+s
RDP
@@ -788,18 +788,425 @@
features
-')
+%0A%0AHyper-V, unlike the majority of the hypervisors employed on%0ANova compute nodes, uses RDP instead of VNC and SPICE as a%0Adesktop sharing protocol to provide instance console access.%0AThis option enables RDP for ... |
2a635a797a9828e047aff6c57b375138f0cd7ed0 | 206.reverse-ll | 206.reverse-ll/206.reverse-ll.py | 206.reverse-ll/206.reverse-ll.py | Python | 0.999977 | @@ -0,0 +1,744 @@
+# Definition for singly-linked list.%0A# class ListNode:%0A# def __init__(self, x):%0A# self.val = x%0A# self.next = None%0A%0Adef show(head):%0A out = %22%22%0A while head:%0A out += %22 %22 + str(head.val)%0A head = head.next%0A print(out)%0A%0Aclass Solutio... | |
e7d86c77471d3b0890287e0ca32ecfb94b80abda | add util method for Leave One Out crossvalidation | scikits/learn/utils/crossval.py | scikits/learn/utils/crossval.py | Python | 0.000005 | @@ -0,0 +1,1859 @@
+# Author: Alexandre Gramfort %3Calexandre.gramfort@inria.fr%3E%0A# License: BSD Style.%0A%0A# $Id: cd.py 473 2010-03-03 16:27:38Z twigster $%0A%0Aimport numpy as np%0Aimport exceptions%0A%0Aclass LOO:%0A %22%22%22%0A Leave-One-Out cross validation:%0A Provides train/test indexes to split da... | |
e42fcd8a7dfd213c3de8ccc925410ab3dfe68a3c | Test Lemniscate of Bernoulli trajectory | src/test/trajectory/test_lemniscate_trajectory.py | src/test/trajectory/test_lemniscate_trajectory.py | Python | 0.000123 | @@ -0,0 +1,1955 @@
+#!/usr/bin/env python%0Aimport unittest%0A%0Afrom geometry_msgs.msg import Point%0A%0Afrom trajectory.lemniscate_trajectory import LemniscateTrajectory%0A%0A%0Aclass LemniscateTrajectoryTest(unittest.TestCase):%0A%0A def setUp(self):%0A self.trajectory = LemniscateTrajectory(5, 4)%0A ... | |
7b4107cfb465faf70110b72da9b655758d62d9b3 | add extraction tool as per request from Renee | scripts/mec/extract_rshowers.py | scripts/mec/extract_rshowers.py | Python | 0 | @@ -0,0 +1,1624 @@
+import pytz%0Aimport datetime%0Aimport psycopg2%0Apgconn = psycopg2.connect(host='127.0.0.1', port=5555, user='mesonet', database='mec')%0Acursor = pgconn.cursor()%0A%0Adates = %22%22%2206-02-2008 00z - 06-07-2008 06z%0A06-09-2008 00z - 06-14-2008 06z%0A06-23-2008 00z - 06-25-2008 06z%0A07-04-2008 0... | |
74bfc85ef4533e93a4edf4c16e5a7a6bb175f36b | Simplify the view as the validation logic has already moved to the model | onetime/views.py | onetime/views.py | from datetime import datetime
from django.http import HttpResponseRedirect, HttpResponseGone
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 login(request, key, redirect_invalid_to=None, red... | Python | 0.000001 | @@ -47,16 +47,30 @@
p import
+ HttpResponse,
HttpRes
@@ -124,21 +124,16 @@
trib
-.auth
import
logi
@@ -128,21 +128,20 @@
import
-login
+auth
%0Afrom dj
@@ -271,112 +271,145 @@
p()%0A
-%0Adef login(request, key, redirect_invalid_to=None, redirect_expired_to=None):%0A data = Key.objects.get
+ return Ht... |
159b971ae95501f9093dedb881ed030eed74241e | Create __init__.py | docs/__init__.py | docs/__init__.py | Python | 0.000429 | @@ -0,0 +1,366 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0A sphinxcontrib%0A ~~~~~~~~~~~~~%0A%0A This package is a namespace package that contains all extensions%0A distributed in the %60%60sphinx-contrib%60%60 distribution.%0A%0A :copyright: Copyright 2007-2009 by the Sphinx team, see AUTHORS.%0A :lice... | |
88d4139fdfdcb11be7cbe42fe1223cfde5752950 | debug path | pyethereum/config.py | pyethereum/config.py |
import os
import uuid
import StringIO
import ConfigParser
from pyethereum.utils import default_data_dir
from pyethereum.packeter import Packeter
from pyethereum.utils import sha3
def default_config_path():
return os.path.join(default_data_dir, 'config.txt')
def default_client_version():
return Packeter.CLI... | Python | 0.000001 | @@ -1715,27 +1715,8 @@
)):%0A
- print cfg_path%0A
|
7f0658ee700174bae100a12b8c8c22377e829d6f | Create BlepiInit.py | BlepiInit.py | BlepiInit.py | Python | 0 | @@ -0,0 +1,436 @@
+import sqlite3%0A%0Aconnection = sqlite3.connect('/home/pi/blepimesh/data/client.db')%0A%0Acursor = connection.cursor()%0A%0Aprint %22Adding Data To DB%22%0A%0A%0Acursor.execute(%22INSERT INTO log(tagDate) values(date('now'))%22)%0Acursor.execute(%22INSERT INTO log values('5',date('now'),time('now')... | |
b5fda5ff78f97c7bdd23f3ca4ed2b2d2ab33d101 | Create _init_.py | luowang/tools/tree-tagger-windows-3.2/TreeTagger/bin/_init_.py | luowang/tools/tree-tagger-windows-3.2/TreeTagger/bin/_init_.py | Python | 0.000145 | @@ -0,0 +1 @@
+%0A
| |
f3fbb6ca517314ab7ac1330e766da1de89970e13 | Add debug plugin | plugins/debug.py | plugins/debug.py | Python | 0.000001 | @@ -0,0 +1,431 @@
+import time%0A%0Aclass Plugin:%0A def __call__(self, bot):%0A bot.on_respond(r%22ping$%22, lambda bot, msg, reply: reply(%22PONG%22))%0A bot.on_respond(r%22echo (.*)$%22, lambda bot, msg, reply: reply(msg%5B%22match%22%5D.group(1)))%0A bot.on_respond(r%22time$%22, lambda bot, ... | |
1a7acfd59f48522f0dda984b2f33d20d843ee8ba | set up role.py | pycanvas/role.py | pycanvas/role.py | Python | 0.000002 | @@ -0,0 +1,140 @@
+from canvas_object import CanvasObject%0Afrom util import combine_kwargs%0A%0Aclass Role(CanvasObject):%0A%0A def __str__(self):%0A return %22%22%0A
| |
df7b60767ac00beb81e48b245ac79f5c8fe7db64 | Revert "Temporarily disable custom 404 handler to debug an issue" | pydotorg/urls.py | pydotorg/urls.py | from django.conf.urls import include, url, handler404
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.static import static
from django.views.generic.base import TemplateView, RedirectView
from django.conf import settings
from cms.views import c... | Python | 0 | @@ -455,78 +455,8 @@
er%0A%0A
-# TODO: Disable this temporarily to debug #28488 in Django tracker.%0A#
hand
|
4b3e9cca98adca34f12967392f1e98d6fc57440b | Remove redundant assert. | speech/unit_tests/test__gax.py | speech/unit_tests/test__gax.py | # Copyright 2016 Google Inc.
#
# 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 agreed to in writing, ... | Python | 0.00012 | @@ -6090,81 +6090,8 @@
%5B1%5D%0A
- self.assertIsInstance(config_request, StreamingRecognizeRequest)%0A
|
0d85832a82c0973c89f3f321e1f2e2486a197882 | Add script to perform partial upload | bin/partial_upload.py | bin/partial_upload.py | Python | 0 | @@ -0,0 +1,1971 @@
+#!/bin/env python%0A# -*- coding: utf8 -*-%0A%22%22%22 Triggers a partial upload process with the specified raw.xz URL. %22%22%22%0A%0Aimport argparse%0A%0Afrom fedimg.config import AWS_ACCESS_ID%0Afrom fedimg.config import AWS_SECRET_KEY%0Afrom fedimg.config import AWS_BASE_REGION, AWS_REGIONS%0Afr... | |
1a49426497819c13ccf858d51e5fa333d95f1f7d | Add basic unit test for parseCommand | src/autobot/src/udpRemote_test.py | src/autobot/src/udpRemote_test.py | Python | 0.000001 | @@ -0,0 +1,802 @@
+#!/usr/bin/env python%0A%0Aimport unittest%0Afrom udpRemote import parseCommand%0A%0A%0Aclass MockDriveParam:%0A velocity = 0.0%0A angle = 0.0%0A%0A%0Aclass UdpRemoteTest(unittest.TestCase):%0A def testValidParse(self):%0A p = MockDriveParam()%0A p = parseCommand(%22V44.4%22, p... | |
5b899181f14c65778f23312ddd31078fac46cd9c | Fix template filter. | django_assets/filter.py | django_assets/filter.py | """Django specific filters.
For those to be registered automatically, make sure the main
django_assets namespace imports this file.
"""
from django.template import Template, Context
from webassets import six
from webassets.filter import Filter, register_filter
class TemplateFilter(Filter):
"""
Will compile ... | Python | 0 | @@ -742,81 +742,8 @@
%7B%7D))
-%0A%0A if not six.PY3:%0A rendered = rendered.encode('utf-8')
%0A
|
8a0fbe899739d0b19525ab2873d7dd9073675466 | Fix Python 3.4 test failure | ironic/drivers/modules/msftocs/msftocsclient.py | ironic/drivers/modules/msftocs/msftocsclient.py | # Copyright 2015 Cloudbase Solutions Srl
# 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 r... | Python | 0.999998 | @@ -2437,15 +2437,15 @@
ex.
-message
+args%5B0%5D
)%0A%0A
|
d843a2198b87a41d73ab19e09ac8d0c78a6e0ef9 | Create IC74139.py | BinPy/examples/ic/Series_7400/IC74139.py | BinPy/examples/ic/Series_7400/IC74139.py | Python | 0.000001 | @@ -0,0 +1,884 @@
+from __future__ import print_function%0Afrom BinPy import *%0Aprint ('Usage of IC 74139:%5Cn')%0A%0Aic = IC_74139()%0Aprint (%22%22%22This is a dial 1:4 demultiplexer(2:4 decoder) with output being inverted input%22%22%22%22)%0Aprint ('%5CnThe Pin configuration is:%5Cn')%0Ap = %7B1:0,2:0,3:0,14:0,13:... | |
dcd19e7982024f4f196f24b71fc2d73bef6723eb | add new package (#25505) | var/spack/repos/builtin/packages/cupla/package.py | var/spack/repos/builtin/packages/cupla/package.py | Python | 0 | @@ -0,0 +1,1564 @@
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other%0A# Spack Project Developers. See the top-level COPYRIGHT file for details.%0A#%0A# SPDX-License-Identifier: (Apache-2.0 OR MIT)%0A%0A%0Afrom spack import *%0A%0A%0Aclass Cupla(Package):%0A %22%22%22C++ User interface for t... | |
adcf089505f089ff93a48ee2672ce9d8b9b4fadf | corrects typo | axelrod/tournament.py | axelrod/tournament.py | """Recreate Axelrod's tournament."""
import inspect
class Game(object):
"""A class to hold the game matrix and to score a game accordingly."""
def __init__(self, r=2, s=0, t=5, p=4):
self.scores = {
('C', 'C'): (r, r),
('D', 'D'): (p, p),
('C', 'D'): (t, s),
... | Python | 0.999712 | @@ -3791,10 +3791,8 @@
n%22%22%22
-%C2%A7%C2%A7
%0A
|
7e5b4e178a5d36ca89034287168560a73bd9e63d | Create drivers.py | chips/sensor/lis3dh/drivers.py | chips/sensor/lis3dh/drivers.py | Python | 0.000001 | @@ -0,0 +1,96 @@
+# This code has to be added to the corresponding __init__.py%0A%0ADRIVERS%5B%22lis3dh%22%5D = %5B%22LIS3DH%22%5D%0A%0A
| |
f342dbf8d9455db91286823ec5d6ef64e2ace68c | Create MCP3202.py | Other_Applications/Ultrasonic/MCP3202.py | Other_Applications/Ultrasonic/MCP3202.py | Python | 0.000005 | @@ -0,0 +1,1395 @@
+#!/usr/bin/python%0Aimport RPi.GPIO as GPIO%0Aimport time%0Aimport datetime%0Aimport os%0Afrom time import strftime%0A%0ACS = 4%0ACS2 = 7%0ACLK = 11%0AMOSI = 10%0AMISO = 9%0ALDAC = 8%0A%0AGPIO.setwarnings(False)%0AGPIO.setmode(GPIO.BCM)%0AGPIO.setup(CS, GPIO.OUT)%0AGPIO.setup(CLK, GPIO.OUT)%0AGPIO.s... | |
64b842d0af6c4e07971a733d8ed6e70109e26979 | Add sample logging | samples/sample_logging.py | samples/sample_logging.py | Python | 0 | @@ -0,0 +1,1370 @@
+#!/usr/bin/env python%0A#%0A# Author: Ying Xiong.%0A# Created: Dec 04, 2015.%0A%0Aimport logging%0Aimport sys%0A%0Aclass DebugOrInfoFilter(logging.Filter):%0A %22%22%22Keep the record only if the level is debug or info.%22%22%22%0A def filter(self, record):%0A return record.levelno in (... | |
a6fcf0fdc9a97773453f8ca17ddb071d1a2dfd79 | hello world | contact/app.py | contact/app.py | Python | 0.999981 | @@ -0,0 +1,179 @@
+from flask import Flask%0A%0Aapp = Flask(__name__)%0A%0A%0A@app.route('/')%0Adef hello_world():%0A return %22Hello world!%22%0A%0A%0Aif __name__ == '__main__':%0A app.run(host='0.0.0.0', debug=True)%0A
| |
4f0b6a6eefd6848a702fe4b808f137ef0b2ee2f8 | rename as "config.py" after adding keys | exampleconfig.py | exampleconfig.py | Python | 0.000047 | @@ -0,0 +1,138 @@
+URL_F = 'http://datamine.mta.info/mta_esi.php?key='KEY'&feed_id=21'%0A%0AURL_AC = 'http://datamine.mta.info/mta_esi.php?key='KEY'&feed_id=26'%0A
| |
85daad5401267b613e546896bb2abd1658f730b1 | Create 1_triple_step.py | ch09/1_triple_step.py | ch09/1_triple_step.py | Python | 0.000006 | @@ -0,0 +1,769 @@
+# 0 - (1) %5B0%5D%0A# 1 - (1) %5B1%5D%0A# 2 - (2) %5B1, 1%5D, %5B2%5D %0A# 3 - (4) %5B1, 1, 1%5D, %5B1, 2%5D, %5B2, 1%5D, %5B3%5D%0A# 4 - %0A%0A#subtract 1%0A#subtract 2%0A#subtract 3%0A%0Aways = %7B0: 0, 1:1, 2: 2, 3: 4%7D%0A%0Adef calculate_ways(steps):%0A if steps %3C 4:%0A return ways%5... | |
3e51c57a8611a8ebfb4f2eb045510c50587bd781 | Test password tokens not in response | api/radar_api/tests/test_users.py | api/radar_api/tests/test_users.py | Python | 0.000001 | @@ -0,0 +1,449 @@
+import json%0A%0Afrom radar_api.tests.fixtures import get_user%0A%0A%0Adef test_serialization(app):%0A admin = get_user('admin')%0A%0A client = app.test_client()%0A client.login(admin)%0A%0A response = client.get('/users')%0A%0A assert response.status_code == 200%0A%0A data = json.l... | |
3660767a92750eae3c3ede69ef6778a23d3074a7 | Add the Action enum | wdim/client/actions.py | wdim/client/actions.py | Python | 0.000001 | @@ -0,0 +1,84 @@
+import enum%0A%0A%0Aclass Action(enum.Enum):%0A create = 0%0A delete = 1%0A update = 2%0A
| |
71bab0603cbf52d6b443cfff85ef19a04f882a36 | Add the SQL statements because I forgot | inventory_control/database/sql.py | inventory_control/database/sql.py | Python | 0.000837 | @@ -0,0 +1,1413 @@
+%22%22%22%0ASo this is where all the SQL commands live%0A%22%22%22%0A%0ACREATE_SQL = %22%22%22%0ACREATE TABLE component_type (%0A id INT PRIMARY KEY AUTO_INCREMENT,%0A type VARCHAR(255) UNIQUE%0A);%0A%0A%0ACREATE TABLE components (%0A id INT PRIMARY KEY AUTO_INCREMENT,%0A sku TEXT,%0A ... | |
52076834e04fd735d4bba88472163c31347bc201 | Create scarp_diffusion_no_component.py | scripts/diffusion/scarp_diffusion_no_component.py | scripts/diffusion/scarp_diffusion_no_component.py | Python | 0.000004 | @@ -0,0 +1,1390 @@
+#Import statements so that you will have access to the necessary methods%0Aimport numpy%0Afrom landlab import RasterModelGrid%0Afrom landlab.plot.imshow import imshow_node_grid, imshow_core_node_grid%0Afrom pylab import show, figure%0A%0A#Create a raster grid with 25 rows, 40 columns, and cell spaci... | |
9d8278e98e505ffb68c2dcf870e61c0239721e5b | Add the gpio proxy for the Intel Edison | elpiwear/Edison/gpio.py | elpiwear/Edison/gpio.py | Python | 0.000001 | @@ -0,0 +1,1573 @@
+# The MIT License (MIT)%0A#%0A# Copyright (c) 2015 Frederic Jacob%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining a copy%0A# of this software and associated documentation files (the %22Software%22), to deal%0A# in the Software without restriction, including without limi... | |
a49d28c552600ee2a0fe24ee83ed5cc7bbe36417 | Add wrist tracker class | wristtracker.py | wristtracker.py | Python | 0 | @@ -0,0 +1,1812 @@
+import math%0Afrom markerutils import *%0A%0A%0Aclass TrackedMarker(object):%0A def __init__(self, marker, size, distance, position):%0A self.marker = marker%0A self.size = size%0A self.distance = distance%0A self.position = position%0A%0A%0Aclass WristTracker(object):... | |
cbc1609758762c7db4d3477248e87ecf29fdd288 | add dep | hilbert/common/__accessdata__.py | hilbert/common/__accessdata__.py | Python | 0.000001 | @@ -0,0 +1,763 @@
+from sys import platform%0Afrom platform import architecture%0A%0A%0Adef install_data_files():%0A %22%22%22 %22%22%22%0A if sys.platform.startswith('netbsd'):%0A %22%22%22 %22%22%22%0A pass%0A elif sys.platform.startswith('freebsd'):%0A %22%22%22 %22%22%22%0A pass... | |
dfe3f7fd7775ce13a670e1d27beddba5c1254a4a | Define the HPACK reference structure. | hyper/http20/hpack_structures.py | hyper/http20/hpack_structures.py | Python | 0 | @@ -0,0 +1,1634 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0Ahyper/http20/hpack_structures%0A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%0AContains data structures used in hyper's HPACK implementation.%0A%22%22%22%0Aclass Reference(object):%0A %22%22%22%0A The reference object is essentially an object that 'points to' another%... | |
37b1250e213b78262075664e4291707ff369e981 | Create clase-3.py | Ene-Jun-2019/Ejemplos/clase-3.py | Ene-Jun-2019/Ejemplos/clase-3.py | Python | 0.000002 | @@ -0,0 +1,2189 @@
+diccionario = %7B%0A 'a': %5B'accion', 'arte', 'arquitectura', 'agrego', 'actual'%5D,%0A 'b': %5B'bueno', 'bien', 'bonito'%5D,%0A 'c': %5B'casa', 'clase', 'coctel'%5D%0A%7D%0A%0Adiccionario%5B'd'%5D = %5B'dado', 'diccionario', 'duda'%5D%0A%0A# print(diccionario)%0A# print(diccionario%5B'a'%... | |
48f2be780f6aa569bb1d8b8c0623e54cac49f613 | add instance action model | core/models/instance_action.py | core/models/instance_action.py | Python | 0.000001 | @@ -0,0 +1,227 @@
+from django.db import models%0A%0A%0Aclass InstanceAction(models.Model):%0A name = models.CharField(max_length=50)%0A description = models.TextField()%0A%0A class Meta:%0A db_table = 'instance_action'%0A app_label = 'core'
| |
78aaccb71fc64e52497abf0d0c768f3767a3d932 | Update expenses status on database | fellowms/migrations/0020_auto_20160602_1607.py | fellowms/migrations/0020_auto_20160602_1607.py | Python | 0 | @@ -0,0 +1,635 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.6 on 2016-06-02 16:07%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('fellowms', '0019_auto_20160601_1512'),%0A %5D%0A%... | |
1c6b74129d6e6a815d73e2a935fc86755ffb4f8a | Improve sourcecode (issue #11 and #17). | imagedownloader/requester/api.py | imagedownloader/requester/api.py | from requester.models import AutomaticDownload
from tastypie import fields
from tastypie.authentication import SessionAuthentication
from tastypie.resources import ModelResource
from libs.tastypie_polymorphic import ModelResource
class AutomaticDownloadResource(ModelResource):
class Meta(object):
queryset = Auto... | Python | 0 | @@ -44,36 +44,8 @@
oad%0A
-from tastypie import fields%0A
from
@@ -147,60 +147,8 @@
rce%0A
-from libs.tastypie_polymorphic import ModelResource%0A
%0A%0Acl
|
65830295d30507e632a1a71c15083c0e58977c9c | add badchans.py, for honeypot purposes... | 2.0/plugins/badchans.py | 2.0/plugins/badchans.py | Python | 0 | @@ -0,0 +1,1381 @@
+%22%22%22%0Abadchans.py - Kills unopered users when they join specified channels.%0A%22%22%22%0A%0Afrom pylinkirc import utils, conf, world%0Afrom pylinkirc.log import log%0A%0AREASON = %22You have si%22 + %22nned...%22 # XXX: config option%0Adef handle_join(irc, source, command, args):%0A %22%2... | |
e3ad95017bced8dac5474d6de5958decf4f58279 | add migration file | corehq/apps/auditcare/migrations/0005_auditcaremigrationmeta.py | corehq/apps/auditcare/migrations/0005_auditcaremigrationmeta.py | Python | 0.000001 | @@ -0,0 +1,881 @@
+# Generated by Django 2.2.24 on 2021-06-20 14:02%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('auditcare', '0004_add_couch_id'),%0A %5D%0A%0A operations = %5B%0A migrations.CreateModel(%0A n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.