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 |
|---|---|---|---|---|---|---|---|
e5d58cc795541b5e4e8f791a441a4369df17ee19 | Add first exercise | cuadradoDentroDeRangoDado.py | cuadradoDentroDeRangoDado.py | Python | 0.000142 | @@ -0,0 +1,564 @@
+#!/usr/bin/env python%0A%0Adef main():%0A def cuadr(num):%0A return num * num%0A%0A def nom_cuad(num):%0A return (%22%25d -%3E %25d%22) %25 (num, cuadr(num))%0A %0A def promptCuadr():%0A myNum1 = input(%22Enter num1: %22)%0A myNum2 = input(%22Enter num2: %22)%0A minimum = min(myNum... | |
8e1580d8d9a5239fd905b77aa6e6ac16adf7f8b1 | Document GlobalStack | cura/Settings/GlobalStack.py | cura/Settings/GlobalStack.py | # Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from typing import Any
from PyQt5.QtCore import pyqtProperty, pyqtSlot, pyqtSignal
from UM.Decorators import override
from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
from UM.Settings.ContainerStack import Cont... | Python | 0 | @@ -722,16 +722,89 @@
rStack%0A%0A
+## Represents the Global or Machine stack and its related containers.%0A#%0A
class Gl
@@ -1385,102 +1385,527 @@
-@pyqtProperty(%22QVariantList%22)%0A def extruders(self) -%3E list:%0A return self._extruders%0A
+## Get the list of extruders of this stack.%0A #%0... |
aab833a4a267ed46e83a5968e87d357ae3a5a12b | Add new DemoStream example corresponding to the LSL4Unity Project | utils/LSL_Tests/RecieveDemoStream.py | utils/LSL_Tests/RecieveDemoStream.py | Python | 0 | @@ -0,0 +1,811 @@
+%22%22%22Example program to show how to read a marker time series from LSL.%22%22%22%0Aimport sys%0Asys.path.append('./pylsl') # help python find pylsl relative to this example program%0Afrom pylsl import StreamInlet, resolve_stream%0A%0A# first resolve an EEG stream on the lab network%0AtargetStream... | |
897371dac52c38b96b6a1a92cd8ce36e9b2d1003 | Add django admin page for HQOauthApplication | corehq/apps/hqwebapp/admin.py | corehq/apps/hqwebapp/admin.py | Python | 0 | @@ -0,0 +1,776 @@
+from django.contrib import admin%0A%0Afrom corehq.apps.hqwebapp.models import HQOauthApplication%0A%0A%0A@admin.register(HQOauthApplication)%0Aclass HQOauthApplicationAdmin(admin.ModelAdmin):%0A list_display = (%0A %22id%22, %22application_id%22, %22application_name%22, %22application_user%... | |
fb884d3453b42b68aa7ecc7b0523bf1460b6b9e0 | Add missing EFS patch | scripts/patches/efs.py | scripts/patches/efs.py | Python | 0.000001 | @@ -0,0 +1,320 @@
+patches = %5B%0A %7B%0A %22op%22: %22replace%22,%0A %22path%22: %22/ResourceTypes/AWS::EFS::AccessPoint/Properties/AccessPointTags/ItemType%22,%0A %22value%22: %22Tag%22,%0A %7D,%0A %7B%0A %22op%22: %22replace%22,%0A %22path%22: %22/ResourceTypes/AWS::EFS::... | |
1ae811c79b1cbc28b2f71e8f2bb01b44cc3aa2b9 | Improve import malware hashes cron | cron/import_malware_hashes.py | cron/import_malware_hashes.py | Python | 0.000004 | @@ -0,0 +1,3200 @@
+#!/usr/bin/env python%0A%0A# This Source Code Form is subject to the terms of the Mozilla Public%0A# License, v. 2.0. If a copy of the MPL was not distributed with this%0A# file, You can obtain one at http://mozilla.org/MPL/2.0/.%0A# Copyright (c) 2017 Mozilla Corporation%0A#%0A# Contributors:%0A# B... | |
58852970847bab30fee18e6ab824b24bc75d389f | Add the package-cleaning script | clean-packages.py | clean-packages.py | Python | 0 | @@ -0,0 +1,1219 @@
+# WARNING: HERE BE DRAGONS%0A%0Aimport yaml%0Aimport os.path%0Aimport urllib.parse%0Afrom copy import deepcopy%0A%0Aurllib.parse.uses_relative.append('github')%0Aurllib.parse.uses_netloc.append('github')%0A%0Awith open('packages.yaml') as f:%0A package_db = yaml.load(f)%0A%0Adef strip_prefix(pref... | |
2e0fbcb3ec1c2f0311d7ee4bbfeac33662f66089 | Monitor process using subprocess module | monitor_process.py | monitor_process.py | Python | 0.000001 | @@ -0,0 +1,735 @@
+import subprocess%0A%0A%22%22%22 If the program is running %22ps -ef %7C grep program%22 will return 2 or more rows %0A(one with the program itself and the second one with %22grep program%22). %0AOtherwise, it will only return one row (%22grep program%22) %0AYou can trigger the alert on this if requi... | |
0d956a8137f5bd2cc30f5163c717858e4a1172ee | delete a module never used | nova/scheduler/filters/image_props_filter.py | nova/scheduler/filters/image_props_filter.py | # Copyright (c) 2011-2012 OpenStack, LLC
# Copyright (c) 2012 Canonical Ltd
# Copyright (c) 2012 SUSE LINUX Products GmbH
# 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 ... | Python | 0.000007 | @@ -801,31 +801,8 @@
ers%0A
-from nova import utils%0A
%0A%0ALO
|
0ae60d170c3a8fd33fac3b1283e646a7018027df | Add expertise removal migration | qipr_approver/approver/migrations/0007_auto_20170227_1533.py | qipr_approver/approver/migrations/0007_auto_20170227_1533.py | Python | 0 | @@ -0,0 +1,771 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.5 on 2017-02-27 15:33%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('approver', '0006_auto_20170222_1424'),%0A %5D%0A... | |
b629a8e6346359683e637fd8e2f34f1d704ad1bc | Add missing test | test/test_full.py | test/test_full.py | Python | 0.000383 | @@ -0,0 +1,258 @@
+import numpy as np%0Afrom util.full import matrix%0A%0Adef assert_(this, ref):%0A print this%0A print ref%0A assert np.allclose(this, ref)%0A%0Adef test_diag():%0A ref = %5B%5B1, 0, 0%5D, %5B0, 1, 0%5D, %5B0, 0, 1%5D%5D%0A this = matrix.diag(%5B1,1,1%5D)%0A assert_(this, ref)%0A ... | |
5e9b804ef20d71aa84cb4d3cdd8b3bad9863cf11 | add validator | sections/validators.py | sections/validators.py | Python | 0.000005 | @@ -0,0 +1,246 @@
+import re%0Afrom django.core.validators import RegexValidator%0A%0A%0Asection_name_validator = RegexValidator(%0A r'%5E%5Ba-zA-Z%5D%5Ba-zA-Z0-9%5D%7B1,19%7D$',%0A 'This field can contain only characters a-zA-Z0-9 and be max 20 characters long',%0A code='invalid'%0A)%0A
| |
e7db8f3dc4d945185a99b5b62ae0b528959651ac | add python version | versioncheck/python_version.py | versioncheck/python_version.py | Python | 0.000002 | @@ -0,0 +1,916 @@
+from invoke import task%0Afrom subprocess import call%0Aimport invoke %0A%0Adef check_invoke_version(ctx):%0A minimal_verion = %220.15.0%22%0A if minimal_verion %3E invoke.__version__:%0A print(%22Your python-invoke version is too old (currently %22+invoke.__version__+%22). Please update... | |
ca9ed2756a12a2587f5b4d021597d2229196da50 | Add migration to add china region | api/common/migrations/0007_add_china_region.py | api/common/migrations/0007_add_china_region.py | Python | 0 | @@ -0,0 +1,596 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.7 on 2017-06-24 21:52%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Adef forwards(apps, schema_editor):%0A Region = apps.get_model('common.Region')%0A region_to_add = 'China'%0A try:%0A Regio... | |
680b2cb1488f83aef5b45476e23bd93a90069872 | Create Content Loader app to Herd/DM standards - Configure Pyinstaller | herd-code/herd-tools/herd-content-loader/herdcl/hook-otags.py | herd-code/herd-tools/herd-content-loader/herdcl/hook-otags.py | Python | 0 | @@ -0,0 +1,173 @@
+hiddenimports = %5B%0A 'numpy',%0A 'pandas._libs.tslibs.timedeltas',%0A 'pandas._libs.tslibs.nattype',%0A 'pandas._libs.tslibs.np_datetime',%0A 'pandas._libs.skiplist'%0A%5D%0A
| |
56d14e7b0386588afd39f2413fafe0b9ba41806d | Access checking unit tests for SlotsTransferAdminPage. | tests/app/soc/modules/gsoc/views/test_slot_transfer_admin.py | tests/app/soc/modules/gsoc/views/test_slot_transfer_admin.py | Python | 0 | @@ -0,0 +1,1808 @@
+# Copyright 2013 the Melange authors.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless requi... | |
db446bf6dc4255f556f20235d2bdc28fa056ad46 | Add list_owners.py to list shared folder owners | list_owners.py | list_owners.py | Python | 0 | @@ -0,0 +1,2115 @@
+%22%22%22List all shared folders and their owners.%22%22%22%0A%0Aimport logging%0Aimport os%0Afrom typing import Iterator%0A%0Aimport dropbox%0A%0Afrom backup import File, setup_logging, get_members, get_files%0A%0A%0Adef get_folder_members(team: dropbox.DropboxTeam,%0A folder:... | |
1c094fe58df0fa57884752be7f64ee9755e433f1 | Create __init__.py | tests/__init__.py | tests/__init__.py | Python | 0.000429 | @@ -0,0 +1,2 @@
+ %0A
| |
6edc4700f755380b8b9099ae78619cbd225a2790 | add API tests | tests/api_test.py | tests/api_test.py | Python | 0.000001 | @@ -0,0 +1,1973 @@
+import overview, unittest, mock, json%0Afrom overview.services import Services%0A%0A%0Aclass ApiV1Test(unittest.TestCase):%0A def send_patch_json(self, url, json_data):%0A return self.app.patch(url,%0A data = json.dumps(json_data),%0A headers = %5B('Content-Ty... | |
0347d82e55382b9618158c4c5809c360e729c245 | Create neworld_client.py | _src/om2py4w/4wex0/neworld_client.py | _src/om2py4w/4wex0/neworld_client.py | Python | 0.000001 | @@ -0,0 +1,857 @@
+#/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport sys%0A# sys.setdefaultencoding() does not exist, here!%0Areload(sys) # Reload does the trick! %0Asys.setdefaultencoding('UTF8')%0A%0Afrom lxml import html%0Aimport requests %0A%0Adef read_note():%0A page = requests.get('http://localhost... | |
faacc6dcef31cb22a87cd3184824b9785b21fdef | Jiffy application to test indexing of reflections from other experiments in an n^2 manner, to see if a matrix from one experiment has good predictive power for another as: | command_line/griddex.py | command_line/griddex.py | Python | 0.999997 | @@ -0,0 +1,2550 @@
+from __future__ import absolute_import, division, print_function%0A%0Aimport libtbx.phil%0Aimport libtbx.load_env%0A%0Ahelp_message = '''%0A%0ACross reference indexing solutions.%0A%0AExamples::%0A%0A %25s expts0.json refl0.json%0A%0A''' %25 libtbx.env.dispatcher_name%0A%0Aphil_scope = libtbx.phil.... | |
3a4c922d353df5f5b3f3cabe24b04090b0a3fd08 | test the serve command | tests/test_cli.py | tests/test_cli.py | Python | 0.0001 | @@ -0,0 +1,1362 @@
+# Copyright 2013 Donald Stufft%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by ap... | |
2299343d8b10658cc6682b23dbf9be9d5fd290f6 | Add unit test for data integrity. | tests/testdata.py | tests/testdata.py | Python | 0 | @@ -0,0 +1,1238 @@
+import ConfigParser%0Aimport csv%0Aimport unittest%0A%0Aclass DataTest(unittest.TestCase):%0A %0A def setUp(self):%0A config = ConfigParser.RawConfigParser()%0A config.read('../app.config')%0A # Load the data from the csv into an array%0A self.data = %5B%5D%0A ... | |
78aebc48763b15dedc3aee65a18a2a39f46e5c30 | add run module | flagon/run.py | flagon/run.py | Python | 0.000001 | @@ -0,0 +1,230 @@
+%0A%0Adef run_simple(hostname, port, application, use_reloader=False,%0A use_debugger=False):%0A from wsgiref.simple_server import make_server%0A from wsgiref.simple_server import WSGIRequestHandler, WSGIServer%0A pass%0A
| |
b9399dbdfff80fec21cfed926779b67589835047 | Create LettCombPhoneNum_002.py | leetcode/017-Letter-Combinations-of-a-Phone-Number/LettCombPhoneNum_002.py | leetcode/017-Letter-Combinations-of-a-Phone-Number/LettCombPhoneNum_002.py | Python | 0.000001 | @@ -0,0 +1,647 @@
+class Solution(object):%0A def letterCombinations(self, digits):%0A %22%22%22%0A :type digits: str%0A :rtype: List%5Bstr%5D%0A %22%22%22%0A def comb(digits, d2l):%0A if not digits:%0A return %5B%22%22%5D%0A %0A ... | |
d92eff7e89e09167b126f99243986eae5792f705 | Add py-debtcollector (#25212) | var/spack/repos/builtin/packages/py-debtcollector/package.py | var/spack/repos/builtin/packages/py-debtcollector/package.py | Python | 0 | @@ -0,0 +1,938 @@
+# 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 PyDebtcollector(PythonPackage):%0A %22%22%22%0A A col... | |
6ed82eb673c2a95f5c349ab45dd8d17280db91c9 | Conversion of string to number | BankOCR.py | BankOCR.py | Python | 0.999999 | @@ -0,0 +1,1666 @@
+numbers = '''%0A _ _ _ _ _ _ _ _%0A%7C %7C %7C _%7C _%7C%7C_%7C%7C_ %7C_ %7C%7C_%7C%7C_%7C%0A%7C_%7C %7C%7C_ _%7C %7C _%7C%7C_%7C %7C%7C_%7C _%7C%0A'''%0A%0Aclass Converter:%0A def __init__(self):%0A digits = self.splitDigits(numbers)%0A self.digitLineDicts = %5B... | |
6bd4b7e4c2dac2817250f184114eea8c05fbefb7 | Add compat.py to get get_user_model working | cuser/compat.py | cuser/compat.py | Python | 0 | @@ -0,0 +1,580 @@
+from __future__ import unicode_literals%0Afrom django.conf import settings%0Afrom django.core.exceptions import ImproperlyConfigured%0Aimport django%0Afrom django.utils.functional import lazy%0A%0A__all__ = %5B'User', 'AUTH_USER_MODEL'%5D%0A%0A%0A# Django 1.5+ compatibility%0Aif django.VERSION %3E= (... | |
422390ff7eb4d97eaf0c5c1a1b250010ee766ec7 | Add tool for clean pyc files | tools/cleanPYC.py | tools/cleanPYC.py | Python | 0 | @@ -0,0 +1,312 @@
+%0Aimport re%0Aimport os%0Aimport sys%0A%0Aprint(%22%25s path%5Cn%22 %25 sys.argv%5B0%5D)%0A%0Apath = sys.argv%5B1%5D%0A%0Afor root, dirs, files in os.walk(path):%0A for file_ in files:%0A if re.match(%22.*.pyc$%22, file_):%0A abs_file = os.path.join(root, file_)%0A pr... | |
0d0115ef5e088ed54a176e24cc94713b706f3d55 | include migration | awx/main/migrations/0015_v300_label_changes.py | awx/main/migrations/0015_v300_label_changes.py | Python | 0.000111 | @@ -0,0 +1,487 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('main', '0014_v300_invsource_cred'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterFiel... | |
5db256e6ac4ee84e008afa8f94d767330e392709 | Increase coverage | test/test_vmcp.py | test/test_vmcp.py | Python | 0 | @@ -0,0 +1,1262 @@
+# -*- coding: utf8 -*-%0A# This file is part of PyBossa.%0A#%0A# Copyright (C) 2013 SF Isle of Man Limited%0A#%0A# PyBossa is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as published by%0A# the Free Software Foundation, either ... | |
0a3e00b27606eda26917c3c69b0344dc301502f0 | Revert "will this fix tests?" | tests/__init__.py | tests/__init__.py | Python | 0 | @@ -0,0 +1,148 @@
+# log_support setups the default Logger class%0A# and so we need to ensure that it is also%0A# setup for the tests%0Afrom lbrynet.core import log_support%0A
| |
3dbef22cee9ea83c7e80756037209334da237d4c | Remove unused compat types from compat.py | twython/compat.py | twython/compat.py | import sys
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_py3 = (_ver[0] == 3)
try:
import simplejson as json
except ImportError:
import json
if is_py2:
from urllib import urlencode, quote_plus
try:
from urlparse import parse_qsl
except ImportError:
... | Python | 0 | @@ -354,317 +354,135 @@
b
-uiltin_str = str%0A bytes = str%0A str = unicode%0A basestring = basestring%0A numeric_types = (int, long, float)%0A%0A%0Aelif is_py3:%0A from urllib.parse import urlencode, quote_plus, parse_qsl%0A%0A builtin_str = str%0A str = str%0A bytes = bytes%0A basestrin... |
f10049ae831570b54581c2a089218359febe5c50 | add command for exporting to csv | fecfilings/management/commands/fecfilings_to_csv.py | fecfilings/management/commands/fecfilings_to_csv.py | Python | 0.000001 | @@ -0,0 +1,235 @@
+from django.core.management.base import NoArgsCommand%0A%0Afrom fecfilings.models import Contributor%0A%0A%0Aclass Command(NoArgsCommand):%0A def handle(self, **options):%0A for c in Contributor.objects.all():%0A print c.to_csv()%0A
| |
23165cbd1ac8ba1528649c04b56d598664e1da8b | Enhance mysensors binary sensor device classes (#13367) | homeassistant/components/binary_sensor/mysensors.py | homeassistant/components/binary_sensor/mysensors.py | """
Support for MySensors binary sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.mysensors/
"""
from homeassistant.components import mysensors
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES, DOMAIN, BinarySe... | Python | 0 | @@ -367,16 +367,248 @@
ATE_ON%0A%0A
+SENSORS = %7B%0A 'S_DOOR': 'door',%0A 'S_MOTION': 'motion',%0A 'S_SMOKE': 'smoke',%0A 'S_SPRINKLER': 'safety',%0A 'S_WATER_LEAK': 'safety',%0A 'S_SOUND': 'sound',%0A 'S_VIBRATION': 'vibration',%0A 'S_MOISTURE': 'moisture',%0A%7D%0A%0A
%0Adef set
@@ -1327,50... |
c9f70c7a4a24be0cdd9dcf044a06051b0978efff | add exceptions | jsonrpc/exceptions.py | jsonrpc/exceptions.py | Python | 0.000013 | @@ -0,0 +1,2592 @@
+class JSONRPCError(object):%0A%0A %22%22%22 Error for JSON-RPC communication.%0A%0A When a rpc call encounters an error, the Response Object MUST contain the%0A error member with a value that is a Object with the following members:%0A%0A code: A Number that indicates the error type that ... | |
2947a2c9b6348d248e3ae740722d6a7aa04327c0 | add reg d included definitions | regconfig/reg_d.py | regconfig/reg_d.py | Python | 0 | @@ -0,0 +1,331 @@
+from regparser.default_settings import *%0A%0A#### Regulation D%0A%0AINCLUDE_DEFINITIONS_IN_PART_1004 = %5B%0A ('Alternative mortgage transaction', 'Alternative mortgage transaction'),%0A ('Creditor', 'Creditor'),%0A ('State', 'State'),%0A ('State law', 'State law'),%0A%5D%0A%0AINCLUDE_DE... | |
1e32a27b35e25e780e8af6cc76d1eb424328171b | add leetcode Populating Next Right Pointers in Each Node | leetcode/PopulatingNextRightPointersinEachNode/solution.py | leetcode/PopulatingNextRightPointersinEachNode/solution.py | Python | 0 | @@ -0,0 +1,625 @@
+# -*- coding:utf-8 -*-%0A# Definition for a binary tree node%0A# class TreeNode:%0A# def __init__(self, x):%0A# self.val = x%0A# self.left = None%0A# self.right = None%0A# self.next = None%0A%0A%0Aclass Solution:%0A # @param root, a tree node%0A # @return no... | |
b220410ad51413d52076bec84a3bf1a660f9883b | Add a program that says Hello Shikha | helloShikha.py | helloShikha.py | Python | 0.999999 | @@ -0,0 +1,54 @@
+#This is my hello world program%0Aprint 'Hello Shikha!'%0A
| |
557652d4b4297dd80d844915c3d57fc3e46ac83a | add graham's solution: | solutions/4_21_grsr.py | solutions/4_21_grsr.py | Python | 0.000033 | @@ -0,0 +1,184 @@
+import sys%0A%0Afor line in sys.stdin:%0A line = line.rstrip()%0A pop, sample_id, sample_name, sex = line.split(%22,%22)%0A if (sample_id == sys.argv%5B1%5D):%0A print %22Found%22, sample_id%0A%0A
| |
8db04e5d648c9e923f7977f456242d9ea9b80050 | Create pig_latin.py | solutions/pig_latin.py | solutions/pig_latin.py | Python | 0.001803 | @@ -0,0 +1,321 @@
+def pig_latin(input_string):%0A%09new_string = %5B%5D%0A%09for i in input_string.split():%0A%09%09if i%5B0%5D not in %22aeiou%22:%0A%09%09%09i = i%5B1:%5D+i%5B0%5D%0A%09%09i +=%22ay%22%0A%09%09new_string.append(i)%0A%09return ' '.join(new_string)%0A%0Adef main():%0A%09user_input = str(raw_input(%22Pl... | |
f5460adbaeb87421a7f193a700d25e5a3c6e4351 | Create crypt.py | crypt.py | crypt.py | Python | 0.00091 | @@ -0,0 +1,292 @@
+from itertools import cycle%0A%0Adef crypt(source,key):%0A result=%22%22%0A a=cycle(key)%0A for ch in source:%0A result+=chr(ord(ch)%5Eord(next(a)))%0A return result%0A%0Aif __name__==%22__main__%22:%0A source=input(%22%E8%BE%93%E5%85%A5%E6%83%B3%E8%A6%81%E5%8A%A0%E5%AF%86/%E8%A... | |
5ed7db70874f3ebfe9c946d38ccf12228dacac3a | Test if we tried to commit with an empty message, it should raise a ValueError | tests/test_git.py | tests/test_git.py | Python | 0.000001 | @@ -0,0 +1,557 @@
+from unittest import TestCase%0A%0Afrom mock import MagicMock, patch%0Afrom nose.tools import raises%0A%0Afrom pyolite.git import Git%0A%0A%0Aclass TestGit(TestCase):%0A%0A @raises(ValueError)%0A def test_commit_with_no_message(self):%0A mock_repo = MagicMock()%0A mock_index = MagicMock()%0A ... | |
1a3d9b3da91a5c87316e44498a876f70a49df8ad | add 70 | python/p070.py | python/p070.py | Python | 0.999266 | @@ -0,0 +1,422 @@
+import utils%0A%0A%0Adef is_perm(a, b):%0A return sorted(str(a)) == sorted(str(b))%0A%0Abest = (10000, 1)%0Aprimes = %5B i for i in utils.primes(4000) if i %3E 2000 %5D%0A%0Afor i in primes:%0A for j in primes:%0A n = i * j%0A if n %3E 10**7:%0A break%0A phi = (i... | |
c4764ef1aa1a1aaa0ae8dd909c3578705c7a2060 | add 77 | python/p077.py | python/p077.py | Python | 0.998768 | @@ -0,0 +1,325 @@
+import utils%0A%0Aprimes = utils.primes(100)%0A%0Adef count(target):%0A ways = %5B0%5D * (target + 1)%0A ways%5B0%5D = 1%0A%0A for p in primes:%0A for j in xrange(p, target + 1):%0A ways%5Bj%5D += ways%5Bj - p%5D%0A%0A return ways%5Btarget%5D%0A%0A%0Afor target in xrange... | |
f773b404c10af24477de733a42ed9c06bc93296d | Improve support for v6 thrift hosts. | sparts/tasks/thrift.py | sparts/tasks/thrift.py | # Copyright (c) 2014, Facebook, Inc. All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
"""thrift-related helper tasks""... | Python | 0 | @@ -4936,32 +4936,33 @@
r.prepare()%0A
+%0A
self.bound_h
@@ -4953,56 +4953,18 @@
-self.bound_host, self.bound_port = %5C%0A
+addrinfo =
sel
@@ -4996,24 +4996,82 @@
tsockname()%0A
+ self.bound_host, self.bound_port = addrinfo%5B0:2%5D%0A%0A
self
@@ -5111,12 +5111,20 @@
n ... |
9a237141c9635d2a1dad6349ad73d24e969d8460 | Add runner | hud-runner.py | hud-runner.py | Python | 0.000022 | @@ -0,0 +1,191 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A %0A %0A%22%22%22Convenience wrapper for running hud directly from source tree.%22%22%22%0A %0A %0Afrom hud.hud import main%0A %0A %0Aif __name__ == '__main__':%0A main()%0A
| |
bfb7d8d9356fe66f433556977a333e4256c6fb61 | Create series.py | trendpy/series.py | trendpy/series.py | Python | 0 | @@ -0,0 +1,2304 @@
+# series.py%0A%0A# MIT License%0A%0A# Copyright (c) 2017 Rene Jean Corneille%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 wi... | |
250d1c20c16b6c0846a9fb94ef4ebc6e780221df | Create solution.py | hackerrank/algorithms/implementation/easy/equalize_the_array/py/solution.py | hackerrank/algorithms/implementation/easy/equalize_the_array/py/solution.py | Python | 0.000018 | @@ -0,0 +1,284 @@
+def solution(nums):%0A import collections%0A %0A if len(nums) == 0:%0A return 0%0A %0A item, count = collections.Counter(nums).most_common()%5B0%5D%0A %0A return len(nums) - count%0A%0An = int(input())%0Anums = tuple(map(int, input().split()))%0A%0Acnt = solution(nums)... | |
fca6421c53e286549d861c65c114991602f310ea | Add some adaptors. | pykmer/adaptors.py | pykmer/adaptors.py | Python | 0 | @@ -0,0 +1,1415 @@
+%22%22%22%0AThis module provides some adaptors for converting between%0Adifferent data formats:%0A%0A%60k2kf%60%0A Convert a sequence of k-mers to k-mer frequency pairs%0A%0A%60kf2k%60%0A Convert a sequence of k-mer frequency pairs to k-mers%0A%0A%0A%60keyedKs%60%0A Provide keyed access to ... | |
b7f3e32827bb9a0f122928d218f4d535febb0829 | add command | Command.py | Command.py | Python | 0.000292 | @@ -0,0 +1,431 @@
+# -*- coding: utf-8 -*-%0A%0A%22%22%22%0ACommand pattern%0A%0A%22%22%22%0A%0Afrom os import listdir, curdir%0A%0A%0Aclass ListCommand(object):%0A%0A def __init__(self, path=None):%0A self.path = path or curdir%0A%0A def execute(self):%0A self._list(self.path)%0A%0A @staticmetho... | |
bd865a9fdc941b99be40a5ba3dcc02b819b2e9da | add cpm.utils.refstring | cpm/utils/refstring.py | cpm/utils/refstring.py | Python | 0.000001 | @@ -0,0 +1,2714 @@
+# Copyright (c) 2017 Niklas Rosenstein%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 limitation the rights%0A# to us... | |
edb904ca105abfb767f94f366e19ed05374a8014 | Create URL Shortner | URLShortner.py | URLShortner.py | Python | 0 | @@ -0,0 +1,1216 @@
+import uuid%0Aimport json%0Aimport os%0Afrom glob import iglob%0Afrom pprint import pprint%0A%0Amapping=%7B%7D%0Amapping%5B'URL'%5D=%5B%5D%0A#Getting JSON file of initial Tika parsing containing list of file paths categorized by MIME types%0Afile=%22C:/Users/rahul/Documents/GitHub/Scientific-Content... | |
62a13341610d476ba8ff9e3fd5a3476cbdb18225 | Create convert.py | convert.py | convert.py | Python | 0.000002 | @@ -0,0 +1,1351 @@
+import gensim%0A%0A#word2vec embeddings start with a line with the number of lines (tokens?) and the number of dimensions of the file. This allows%0A#gensim to allocate memory accordingly for querying the model. Larger dimensions mean larger memory is held captive. Accordingly, this line%0A#has to b... | |
5d5ccc84eaaec6b6d749a9054f744a5a44f9dac9 | add script for reading from PCF8574 | i2c/PCF8574.py | i2c/PCF8574.py | Python | 0 | @@ -0,0 +1,565 @@
+#!/usr/bin/python%0Aimport sys%0Aimport smbus%0Aimport time%0A%0A# Reads data from PCF8574 and prints the state of each port%0A%0Adef readPCF8574(busnumber,address):%0A address = int(address,16)%0A busnumber = int(1)%0A bus = smbus.SMBus(busnumber)%0A state = bus.read_byte(address);%0A%0A... | |
ddbe9de5cfc5b412812096291db6a37d120e03ce | add plotting the distribution of fields and apgoee | py/plot_dustwapogee.py | py/plot_dustwapogee.py | Python | 0 | @@ -0,0 +1,1882 @@
+###############################################################################%0A# plot_dustwapogee: plot the dust-map at 5 kpc with the APOGEE fields in the %0A# sample overlayed%0A###############################################################################%0Aimport sys%0Aimpo... | |
139a634515061674d3832320791d35ff512d8a5a | Add a snippet. | python/print_stderr.py | python/print_stderr.py | Python | 0.000002 | @@ -0,0 +1,100 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0Aimport sys%0A%0Aprint(%22Error message%22, file=sys.stderr)%0A
| |
2909b4a7e46fe4a466e0c99abf90222c43f34d93 | add tests for Every Election wrapper | polling_stations/apps/data_finder/tests/test_ee_wrapper.py | polling_stations/apps/data_finder/tests/test_ee_wrapper.py | Python | 0 | @@ -0,0 +1,1449 @@
+import mock%0Afrom django.test import TestCase%0Afrom data_finder.helpers import EveryElectionWrapper%0A%0A%0A# mock get_data() functions%0Adef get_data_exception(self, postcode):%0A raise Exception()%0A%0Adef get_data_no_elections(self, postcode):%0A return %5B%5D%0A%0Adef get_data_with_elect... | |
67d760f0a3ed081d43237e1b2106b86a4e6a56c6 | add log handler | Util/LogHandler.py | Util/LogHandler.py | Python | 0.000002 | @@ -0,0 +1,2126 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0A-------------------------------------------------%0A File Name%EF%BC%9A LogHandler.py%0A Description :%0A Author : JHao%0A date%EF%BC%9A 2017/3/6%0A-------------------------------------------------%0A Change Activity:%0A ... | |
7331e1d1061a7a1ac9abc583d45746facfde9180 | Create search-in-a-binary-search-tree.py | Python/search-in-a-binary-search-tree.py | Python/search-in-a-binary-search-tree.py | Python | 0.000023 | @@ -0,0 +1,1107 @@
+# Time: O(h)%0A# Space: O(1)%0A%0A# Given the root node of a binary search tree (BST) and a value.%0A# You need to find the node in the BST that the node's value equals the given value.%0A# Return the subtree rooted with that node.%0A# If such node doesn't exist, you should return NULL.%0A#%0A# For... | |
37409639dc1afaa440ca47fe27469bf4c353bcf5 | support / on Windoze too | atest/resources/TestCheckerLibrary.py | atest/resources/TestCheckerLibrary.py | import os.path
import re
from robot import utils
from robot.output import readers
from robot.common import Statistics
from robot.libraries.BuiltIn import BuiltIn
class TestCheckerLibrary:
def process_output(self, path):
try:
print "Processing output '%s'" % path
suite... | Python | 0 | @@ -6,13 +6,8 @@
t os
-.path
%0Aimp
@@ -228,16 +228,57 @@
path):%0A
+ path = path.replace('/', os.sep)%0A
|
58311387849f8785fa964eb01e728c92bc0d8b61 | Create levenshtein.py | levenshtein.py | levenshtein.py | Python | 0.000001 | @@ -0,0 +1,1341 @@
+%0A# source: http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance%0A%0Adef levenshtein(source, target):%0A if len(source) %3C len(target):%0A return levenshtein(target, source)%0A %0A # So now we have len(source) %3E= len(target).%0A if len(target) == 0:... | |
d205c9a5a2d92190676a30156e039f8cdd400629 | Correct base API | pysis/sis.py | pysis/sis.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from datetime import datetime
import calendar
class SIS(object):
__BASE_URL__ = 'http://api.sustainableis.com/v1/'
__API_DOMAIN__ = 'api.sustainableis.com'
#__BASE_URL__ = 'http://localhost:3000/v1/'
#__API_DOMAIN__ = 'localhost:3000'
"""Main SIS ob... | Python | 0.000003 | @@ -138,33 +138,28 @@
p://api.
-sustainableis.com
+ndustrial.io
/v1/'%0A
@@ -182,33 +182,28 @@
= 'api.
-sustainableis.com
+ndustrial.io
'%0A #_
|
a5b012db4cb4cc8a988c0ed37411194639dd1bbd | add tester.py module to pytools | lib/tester.py | lib/tester.py | Python | 0.000006 | @@ -0,0 +1,1346 @@
+#!/usr/bin/env python%0A%0A%22%22%22%0APackage: pytools%0AAuthor: Christopher Hanley%0A%0APurpose:%0A========%0AProvide driver function for package tests.%0A%0ADependencies:%0A=============%0A%0A- nose 0.10.4 or greater.%0A%0AUsage Example:%0A==============%0AAll packages will need to import jwtools... | |
6efc045d34f432723b52aa094c1caec3bf102e96 | add sparse repeated updates benchmark | benchmarks/sparse_repeated_updates.py | benchmarks/sparse_repeated_updates.py | Python | 0 | @@ -0,0 +1,253 @@
+import numpy as np%0Aimport theano%0Aimport theano.tensor as T%0AfX = theano.config.floatX%0As = theano.shared(np.ones((10, 1), dtype=fX))%0Aidxs = %5B0, 1, 1%5D%0Afn = theano.function(%5B%5D, updates=%5B(s, T.inc_subtensor(s%5Bidxs%5D, s%5Bidxs%5D ** 2))%5D)%0Afn()%0Aprint s.get_value()%0A
| |
4b43906004f9bfb6164bb2c0b95efaf1dbb881c8 | add py | correction_image.py | correction_image.py | Python | 0.00008 | @@ -0,0 +1,99 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A%0A# Project Apricot%0A# Copyright (c) 2015 Daiki, Takanori.%0A
| |
fc44d4463045e458796d13b3c97b34cf6ba47f61 | Add script to create the player pitch weights. | bluechip/player/createpitchweights.py | bluechip/player/createpitchweights.py | Python | 0 | @@ -0,0 +1,710 @@
+import random%0Afrom player.models import Player, Pitch, PlayerPitchWeight%0A%0A#TODO: Need to centralize this function call.%0Arandom.seed(123456789)%0A%0Apitch_records = Pitch.objects.all().order_by('id')%0Apitches_count = pitch_records.count()%0Afor p in Player.objects.all():%0A%09weights = %5B%5D... | |
d3f68c385da4d2fa864ba748f41785be01c26c34 | Add py solution for 551. Student Attendance Record I | py/student-attendance-record-i.py | py/student-attendance-record-i.py | Python | 0.998417 | @@ -0,0 +1,491 @@
+class Solution(object):%0A def checkRecord(self, s):%0A %22%22%22%0A :type s: str%0A :rtype: bool%0A %22%22%22%0A A = False%0A L = 0%0A for c in s:%0A if c == 'L':%0A L += 1%0A if L %3E 2:%0A ... | |
a1ee4d90e0cf159f27274423b989c98844fbeba1 | Create mytask1b.py | ml/mytask1b.py | ml/mytask1b.py | Python | 0.999813 | @@ -0,0 +1,1747 @@
+%22%22%22 Features%0A%0A%0AThe objective of this task is to explore the corpus, deals.txt. %0A%0A%0AThe deals.txt file is a collection of deal descriptions, separated by a new line, from which %0Awe want to glean the following insights:%0A%0A%0A1. What is the most popular term across all the deals?%... | |
714e2e2ae5e8412ef522dc64666e6548307eec07 | Add the init method to the topic model. | model/topic.py | model/topic.py | Python | 0 | @@ -0,0 +1,159 @@
+class TopicModel(Query):%0A def __init__(self, db):%0A self.db = db%0A self.table_name = %22topic%22%0A super(TopicModel, self).__init__()%0A
| |
c795f8e21d2b400134cb52ef7eae2cc7e26cfd99 | Create ada.py | ada.py | ada.py | Python | 0.00017 | @@ -0,0 +1 @@
+%0A
| |
028831c53d27452168b7a430eb713e01c966acb0 | add privacy policy as first legal check | accelerator/migrations/0006_add_privacy_policy_legal_check.py | accelerator/migrations/0006_add_privacy_policy_legal_check.py | Python | 0 | @@ -0,0 +1,929 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.8 on 2018-05-14 09:09%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Adef add_privacy_policy_legal_check(apps, schema_editor):%0A LegalCheck = apps.get_model('accelerator', 'LegalCheck')%0A LegalCheck.o... | |
bc8158bb0d8cb14ae5a990bcaaf1d4bb1780245f | remove unused import | psutil/_compat.py | psutil/_compat.py | #!/usr/bin/env python
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module which provides compatibility with older Python versions."""
__all__ = ["PY3", "long", "xrange", "unicode", "callable", "l... | Python | 0.000001 | @@ -375,98 +375,8 @@
sys
-%0Atry:%0A import __builtin__%0Aexcept ImportError:%0A import builtins as __builtin__ # py3
%0A%0APY
|
a2975adeedcc4aa33ee8b63bd404675bb3453089 | Add broker app. | apps/broker.py | apps/broker.py | Python | 0 | @@ -0,0 +1,1754 @@
+%22%22%22%0AAlter item database.%0A%22%22%22%0Aimport logging%0Aimport sys%0Aimport os%0A%0A# import hack to avoid PYTHONPATH%0Atry:%0A import pydarkstar%0Aexcept ImportError:%0A root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))%0A root, dirs, files = next(os.walk(root))%0... | |
a8c08baeb2ee6268ac61613a23cc86cf885a9d09 | Handle NULL deleted_at in migration 112. | nova/db/sqlalchemy/migrate_repo/versions/112_update_deleted_instance_data.py | nova/db/sqlalchemy/migrate_repo/versions/112_update_deleted_instance_data.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC.
# 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/... | Python | 0.000002 | @@ -1239,32 +1239,100 @@
instance_list:%0A
+ if not instance%5B'deleted_at'%5D:%0A continue%0A
tabl
|
7dbab1a6615a49513fe16c74550ddf2f52b0f698 | Create 4-keys-keyboard.py | Python/4-keys-keyboard.py | Python/4-keys-keyboard.py | Python | 0.999774 | @@ -0,0 +1,339 @@
+# Time: O(n)%0A# Space: O(1)%0A%0Aclass Solution(object):%0A def maxA(self, N):%0A %22%22%22%0A :type N: int%0A :rtype: int%0A %22%22%22%0A if N %3C= 6:%0A return N%0A dp = %5Bi for i in range(N+1)%5D%0A for i in xrange(7, N+1):%0A ... | |
be9c88b630ea243afdef3d87ac0b316bd3300281 | Add 283-move-zeroes.py | 283-move-zeroes.py | 283-move-zeroes.py | Python | 0.011626 | @@ -0,0 +1,1588 @@
+%22%22%22%0AQuestion:%0A Move Zeroes%0A%0A Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.%0A%0A For example, given nums = %5B0, 1, 0, 3, 12%5D, after calling your function, nums should be %5B1, 3, 12, 0, ... | |
5d7f2fdfb1b850aacaf29ba76c7e5ed441e6db63 | Create 32losmasgrandes.py | 32losmasgrandes.py | 32losmasgrandes.py | Python | 0.000132 | @@ -0,0 +1,2230 @@
+#Integrantes del equipo%0A#Chavez Pavon Jose Manuel%0A#Ramirez Ramirez Servando%0A#Saules Rojas David%0A#Lopez Adriana%0A%0Aimport random %0A%0A#Funcino para crear una lista%0A#La cual usaremos para simular las alturas de las 32 personas%0A#La llenaremos de forma aleatoria%0Adef lista (): %0A%09l = ... | |
a7ccd7bc02476cfad85280ff1e742671453360de | Add Digital Outcomes and Specialists to frameworks | migrations/versions/420_dos_is_coming.py | migrations/versions/420_dos_is_coming.py | Python | 0 | @@ -0,0 +1,890 @@
+%22%22%22DOS is coming%0A%0ARevision ID: 420%0ARevises: 410_remove_empty_drafts%0ACreate Date: 2015-11-16 14:10:35.814066%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '420'%0Adown_revision = '410_remove_empty_drafts'%0A%0Afrom alembic import op%0Aimport sqlalchemy as sa%0... | |
273f0bd289d62c6980f095b0a8bb41a973b0678f | add import script for Bradford | polling_stations/apps/data_collection/management/commands/import_bradford.py | polling_stations/apps/data_collection/management/commands/import_bradford.py | Python | 0 | @@ -0,0 +1,408 @@
+from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter%0A%0Aclass Command(BaseXpressDemocracyClubCsvImporter):%0A council_id = 'E08000032'%0A addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017.tsvJune2017.tsv'%0A stations_name = 'parl.2017-06-0... | |
12ba7e0c6db91f5ee46a1be9acaece110f98b911 | add bigwig file reader | PyMaSC/bwreader.py | PyMaSC/bwreader.py | Python | 0 | @@ -0,0 +1,2180 @@
+import os%0A%0Aimport wWigIO%0A%0A%0Aclass BigWigFile(object):%0A @staticmethod%0A def wigToBigWig(wigfile, sizefile, bwfile):%0A wWigIO.wigToBigWig(wigfile, sizefile, bwfile)%0A%0A @staticmethod%0A def bigWigToWig(bwfile, wigfile):%0A wWigIO.bigWigToWig(bwfile, wigfile)%0A... | |
c0f690fe1d43edc4fc5cc4b3aeb40594c1abd674 | Create pollard_rho_algorithm.py | daedalus/attacks/pollard_rho_algorithm.py | daedalus/attacks/pollard_rho_algorithm.py | Python | 0.000772 | @@ -0,0 +1,567 @@
+#pollard rho algorithm of integer factorization%0A%0A%0Adef gcd(a,b):%0A if a is 0:%0A return b%0A return gcd(b%25a,a)%0A%0Adef pollard_rho(number,x,y):%0A d = 1%0A while d is 1:%0A x = (x**2+1)%25number%0A for i in range(0,2,1):%0A y = (y**2+1)%25number%0A... | |
c5dfcffdf743e2c26b8dba6e3be8aee7d7aaa608 | Test `write_*` and `join_*` on bytes | test/test_join_bytes.py | test/test_join_bytes.py | Python | 0.000004 | @@ -0,0 +1,1677 @@
+import re%0Aimport linesep%0A%0Atry:%0A from StringIO import StringIO as BytesIO%0Aexcept ImportError:%0A from io import BytesIO%0A%0A# Based on %3Chttps://pytest.org/latest/example/parametrize.html#a-quick-port-of-testscenarios%3E%0Adef pytest_generate_tests(metafunc):%0A idlist = %5... | |
a30cd68e77242df4efadc75c4390dd8a3ce68612 | Add data migration for Audit's empty status | src/ggrc/migrations/versions/20170103101308_42b22b9ca859__fix_audit_empty_status.py | src/ggrc/migrations/versions/20170103101308_42b22b9ca859__fix_audit_empty_status.py | Python | 0 | @@ -0,0 +1,1071 @@
+# Copyright (C) 2016 Google Inc.%0A# Licensed under http://www.apache.org/licenses/LICENSE-2.0 %3Csee LICENSE file%3E%0A%0A%22%22%22%0AFix audit empty status%0A%0ACreate Date: 2016-12-22 13:53:24.497701%0A%22%22%22%0A# disable Invalid constant name pylint warning for mandatory Alembic variables.%0A#... | |
56b44a5a510390913e2b9c9909218428842dcde8 | Match old_user_id to user_id and old_team_id to team_id | migrations/versions/542fd8471e84_match_old_to_new_user_and_team_columns.py | migrations/versions/542fd8471e84_match_old_to_new_user_and_team_columns.py | Python | 0.999503 | @@ -0,0 +1,2015 @@
+# -*- coding: utf-8 -*-%0A%22%22%22Match old to new user and team columns%0A%0ARevision ID: 542fd8471e84%0ARevises: 382cde270594%0ACreate Date: 2020-04-07 03:52:04.415019%0A%0A%22%22%22%0A%0Afrom alembic import op%0Aimport sqlalchemy as sa%0A%0A# revision identifiers, used by Alembic.%0Arevision = '... | |
52eb461f1679f134aed25c221cfcc63abd8d3768 | add test | test/test_importers/test_youtube_importer.py | test/test_importers/test_youtube_importer.py | Python | 0.000002 | @@ -0,0 +1,1581 @@
+# -*- coding: utf8 -*-%0A# This file is part of PyBossa.%0A#%0A# Copyright (C) 2016 SciFabric LTD.%0A#%0A# PyBossa is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as published by%0A# the Free Software Foundation, either version ... | |
1e9a64fe6324d8b4ac96daafa7427e9f55e6dd38 | add Geom.decompose tests | tests/gobj/test_geom.py | tests/gobj/test_geom.py | Python | 0.000001 | @@ -0,0 +1,1142 @@
+from panda3d import core%0A%0Aempty_format = core.GeomVertexFormat.get_empty()%0A%0A%0Adef test_geom_decompose_in_place():%0A vertex_data = core.GeomVertexData(%22%22, empty_format, core.GeomEnums.UH_static)%0A prim = core.GeomTristrips(core.GeomEnums.UH_static)%0A prim.add_vertex(0)%0A ... | |
66b5a1089ed0ce2e615f889f35b5e39db91950ae | Fix serving uploaded files during development. | mezzanine/core/management/commands/runserver.py | mezzanine/core/management/commands/runserver.py |
import os
from django.conf import settings
from django.contrib.staticfiles.management.commands import runserver
from django.contrib.staticfiles.handlers import StaticFilesHandler
from django.http import Http404
from django.views.static import serve
class MezzStaticFilesHandler(StaticFilesHandler):
def get_resp... | Python | 0 | @@ -178,40 +178,8 @@
ler%0A
-from django.http import Http404%0A
from
@@ -212,16 +212,16 @@
t serve%0A
+
%0A%0Aclass
@@ -306,25 +306,8 @@
t):%0A
- try:%0A
@@ -312,20 +312,24 @@
re
-turn
+sponse =
super(M
@@ -383,36 +383,8 @@
st)%0A
- except Http404:%0A
@@ -447,22 +447,50... |
93a7f4cb914de537e477a6c6bd45e0aa28ce2e4f | update model fields | modelview/migrations/0053_auto_20200408_1442.py | modelview/migrations/0053_auto_20200408_1442.py | Python | 0.000001 | @@ -0,0 +1,1020 @@
+# Generated by Django 3.0 on 2020-04-08 12:42%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('modelview', '0052_auto_20200408_1308'),%0A %5D%0A%0A operations = %5B%0A migrations.AddField(%0A ... | |
bc52778a5ed9ee44f40400cc2693f86318434527 | Add missing file | metashare/repository/editor/lang.py | metashare/repository/editor/lang.py | Python | 0.000006 | @@ -0,0 +1,1532 @@
+%0Afrom xml.etree.ElementTree import XML%0Aimport os%0Aimport logging%0Afrom metashare.settings import LOG_LEVEL, LOG_HANDLER%0Aimport pycountry%0A%0A# Setup logging support.%0Alogging.basicConfig(level=LOG_LEVEL)%0ALOGGER = logging.getLogger('metashare.xml_utils')%0ALOGGER.addHandler(LOG_HANDLER)%0... | |
e580995de78c3658951b119577a0f7c335352e13 | Create feature_class_info_to_csv.py | feature_class_info_to_csv.py | feature_class_info_to_csv.py | Python | 0.000003 | @@ -0,0 +1,835 @@
+import arcpy%0Aimport os%0Aimport time%0Aimport csv%0A%0A%0Abegin_time = time.clock()%0A%0Aarcpy.env.workspace = ws = r%22%5C%5C192-86%5CDFSRoot%5CData%5Callenj%5CDesktop%5Cgdb%5Ctest.gdb%22%0Amrcsv = r%22%5C%5C192-86%5CDFSRoot%5CData%5Callenj%5CDesktop%5Cgdb%5Cwrite.csv%22%0A%0A%0Als = %5B1,2,3%5D%0... | |
05a006e2cf22434eb70208fc365c9a23b9dd8892 | Add lint-test-expectations to Blink PRESUBMIT.py . | PRESUBMIT.py | PRESUBMIT.py | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Top-level presubmit script for Blink.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmi... | Python | 0.000006 | @@ -1588,32 +1588,96 @@
i, output_api))%0A
+ results.extend(_CheckTestExpectations(input_api, output_api))%0A
return results
@@ -3644,24 +3644,792 @@
return %5B%5D%0A%0A%0A
+def _CheckTestExpectations(input_api, output_api):%0A local_paths = %5Bf.LocalPath() for f in input_api.AffectedFiles()%5D%0A if any(path.... |
ae477223f296de9ee6b81a15d56d7140a5bf26ac | Create __init__.py | requests/packages/urllib3/contrib/packages/ssl_match_hostname/__init__.py | requests/packages/urllib3/contrib/packages/ssl_match_hostname/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
2ef9fce02be94f8c4e9b5c52ca04a05cce1b5ede | Allow to start server as a module | LiSE/LiSE/server/__main__.py | LiSE/LiSE/server/__main__.py | Python | 0.000001 | @@ -0,0 +1,657 @@
+import cherrypy%0Afrom argparse import ArgumentParser%0Afrom . import LiSEHandleWebService%0A%0Aparser = ArgumentParser()%0Aparser.add_argument('world', action='store', required=True)%0Aparser.add_argument('-c', '--code', action='store')%0Aargs = parser.parse_args()%0Aconf = %7B%0A '/': %7B%0A ... | |
9c97f75894ff8350051682b57eb790e1387f5e7f | Add minimal coverage for on/take-over.html.spt | tests/test_associate.py | tests/test_associate.py | from __future__ import division, print_function, unicode_literals
import mock
from gittip.testing import Harness, test_website
from gittip.testing.client import TestClient
from gittip.elsewhere.twitter import TwitterAccount
class Tests(Harness):
def setUp(self):
Harness.setUp(self)
self.website ... | Python | 0 | @@ -3078,24 +3078,1095 @@
nse.body, response.body%0A
+%0A%0A @mock.patch('requests.post')%0A @mock.patch('requests.get')%0A @mock.patch('gittip.utils.mixpanel.track')%0A def test_can_post_to_take_over(self, track, get, post):%0A TwitterAccount('1234', %7B'screen_name': 'alice'%7D).opt_in('alice')%0A... |
9e2d025384dd58c87bf8d292008711c317cb45df | extract human face | otherFaces.py | otherFaces.py | Python | 0.999999 | @@ -0,0 +1,1355 @@
+import cv2%0D%0Aprint(cv2.__file__)%0D%0Aimport os%0D%0Aimport sys%0D%0A%0D%0AIMAGE_DIR = 'D:%5CDATA%5Cgirl2%5Cgirl2'%0D%0A%0D%0AOUTPUT_DIR = './other_people'%0D%0Aif not os.path.exists(OUTPUT_DIR):%0D%0A os.makedirs(OUTPUT_DIR)%0D%0A%0D%0A# http://blog.topspeedsnail.com/archives/10511%0D%0A# wge... | |
a0124a990b4afe0cd5fd3971bae1e43f417bc1b2 | Add management command to find domains impacted by 502 bug | corehq/apps/domain/management/commands/find_secure_submission_image_domains.py | corehq/apps/domain/management/commands/find_secure_submission_image_domains.py | Python | 0 | @@ -0,0 +1,1278 @@
+from django.core.management.base import BaseCommand%0Afrom corehq.apps.domain.models import Domain%0Aimport csv%0A%0A%0Aclass Command(BaseCommand):%0A help = 'Find domains with secure submissions and image questions'%0A%0A def handle(self, *args, **options):%0A with open('domain_results... | |
71f1bc5d981952f275500a2b62a67488b33e205b | Longest increasing subsequence algo | LongestIncreasingSubsequence.py | LongestIncreasingSubsequence.py | Python | 0.999398 | @@ -0,0 +1,647 @@
+#Finds a largest increasing subsequence in O(n%5E2) time%0A#algorithm at http://www.algorithmist.com/index.php/Longest_Increasing_Subsequence%0Adef LongestSubsequence(array):%0A n=len(array)%0A q=%5B0%5D*n%0A p=%5B-1%5D*n # Contains all the previos elements to the increasing sequence%0A %0A for i... | |
361a075efed0ca4a9877f7268b2e91725ef8be65 | Add encoder.py | encoder.py | encoder.py | Python | 0.000011 | @@ -0,0 +1,2311 @@
+%22%22%22%0ASource: https://trac.ffmpeg.org/wiki/Encode/H.264%0A%22%22%22%0Aimport os%0Aimport sys%0Aimport subprocess%0A%0AFFMPEG_PATH = '/usr/local/bin/ffmpeg'%0A%0AVIDEO_CODEC = 'h264'%0AVIDEO_ENCODER = 'h264_omx'%0A%0AAUDIO_CODEC = 'aac'%0AAUDIO_ENCODER = 'aac'%0A%0ABITRATE = '2500k'%0A%0ASRC_DI... | |
3344c49bf36a4bd74fb9db079297b98a2e0ee46f | Implement cht.sh release script | bin/release.py | bin/release.py | Python | 0 | @@ -0,0 +1,1532 @@
+#!/usr/bin/env python%0A%0Afrom __future__ import print_function%0A%0Afrom datetime import datetime%0Aimport os%0Afrom os import path%0Aimport re%0Aimport shutil%0Aimport subprocess%0Afrom subprocess import Popen%0Aimport sys%0A%0ASHARE_DIR = path.join(path.dirname(__file__), %22../share/%22)%0A%0A%... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.