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 |
|---|---|---|---|---|---|---|---|
023e88f264274211674a100820d590dcee694445 | Allow neutron network list to be used as pillar data | salt/pillar/neutron.py | salt/pillar/neutron.py | Python | 0.000001 | @@ -0,0 +1,2582 @@
+# -*- coding: utf-8 -*-%0A'''%0AUse Openstack Neutron data as a Pillar source. Will list all networks listed%0Ainside of Neutron, to all minions.%0A%0A.. versionadded:: Beryllium%0A%0A:depends: - python-neutronclient%0A%0AA keystone profile must be used for the pillar to work (no generic keystone%0... | |
6df4cdd8fe629fabadd792d0b7507a57f9dc37b7 | refactor tests | tests/test_helper_functions.py | tests/test_helper_functions.py | import quora
def test_try_cast_int():
assert quora.try_cast_int('200 Upvotes') == 200
assert quora.try_cast_int('2k Upvotes') == 2000
assert quora.try_cast_int('2 K Upvotes') == 2000
assert quora.try_cast_int('2.3k Upvotes') == 2300
assert quora.try_cast_int('2.3 K Upvotes') == 2300
assert quora.try_cast_int('<s... | Python | 0.00002 | @@ -11,60 +11,93 @@
ra%0A%0A
-def test_try_cast_int():%0A%09assert quora.try_cast_int(
+class TestHelperFunctions:%0A def test_try_cast_int(self):%0A input_strings = %5B
'200
@@ -109,299 +109,270 @@
tes'
-) == 200%0A%09assert quora.try_cast_int('2k Upvotes') == 2000%0A%09assert quora.try_cast_int('2 K Upvo... |
2b0ade5407902c2b8d8a0853967bbe01c9e38e7e | test file for paraview functions | tests/unit/io/test_paraview.py | tests/unit/io/test_paraview.py | Python | 0 | @@ -0,0 +1,1024 @@
+import os%0Aimport sys%0Aimport pytest%0Aimport numpy as np%0Aimport porespy as ps%0Aimport openpnm as op%0Afrom numpy.testing import assert_allclose%0Aimport psutil%0Afrom openpnm.io.__paraview__ import export_data%0Afrom openpnm.io.__paraview__ import open_paraview%0A%0Aclass ExportTest():%0A%0A ... | |
1f281a1279b7b185559d9d267a69ea24024c633e | Transpose of a Matrix | math/Matrix/Python/transpose.py | math/Matrix/Python/transpose.py | Python | 0 | @@ -0,0 +1,1048 @@
+%22%22%22 Transpose of a Matrix%0D%0A%0D%0AFollowing is a simpler code for Transpose%0D%0Aof a matrix using the NUMPY library of Python.%0D%0A%0D%0AThe transpose of a matrix swaps its rows and columns:%0D%0A%0D%0A %5B%5Ba,b,c%5D,%0D%0A %5Bd,e,f%5D%5D%0D%0A%E2%80%8B%0D%0AW... | |
f2efa222f2dd454d65a6e8cc33457b3b340ffe89 | Switch AMO-dev to use FxA staging environment (#14950) | src/olympia/conf/dev/settings.py | src/olympia/conf/dev/settings.py | from olympia.lib.settings_base import * # noqa
# Allow addons-dev CDN for CSP.
CSP_BASE_URI += (
# Required for the legacy discovery pane.
'https://addons-dev.allizom.org',
)
CDN_HOST = 'https://addons-dev-cdn.allizom.org'
CSP_CONNECT_SRC += (CDN_HOST,)
CSP_FONT_SRC += (CDN_HOST,)
CSP_IMG_SRC += (CDN_HOST,)
... | Python | 0 | @@ -3108,35 +3108,41 @@
https://
-stable.dev.lcip.org
+accounts.stage.mozaws.net
'%0AFXA_OA
@@ -3170,28 +3170,25 @@
auth
--stable.dev.lcip.org
+.stage.mozaws.net
/v1'
@@ -3220,40 +3220,38 @@
s://
-stable.dev.lcip.org/profile
+profile.stage.mozaws.net
/v1'%0A
+%0A
DEFA
@@ -3410,15 +3410,8 @@
273/
-'%0A '
amo... |
bf98a5d06436a905aa5710db4a60f1e6b7c8f7fc | Add link local plugin | services/presence2/linklocal_plugin.py | services/presence2/linklocal_plugin.py | Python | 0 | @@ -0,0 +1,940 @@
+# Copyright (C) 2007, Red Hat, Inc.%0A# Copyright (C) 2007, Collabora Ltd.%0A#%0A# This program is free software; you can redistribute it and/or modify%0A# it under the terms of the GNU General Public License as published by%0A# the Free Software Foundation; either version 2 of the License, or%0A# (a... | |
2ab796aeb53e650b8a1dd828b5daaca16850d9c3 | Add tests for APNS message. | zerver/tests/test_push_notifications.py | zerver/tests/test_push_notifications.py | Python | 0 | @@ -0,0 +1,1636 @@
+import mock%0A%0Afrom django.test import TestCase%0Afrom django.conf import settings%0A%0Afrom zerver.models import PushDeviceToken, UserProfile%0Afrom zerver.models import get_user_profile_by_email%0Afrom zerver.lib import push_notifications as apn%0Afrom zerver.lib.redis_utils import get_redis_cli... | |
f491db91ed2608698d2d91558f41f544819684bf | Add python-copy to calvinsys | calvin/calvinsys/native/python-copy.py | calvin/calvinsys/native/python-copy.py | Python | 0.000018 | @@ -0,0 +1,1103 @@
+# -*- coding: utf-8 -*-%0A%0A# Copyright (c) 2015 Ericsson AB%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/LICENS... | |
689cd96b4ea284fcc526805d978e58c01e4198aa | FIX removed isotropic spectral clustering test because of arpack problems. | sklearn/cluster/tests/test_spectral.py | sklearn/cluster/tests/test_spectral.py | """Testing for Spectral Clustering methods"""
from cPickle import dumps, loads
import nose
import numpy as np
from numpy.testing import assert_equal
from nose.tools import assert_raises
from scipy import sparse
from sklearn.datasets.samples_generator import make_blobs
from sklearn.utils.testing import assert_greater
... | Python | 0 | @@ -4598,514 +4598,4 @@
1)%0A
-%0A%0Adef test_isotropic():%0A # test that no cluster with a single point is created%0A X, y = make_blobs(n_samples=40, random_state=1, centers=%5B%5B1, 1%5D%5D,%0A cluster_std=0.1)%0A sp = SpectralClustering(n_clusters=2, gamma=0.2, random_state=0)%0A labels = sp... |
f62f8971bcaddc93cf9993e7ff0e4bfd70e0735d | Connect attribute filling signal to profile to dic function. | authentic2/idp/signals.py | authentic2/idp/signals.py | from django.dispatch import Signal
from authentic2.idp.attributes import provide_attributes_at_sso
'''authorize_decision
Expect a dictionnaries as return with:
- the authorization decision e.g. dic['authz'] = True or False
- optionnaly a message e.g. dic['message'] = message
'''
authorize_service = Signal(providin... | Python | 0 | @@ -27,16 +27,49 @@
t Signal
+%0Afrom django.conf import settings
%0A%0Afrom a
@@ -125,16 +125,58 @@
s_at_sso
+, %5C%0A provide_attributes_of_user_profile
%0A%0A%0A'''au
@@ -1692,16 +1692,125 @@
_at_sso)
+%0Aif settings.PUSH_PROFILE_UPDATES:%0A add_attributes_to_response.connect(provide_attributes_of_user_pr... |
4a74a541104f7534b8f5eb36e8e101ee48c2e672 | Update services_and_index_sync.py | tendrl/node_agent/node_sync/services_and_index_sync.py | tendrl/node_agent/node_sync/services_and_index_sync.py | import json
import uuid
import etcd
from tendrl.commons.event import Event
from tendrl.commons.message import ExceptionMessage
from tendrl.commons.objects.job import Job
from tendrl.commons.utils import etcd_utils
from tendrl.commons.utils import log_utils as logger
# TODO(darshan) this has to be moved to Definition... | Python | 0.000002 | @@ -2637,39 +2637,115 @@
e()%0A
-%0A if _is_new_provisioner
+ %0A _cluster = _cluster.load()%0A if _is_new_provisioner and _cluster.is_managed == %22yes%22
:%0A
|
88bb5d1a42b817a000f10ec0989282c0998cc1b0 | Add approved and open | openapproved.py | openapproved.py | Python | 0.000001 | @@ -0,0 +1,2685 @@
+#!/usr/bin/env python%0A#%0A# Copyright (C) 2011 - Soren Hansen%0A# Copyright (C) 2013 - Red Hat, Inc.%0A#%0A%0A# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0... | |
9bfbf6eb6f65fa745d0ef3777ad4486f47c69b87 | Add pose_to_kml.py formatting script | scripts/pose_to_kml.py | scripts/pose_to_kml.py | Python | 0.000001 | @@ -0,0 +1,1964 @@
+import sys%0Aimport csv%0Afrom math import sin, radians, fabs%0A%0AKML_TEMPLATE = %22%22%22%0A%3C?xml version=%221.0%22 encoding=%22UTF-8%22?%3E%0A%3Ckml xmlns=%22http://www.opengis.net/kml/2.2%22 xmlns:gx=%22http://www.google.com/kml/ext/2.2%22 %0A xmlns:kml=%22http://www.opengis.net/kml/2.2%22 ... | |
846ce88f199381387f612463da51c6b17281dd21 | Add script for checking Python3 compatibility | scripts/check_python3_compatibility.py | scripts/check_python3_compatibility.py | Python | 0.000002 | @@ -0,0 +1,1092 @@
+#!/usr/bin/env python%0A#%0A# Copyright 2021 Google Inc.%0A#%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0A%0A%22%22%22Check for Python scripts which are incompatible with Python 3.%22%22%22%0A%0A%0Aimport ast%0Aimport os%0Aimport subp... | |
4402506527cbc7dfbf648a90e4e2c665e27a5a34 | Add new package: py-rbtools (#18963) | var/spack/repos/builtin/packages/py-rbtools/package.py | var/spack/repos/builtin/packages/py-rbtools/package.py | Python | 0.000001 | @@ -0,0 +1,1224 @@
+# Copyright 2013-2020 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 PyRbtools(PythonPackage):%0A %22%22%22RBTools is a set ... | |
88d9e6bd216bee0c78f437bdf15362efbebe2e0b | Create new package. (#6504) | var/spack/repos/builtin/packages/r-bookdown/package.py | var/spack/repos/builtin/packages/r-bookdown/package.py | Python | 0 | @@ -0,0 +1,1881 @@
+##############################################################################%0A# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
5558cce438134c722a8c96d7d2badc03b6fd45f5 | Create new package. (#6214) | var/spack/repos/builtin/packages/r-fracdiff/package.py | var/spack/repos/builtin/packages/r-fracdiff/package.py | Python | 0 | @@ -0,0 +1,1716 @@
+##############################################################################%0A# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
28c6f1ddc23ee170522b1225bbf60f9b1d244189 | Add new package: logrotate (#18786) | var/spack/repos/builtin/packages/logrotate/package.py | var/spack/repos/builtin/packages/logrotate/package.py | Python | 0 | @@ -0,0 +1,1127 @@
+# Copyright 2013-2020 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 Logrotate(AutotoolsPackage):%0A %22%22%22The logrotate ... | |
8fe2be0010e45f6b2ba339f5a7fe350bb7efed42 | add new package (#24045) | var/spack/repos/builtin/packages/py-nipype/package.py | var/spack/repos/builtin/packages/py-nipype/package.py | Python | 0 | @@ -0,0 +1,1523 @@
+# 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 PyNipype(PythonPackage):%0A %22%22%22Neuroimaging in Py... | |
9363331f96805bcc180a081cf9d28b5dab70e25b | Create undoclose.py | HexChat/undoclose.py | HexChat/undoclose.py | Python | 0.000003 | @@ -0,0 +1,1190 @@
+from sys import platform%0Afrom collections import deque%0Aimport hexchat%0A%0A__module_name__ = %22Undo Close%22%0A__module_version__ = %220.1%22%0A__module_description__ = %22Adds keybinding to undo close tab%22%0A__module_author__ = %22TingPing%22%0A%0Aif platform == 'win32':%0A%09shiftctrlmod = ... | |
37cc64eec2681c4a1e8d3ad3c7f5971ce4c0c6e8 | add home view | kitty/views.py | kitty/views.py | Python | 0 | @@ -0,0 +1,118 @@
+from django.shortcuts import render_to_response%0A%0Adef home(request):%0A return render_to_response('welcome_page.html')
| |
e9813045f95b8d524e17c7938db0f4df7c29e7bf | day 14 | 2019/14.py | 2019/14.py | Python | 0.999563 | @@ -0,0 +1,2237 @@
+#!/usr/bin/env python3%0A%0Aimport sys%0A%0Adef parse(s):%0A a, b = s.split(%22 %22)%0A return int(a), b%0A%0Adef has(side, x):%0A return any(x == s%5B1%5D for s in side)%0A%0Adef consumes(rxn, x):%0A return has(rxn%5B0%5D, x)%0A%0Adef produces(rxn, x):%0A return has(rxn%5B1%5D, x)%0A... | |
f226ab5b8ecd4faa80a349ab033702d716a6864c | Add initial migration | timer/migrations/0001_initial.py | timer/migrations/0001_initial.py | Python | 0 | @@ -0,0 +1,655 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A %5D%0A%0A operations = %5B%0A migrations.CreateModel(%0A name='Timer',%0A fi... | |
e3665928c80da9df192f8edb5dc28e3200e34fdc | Add a "image me [thing]" handler | toolbot/scripts/google_images.py | toolbot/scripts/google_images.py | Python | 0.999936 | @@ -0,0 +1,1021 @@
+import re%0Aimport json%0Aimport asyncio%0Aimport random%0Aimport aiohttp%0A%0A%0AGOOGLE_IMAGE_API = 'http://ajax.googleapis.com/ajax/services/search/images'%0A%0A%0Adef plugin(bot):%0A @bot.respond(re.compile(r'(image%7Cimg)( me)? (.*)', re.I))%0A def image_me(msg):%0A asyncio.Task(ima... | |
fbc5b10b977d20cff340cfb130cec22d49842b5a | Add repos admin | api/repos/admin.py | api/repos/admin.py | Python | 0 | @@ -0,0 +1,229 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import absolute_import, division, print_function%0A%0Afrom django.contrib import admin%0A%0Afrom repos.models import Repo, ExternalRepo%0A%0Aadmin.site.register(Repo)%0Aadmin.site.register(ExternalRepo)%0A
| |
f1189f4774e469e39097e4d10159425a9ed40757 | Bump version to 2013.1 | nova/version.py | nova/version.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC
#
# 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
... | Python | 0 | @@ -671,14 +671,14 @@
'201
-2
+3
', '
-2
+1
', N
|
1681651b7d606436550aad3d696f5f1ba335caa9 | Add dump_useractivity migration helper tool. | zephyr/management/commands/dump_useractivity.py | zephyr/management/commands/dump_useractivity.py | Python | 0 | @@ -0,0 +1,2037 @@
+from optparse import make_option%0Afrom django.core.management.base import BaseCommand%0Afrom zephyr.models import Realm, UserProfile, UserActivity, get_client%0Aimport simplejson%0Afrom zephyr.lib.time import datetime_to_timestamp, timestamp_to_datetime%0A%0Adef dump():%0A pointers = %5B%5D%0A ... | |
9d76f77feebdf20b993385f7022334a4e964e0ad | Create ExampleImport.py | ExampleImport.py | ExampleImport.py | Python | 0 | @@ -0,0 +1,67 @@
+#!/usr/bin/python%0A%0Aprint (%22This is from the ExampleImport Module%22)%0A
| |
ef8d86704c0930091b8b8f07842e46ffff5bfc34 | Correct empty lines in imported files | correct_empty_lines.py | correct_empty_lines.py | Python | 0.000039 | @@ -0,0 +1,1965 @@
+print('%5Cn%5Cn%5Cn%5Cn')%0Aprint('Now:%5Cn')%0A%0A%0Afor p in c.all_positions():%0A try:%0A # Corrects empty lines around @language python%5Cn@tabwidth -4%0A if p.h.startswith('@clean') and p.h.endswith('py'):%0A # Corrects empty lines after @first%0A if p.h =... | |
08e6a7821283da3898d2eeb4418b6e035effb2f0 | Create spelling_bee.py | spelling_bee.py | spelling_bee.py | Python | 0.999938 | @@ -0,0 +1,880 @@
+#Kunal Gautam%0A#Codewars : @Kunalpod%0A#Problem name: Spelling Bee%0A#Problem level: 6 kyu%0A%0Adef how_many_bees(hive):%0A if not hive: return 0%0A count = 0%0A for i in range(len(hive)):%0A for j in range(len(hive%5Bi%5D)):%0A try: %0A if hive%5Bi%5D%5B... | |
706f29660c9fe6f21af3544ea7871ffdfd56db4a | Create sprintreport.py | sprintreport.py | sprintreport.py | Python | 0.000001 | @@ -0,0 +1,1375 @@
+from jirawrapper import JIRAWrapper%0Aimport sys%0Aimport getopt%0A%0Aif __name__ == %22__main__%22:%0A argv = sys.argv%5B1:%5D%0A print_help = lambda: print('sprintreport.py %5B-p project%5D -c %3Cusername:password%3E')%0A try:%0A opts, args = getopt.getopt(argv, %22p:c:%22, %5B%22p... | |
729ab39844bcf6700ccdeb28955e90220d2bab86 | convert ip v4 | base/convert_ip.py | base/convert_ip.py | Python | 0.999975 | @@ -0,0 +1,414 @@
+import socket%0Afrom binascii import hexlify%0A%0Adef convert_ip4_address():%0A for ip_addr in %5B'127.0.0.1','192.168.0.1'%5D:%0A packed_ip_addr = socket.inet_aton(ip_addr)%0A unpacked_ip_addr = socket.inet_ntoa(packed_ip_addr)%0A print %22IP Address : %25s =%3E Packed: %25s,... | |
d427012df993dcffb77de05502fcc170cff6cdcb | Add Notebook test | datasciencebox/tests/salt/test_notebook.py | datasciencebox/tests/salt/test_notebook.py | Python | 0 | @@ -0,0 +1,653 @@
+import pytest%0A%0Aimport requests%0A%0Aimport utils%0A%0Adef setup_module(module):%0A utils.invoke('install', 'notebook')%0A%0A%0A@utils.vagranttest%0Adef test_salt_formulas():%0A project = utils.get_test_project()%0A%0A kwargs = %7B'test': 'true', '--out': 'json', '--out-indent': '-1'%7D%0... | |
1380ee2a9eff29bd1271eb0e920b75752f7346c7 | Add (transitional?) db_oldrotate.py that finds exif rotate in old posts. | db_oldrotate.py | db_oldrotate.py | Python | 0 | @@ -0,0 +1,460 @@
+#!/usr/bin/env python%0A# -*- coding: iso-8859-1 -*-%0A%0Afrom pyexiv2 import Image as ExivImage%0Afrom db_add import exif2rotation%0Afrom dbclient import dbclient%0A%0Aclient = dbclient()%0Aposts = client._search_post(%22SPFrotate%22, %5B%22rotate%22%5D)%0Aprint len(posts), %22posts%22%0Afor post in... | |
4da034ab29619eef5396b45e766e42fe89e16b3f | use fn_get_authorized_regions_by_user to get recursive region ids based on permissinos. | datapoints/api/base.py | datapoints/api/base.py | from django.core import urlresolvers
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponse
from tastypie.authorization import Authorization
from tastypie.authentication import ApiKeyAuthentication
from tastypie.resources import ModelResource, Resource, ALL
from datapoints.models im... | Python | 0 | @@ -4356,116 +4356,115 @@
s =
-set(
+
Region
-Permission.objects.filter(user_id=%5C%0A self.user_id).values_list('region_id',flat=True))%0A
+.objects.raw(%22SELECT * FROM%5C%0A fn_get_authorized_regions_by_user(%25s,NULL)%22,%5Bself.user_id%5D)
%0A%0A
@@ -4530,51 +4530,46 @@
set(
-permitte... |
35eee909fa90d06efa34a39667db6345725bc177 | Add tool _list paging test | Allura/allura/tests/functional/test_tool_list.py | Allura/allura/tests/functional/test_tool_list.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (t... | Python | 0 | @@ -1215,33 +1215,482 @@
-assert len(r.html
+content = r.html.find('div', id='content_base')%0A assert content.find('a', dict(href='/p/test/wiki/')), r%0A assert content.find('a', dict(href='/p/test/wiki2/')), r%0A%0A @td.with_wiki%0A @td.with_tool('test', 'Wiki', 'wiki2')%0A def test_p... |
64b03bd53f6f494398818199caabe10138469719 | Create couples-holding-hands.py | Python/couples-holding-hands.py | Python/couples-holding-hands.py | Python | 0.000001 | @@ -0,0 +1,808 @@
+# Time: O(n)%0A# Space: O(n)%0A%0Aclass Solution(object):%0A def minSwapsCouples(self, row):%0A %22%22%22%0A :type row: List%5Bint%5D%0A :rtype: int%0A %22%22%22%0A N = len(row)//2%0A couples = %5B%5B%5D for _ in xrange(N)%5D%0A for seat, num in en... | |
364de0a95b868bba980bfe6445cd80f55b39bb63 | add amber ti estimator test code | src/alchemlyb/tests/test_ti_estimators_amber.py | src/alchemlyb/tests/test_ti_estimators_amber.py | Python | 0.000061 | @@ -0,0 +1,1120 @@
+%22%22%22Tests for all TI-based estimators in %60%60alchemlyb%60%60.%0A%0A%22%22%22%0Aimport pytest%0A%0Aimport pandas as pd%0A%0Afrom alchemlyb.parsing import amber %0Afrom alchemlyb.estimators import TI%0Aimport alchemtest.amber%0A%0A%0Adef amber_simplesolvated_charge_dHdl():%0A dataset = alche... | |
a8f4d9252016aa9c656ad6d06558b520af06b489 | Create spyne_webservice.py | PythonTests/spyne_webservice.py | PythonTests/spyne_webservice.py | Python | 0.000001 | @@ -0,0 +1,1301 @@
+%22%22%22%0AUSE: Wizdler Chrome Extension%0Afrom suds.client import Client%0Ac = Client('http://localhost:8008/...?wsdl')%0Ac.service.SmokeTest('XXX')%0A%22%22%22%0A%0Aresponse_file = '$RESP_FILE'%0A%0Afrom spyne import Application, rpc, ServiceBase, Iterable, Integer, Unicode%0Afrom spyne.protocol.... | |
4e4fc8bdc573f297c5ea7c6d9ade012ae0c3706f | Use utf-8 encoding for files | src/robot/serializing/serialize_log.py | src/robot/serializing/serialize_log.py | # Copyright 2008-2011 Nokia Siemens Networks Oyj
#
# 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... | Python | 0.000001 | @@ -637,16 +637,30 @@
atement%0A
+import codecs%0A
import o
@@ -1695,24 +1695,31 @@
):%0A with
+codecs.
open(outpath
@@ -1723,16 +1723,34 @@
ath, 'w'
+, encoding='UTF-8'
) as out
@@ -5329,24 +5329,31 @@
with
+codecs.
open(js_file
@@ -5353,24 +5353,42 @@
js_file, 'r'
+, encoding='UTF-8'
) as js:%0A... |
f4b1ad081dc6a7e83d0342d00c82549cde72c3fa | improve user search capabilities | src/sentry/api/endpoints/user_index.py | src/sentry/api/endpoints/user_index.py | from __future__ import absolute_import
import six
from django.db.models import Q
from sentry.api.base import Endpoint
from sentry.api.paginator import DateTimePaginator
from sentry.api.permissions import SuperuserPermission
from sentry.api.serializers import serialize
from sentry.db.models.query import in_iexact
fro... | Python | 0.000001 | @@ -1058,32 +1058,174 @@
)%0A
+ elif key == 'id':%0A queryset = queryset.filter(%0A id__in=value,%0A )%0A
@@ -1674,32 +1674,101 @@
)
+%0A else:%0A queryset = que... |
ecabc90a6f55fdd2fa0d0ed789b72d3196d3e2eb | Correct query to members and pending members | src/sentry/web/forms/teams.py | src/sentry/web/forms/teams.py | """
sentry.web.forms.teams
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django import forms
from sentry.models import Team, TeamMember, PendingTeamMember
from sentry.web.forms.fields import UserField
from djang... | Python | 0.998939 | @@ -2797,32 +2797,37 @@
if self.project.
+team.
member_set.filte
@@ -2986,16 +2986,21 @@
project.
+team.
pending_
|
9a6fe771ba03cd64c4f6d764125457ed808feca2 | Add datacite harvester | scrapi/harvesters/datacite.py | scrapi/harvesters/datacite.py | Python | 0.000001 | @@ -0,0 +1,1137 @@
+'''%0AHarvester for the DataCite MDS for the SHARE project%0A%0AExample API call: http://oai.datacite.org/oai?verb=ListRecords&metadataPrefix=oai_dc%0A'''%0Afrom __future__ import unicode_literals%0A%0Afrom scrapi.base import OAIHarvester%0Afrom scrapi.base.helpers import updated_schema, oai_extract... | |
d0839799c1fc3ec6da6cda701a9d4699b4fcb168 | Update workstation.py | erpnext/manufacturing/doctype/workstation/workstation.py | erpnext/manufacturing/doctype/workstation/workstation.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt, cint, getdate, formatdate, comma_and, time_diff_in_seconds, to_timedelta
from frappe.mo... | Python | 0.000001 | @@ -2710,16 +2710,73 @@
_hours:%0A
+%09%09if working_hour.start_time and working_hour.end_time:%0A%09
%09%09slot_l
@@ -2891,16 +2891,17 @@
nds()%0A%09%09
+%09
if slot_
@@ -2928,16 +2928,17 @@
length:%0A
+%09
%09%09%09retur
|
c63f2e2993b0c32d7bc2de617dfb147c0f6a2d89 | patch fix | erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py | erpnext/patches/v7_0/make_is_group_fieldtype_as_check.py | import frappe
def execute():
for doctype in ["Sales Person", "Customer Group", "Item Group", "Territory"]:
frappe.reload_doctype(doctype)
#In MySQL, you can't modify the same table which you use in the SELECT part.
frappe.db.sql(""" update `tab{doctype}` set is_group = 1
where name in (select parent_{fiel... | Python | 0.000001 | @@ -1,8 +1,48 @@
+from __future__ import unicode_literals%0A
import f
@@ -146,122 +146,32 @@
%22%5D:%0A
-%0A
%09%09
-frappe.reload_doctype(doctype)%0A%0A%09%09#In MySQL, you can't modify the same table which you use in the SELECT part.%0A
+%0A%09%09# convert to 1 or 0
%0A%09%09f
@@ -188,11 +188,8 @@
ql(%22
-%22%22... |
70b2fcb7ca85878b2012cab8c476b40f2624e7ee | Add migration new_name | geotrek/trekking/migrations/0003_auto_20181113_1755.py | geotrek/trekking/migrations/0003_auto_20181113_1755.py | Python | 0.000009 | @@ -0,0 +1,565 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.14 on 2018-11-13 16:55%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('trekking', '0002_trek_pois_excluded'),%0A %5D%0... | |
43fbaa6c109c51a77832d6f09e0543794882b518 | Add scripts printing special:mode.yml from model.npz | scripts/contrib/model_info.py | scripts/contrib/model_info.py | Python | 0 | @@ -0,0 +1,1073 @@
+#!/usr/bin/env python3%0A%0Aimport sys%0Aimport argparse%0Aimport numpy as np%0Aimport yaml%0A%0A%0ADESC = %22Prints version and model type from model.npz file.%22%0AS2S_SPECIAL_NODE = %22special:model.yml%22%0A%0A%0Adef main():%0A args = parse_args()%0A%0A model = np.load(args.model)%0A if... | |
af5e58c2fefdffa8046ecace238a3fd1a2a43387 | Add Naive Bayes base class: | ML/naivebayes.py | ML/naivebayes.py | Python | 0.000001 | @@ -0,0 +1,1545 @@
+%22%22%22%0ANaive Bayes Classifier%0AIncludes gaussian, bernoulli and multinomial models%0A%22%22%22%0A%0Aimport abc%0Aimport numpy as np%0A%0Aclass NaiveBayes:%0A %22%22%22%0A Naive Bayes Classifier%0A Given class label, assumes features are independent%0A %22%22%22%0A __metaclass__... | |
837e9db39b2c9010a5cc43f21821b5dec90a18b1 | add rdds.fileio to setup.py | python/setup.py | python/setup.py | #!/usr/bin/env python
from setuptools import setup
import thunder
setup(
name='thunder-python',
version=str(thunder.__version__),
description='Large-scale neural data analysis in Spark',
author='The Freeman Lab',
author_email='the.freeman.lab@gmail.com',
url='https://github.com/freeman-lab/thu... | Python | 0 | @@ -509,24 +509,61 @@
nder.rdds',%0A
+ 'thunder.rdds.fileio',%0A
|
ee3b5d0d14403bd5964f0609eb48848833bff2c0 | Add a draft for a backup class | quilt/backup.py | quilt/backup.py | Python | 0 | @@ -0,0 +1,1608 @@
+# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:%0A%0A# python-quilt - A Python implementation of the quilt patch system%0A#%0A# Copyright (C) 2012 Bj%C3%B6rn Ricks %3Cbjoern.ricks@googlemail.com%3E%0A#%0A# This library is free software; you can redistribute it and/or%0A# modify it under the terms of ... | |
3ab998b022ff69c21c470de397f12557a1141168 | Add tests for photo.utils | src/photo/tests/test_utils.py | src/photo/tests/test_utils.py | Python | 0 | @@ -0,0 +1,2478 @@
+%22%22%22%0ATests for photo.utils%0A%22%22%22%0Aimport uuid%0A%0Afrom django.test import TestCase%0A%0Afrom photo import utils%0A%0A# pylint: disable=too-few-public-methods%0Aclass DummyInstance:%0A %22%22%22%0A Dummy instance object for passing into UploadToPathAndRename%0A %22%22%22%0A ... | |
5bad99e17f62c325f9cb9dad1efae993b9c2a4f2 | Add Custom Attributes to assessment template | src/ggrc/models/assessment_template.py | src/ggrc/models/assessment_template.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: peter@reciprocitylabs.com
# Maintained By: peter@reciprocitylabs.com
"""A module containing the implementation of the assessment template entity."... | Python | 0 | @@ -633,24 +633,73 @@
ttributable%0A
+from ggrc.models.reflection import AttributeInfo%0A
from ggrc.mo
@@ -3187,16 +3187,192 @@
%7D,%0A
+ %22template_custom_attributes%22: %7B%0A %22display_name%22: %22Custom Attributes%22,%0A %22mandatory%22: True,%0A %22type%22: AttributeInfo.T... |
dea182f5618f7590ee7e8fb6d2872ac60c6b6069 | Add setup.py to afni. | nipype/interfaces/afni/setup.py | nipype/interfaces/afni/setup.py | Python | 0.000178 | @@ -0,0 +1,343 @@
+def configuration(parent_package='',top_path=None):%0A from numpy.distutils.misc_util import Configuration%0A%0A config = Configuration('afni', parent_package, top_path)%0A%0A config.add_data_dir('tests')%0A%0A return config%0A%0Aif __name__ == '__main__':%0A from numpy.distutils.core ... | |
fdf6dfbb7f82252cfe1e07719e3658fc529f47aa | Create hello-friend.py | baby-steps/hello-friend.py | baby-steps/hello-friend.py | Python | 0.992038 | @@ -0,0 +1,21 @@
+print %22hell0-fr1end%22%0A
| |
545bc9ae80fb9b141613e8a107560d6d868b5bcd | adding Solar System Universe | EXOSIMS/SimulatedUniverse/SolarSystemUniverse.py | EXOSIMS/SimulatedUniverse/SolarSystemUniverse.py | Python | 0.998929 | @@ -0,0 +1,2190 @@
+from EXOSIMS.Prototypes.SimulatedUniverse import SimulatedUniverse%0Aimport numpy as np%0Afrom EXOSIMS.util.eccanom import eccanom%0Aimport astropy.units as u%0Aimport astropy.constants as const%0A%0Aclass SolarSystemUniverse(SimulatedUniverse):%0A %22%22%22Simulated Universe module based on SAG1... | |
709ec407d333a624ff4476a81bc0f6ebb86f055a | add comments handle python file | data/Reddit/moderators_subreddit_comments.py | data/Reddit/moderators_subreddit_comments.py | Python | 0 | @@ -0,0 +1,1645 @@
+# -*- coding: utf-8 -*-%0A# @Author: Lich_%0A# @Date: 2016-11-26 18:14:52%0A# @Last Modified by: LichAmnesia%0A# @Last Modified time: 2016-11-26 13:53:35%0A%0Aimport json%0Aimport os%0A%0A%0A# generate the moderators from moderators file. the output is the moderators_subreddit file%0A%0Adef getm... | |
5c278ec8afe7fd97c0f3a4b45c0acc25706afd1e | add python_solve.py | dune-burgers/pymor-wrapper/python_solve.py | dune-burgers/pymor-wrapper/python_solve.py | Python | 0.998873 | @@ -0,0 +1,472 @@
+import sys%0A%0Afrom pymor.tools import mpi%0Afrom pymor.discretizations.mpi import mpi_wrap_discretization%0Afrom pymor.vectorarrays.mpi import MPIVectorArrayAutoComm%0A%0Afrom dune_burgers import discretize_dune_burgers%0A%0Afilename = sys.argv%5B1%5D%0Aexponent = float(sys.argv%5B2%5D)%0A%0Aobj_id... | |
b4729cfbff3bdf11da73436d4f927f0ffb9d1b40 | Add montage func | mnefun/misc.py | mnefun/misc.py | Python | 0.000001 | @@ -0,0 +1,1796 @@
+# -*- coding: utf-8 -*-%0A%22%22%22Miscellaneous utilities.%22%22%22%0A%0Aimport numpy as np%0A%0Aimport mne%0A%0A%0Adef make_montage(info, kind, check=False):%0A from . import _reorder%0A assert kind in ('mgh60', 'mgh70', 'uw_70', 'uw_60')%0A picks = mne.pick_types(info, meg=False, eeg=Tru... | |
3ed04c4ba438c9dcbea94e6b48a06316fcdac4d3 | diofant task 002 | diofant/diofant_002.py | diofant/diofant_002.py | Python | 0.99999 | @@ -0,0 +1,718 @@
+#!/usr/bin/env python3%0A%0A# %D0%98%D0%BC%D0%B5%D0%B5%D1%82%D1%81%D1%8F %D1%80%D1%8F%D0%B4 %D1%87%D0%B8%D1%81%D0%B5%D0%BB %D0%A4%D0%B8%D0%B1%D0%BE%D0%BD%D0%B0%D1%87%D1%87%D0%B8: 1, 1, 2, 3, 5, 8, 13, 21,...%0A# (%D0%BA%D0%B0%D0%B6%D0%B4%D1%8B%D0%B9 %D1%81%D0%BB%D0%B5%D0%B4%D1%83%D1%8E%D1%89%D0%B8%D0... | |
ded9c39402ca9cf7adfaaebbf06c196048d48db9 | Add presubmit check for run-bindings-tests | Source/bindings/PRESUBMIT.py | Source/bindings/PRESUBMIT.py | Python | 0.000071 | @@ -0,0 +1,2733 @@
+# Copyright (C) 2013 Google Inc. 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 are%0A# met:%0A#%0A# * Redistributions of source code must retain the above copyright%0A# notice... | |
e94d5f86d983f6b930d41abaed56cba05e5fa030 | test run_async | corehq/apps/userreports/tests/test_async_indicators.py | corehq/apps/userreports/tests/test_async_indicators.py | Python | 0.000005 | @@ -0,0 +1,2340 @@
+from django.test import SimpleTestCase%0A%0Afrom corehq.apps.userreports.models import DataSourceConfiguration%0Afrom corehq.apps.userreports.util import get_indicator_adapter%0A%0A%0Aclass RunAsynchronousTest(SimpleTestCase):%0A def _create_data_source_config(self, indicators=None):%0A de... | |
d9d8e68c92fc808e43cf5ffe897541738f90d428 | Add manage.py to support running project scripts | manage.py | manage.py | Python | 0 | @@ -0,0 +1,123 @@
+from flask_script import Manager%0A%0Afrom app import app%0A%0Amanager = Manager(app)%0A%0Aif __name__ == %22__main__%22:%0A manager.run()
| |
6b34500741b4ef1f73fac0045805ab49dad579ba | product expression | doing-math-with-python/product_expression.py | doing-math-with-python/product_expression.py | Python | 0.960891 | @@ -0,0 +1,579 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0AProduct of two expressions%0A%0ACreated on Tue Feb 16 14:38:14 2016%0A%0A@author: Liu Lixiang%0A%22%22%22%0A%0Afrom sympy import expand, sympify, pprint%0Afrom sympy.core.sympify import SympifyError%0A%0A%0Adef product(expr1, expr2):%0A prod = expand(expr1*exp... | |
fbd179d9d22a2eef6c2fb24152a441b85133e556 | Add missing component of previous commit | lowfat/utils.py | lowfat/utils.py | Python | 0.000002 | @@ -0,0 +1,562 @@
+%22%22%22%0AThis module contains small utility classes and functions which do not clearly belong to one part of the project.%0A%22%22%22%0A%0Aimport enum%0A%0A%0Aclass ChoicesEnum(enum.Enum):%0A %22%22%22%0A Abstract Enum class to represent values in a Django CharField choices.%0A %22%22%22%... | |
9199563bb21276102ca58dc6b7c99f593db863d4 | Add test for call_actions_during_tree_build | tests/func/test_build_tree.py | tests/func/test_build_tree.py | Python | 0.000002 | @@ -0,0 +1,994 @@
+import pytest # noqa%0Afrom parglare import Grammar, Parser%0A%0A%0Adef test_call_actions_during_tree_build():%0A grammar = %22%22%22%0A Program: %22begin%22 MoveCommand* %22end%22;%0A MoveCommand: %22move%22 Direction;%0A Direction: %22up%22 %7C %22down%22 %7C %22left%22 %7C %22right%22... | |
9140b3249820d0dd86f7f85270327d9264841b50 | Test for selecting mysql search backend | tests/search_backend_mysql.py | tests/search_backend_mysql.py | Python | 0 | @@ -0,0 +1,682 @@
+from wolis.test_case import WolisTestCase%0Afrom wolis import utils%0A%0Aclass SearchBackendMysqlTest(WolisTestCase):%0A @utils.restrict_database('mysql*')%0A @utils.restrict_phpbb_version('%3E=3.1.0')%0A def test_set_search_backend(self):%0A self.login('morpheus', 'morpheus')%0A ... | |
3c3fe1e1f1884df47157c71584b7b6087bde7f10 | add owner check, code borrowed from RoboDanny | cogs/utils/checks.py | cogs/utils/checks.py | Python | 0 | @@ -0,0 +1,200 @@
+from discord.ext import commands%0A%0Adef is_owner_check(message):%0A return message.author.id == '103714384802480128'%0A%0Adef is_owner():%0A return commands.check(lambda ctx: is_owner_check(ctx.message))%0A
| |
ee88f6927dee820318bc821081138374b8f754f2 | Create data_functions.py | data_functions.py | data_functions.py | Python | 0.000261 | @@ -0,0 +1,1619 @@
+import pandas as pd%0Aimport numpy as np%0A%0Adef load_data(path):%0A '''%0A (str) -%3E (pandas.DataFrame)%0A Loads the database and cleans the whitespace in STATIONS_ID.%0A %0A IMPORTANT: This function assumes you have the database stored in a text file in the directory.%0A '''%0A... | |
82906d8dabfd551c997569f2f36ecdfc1ef3057f | Create duplicates.py | Python/duplicates.py | Python/duplicates.py | Python | 0.000391 | @@ -0,0 +1,377 @@
+#The rem_dep method removes the duplicate values while maintaining the original order of the list.%0A%0Adef rem_dup(values):%0A output=%5B%5D%0A seen=set()%0A for val in values:%0A if val not in seen:%0A output.append(val)%0A seen.add(val)%0A return output ... | |
8611ea1e23b8958be98a6d5c15bd66f08e46859f | Handle connection error when sending event to consul. | meerkat_libs/consul_client/__init__.py | meerkat_libs/consul_client/__init__.py | import json
import logging
import jwt
import collections
from os import environ
import backoff as backoff
import requests
from meerkat_libs import authenticate
CONSUL_URL = environ.get("CONSUL_URL", "http://nginx/consul")
SUBMISSIONS_BUFFER_SIZE = environ.get("CONSUL_SUBMISSIONS_BUFFER_SIZE", 1000)
DHIS2_EXPORT_ENAB... | Python | 0 | @@ -1997,24 +1997,37 @@
_id%5D%7D%0A )%0A
+ try:%0A
requests
@@ -2128,16 +2128,20 @@
ayload)%0A
+
even
@@ -2164,16 +2164,164 @@
d%5D = %5B%5D%0A
+ except requests.exceptions.ChunkedEncodingError:%0A logging.error(%22Failed to send chunk of events. Count %25i%22, len(events_buffer%5B... |
f666560f9ffa2323b8a125e3ad3d3faf6bd5b3de | add command to grant sms gateway permissions | corehq/apps/smsbillables/management/commands/add_sms_gateway_permissions.py | corehq/apps/smsbillables/management/commands/add_sms_gateway_permissions.py | Python | 0.000009 | @@ -0,0 +1,3066 @@
+from django.contrib.auth.models import User%0Afrom django.core.management import BaseCommand%0A%0Afrom django_prbac.models import Grant, Role, UserRole%0A%0Afrom corehq import privileges%0A%0A%0Aclass Command(BaseCommand):%0A help = 'Grants the user(s) specified the privilege to access global sms... | |
ff82f56b8ea901a30478b11a61f8ca52b23346bd | Add a test case for guessing the BuildDir associated with a subdirectory argument. | test/BuildDir/guess-subdir.py | test/BuildDir/guess-subdir.py | Python | 0.997656 | @@ -0,0 +1,2127 @@
+#!/usr/bin/env python%0A#%0A# __COPYRIGHT__%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining%0A# a copy of this software and associated documentation files (the%0A# %22Software%22), to deal in the Software without restriction, including%0A# without limitation the rights ... | |
f8fbf47ede2536d2d2a40ef70a648b11ea928132 | Replace libraries of plumbing/models/exporters.py (issue #11). | imagedownloader/plumbing/models/exporters.py | imagedownloader/plumbing/models/exporters.py | from django.db import models
from core import Process, Stream, FileStatus, File
from libs.file import netcdf as nc
import os
import calendar
import collections
from libs import matrix
class Compact(Process):
class Meta:
app_label = 'plumbing'
extension = models.TextField()
resultant_stream = models.Foreig... | Python | 0 | @@ -119,63 +119,74 @@
ort
-os%0Aimport calendar%0Aimport collections%0Afrom libs
+calendar%0Afrom libs import matrix%0Aimport pytz%0Afrom datetime
import
matr
@@ -181,22 +181,24 @@
import
-matrix
+datetime
%0A%0A%0Aclass
|
88e5b5117c747f21cc868503d2e5c123ca976585 | Add tests for decorators | kolibri/core/tasks/test/test_decorators.py | kolibri/core/tasks/test/test_decorators.py | Python | 0 | @@ -0,0 +1,2731 @@
+import pytest%0A%0Afrom kolibri.core.tasks.decorators import task%0Afrom kolibri.core.tasks.exceptions import FunctionNotRegisteredAsJob%0Afrom kolibri.core.tasks.job import JobRegistry%0Afrom kolibri.core.tasks.job import RegisteredJob%0Afrom kolibri.core.tasks.utils import stringify_func%0A%0A%0A@... | |
a6be0447e07d388f5dc4942d7f9e391366185c78 | Create solution.py | leetcode/easy/count_and_say/py/solution.py | leetcode/easy/count_and_say/py/solution.py | Python | 0.000018 | @@ -0,0 +1,544 @@
+class Solution(object):%0A def countAndSay(self, n):%0A %22%22%22%0A :type n: int%0A :rtype: str%0A %22%22%22%0A s = '1'%0A %0A while n %3E 1:%0A t = ''%0A cnt = 1%0A %0A for i in range(len(s)):%... | |
ff187730fa1ebd64984dbb6e91a8f04edae84548 | Introduce module for CLI commands; implement data generating command | ngx_task/cli.py | ngx_task/cli.py | Python | 0 | @@ -0,0 +1,660 @@
+import os%0Afrom concurrent.futures import ThreadPoolExecutor, as_completed%0A%0Afrom ngx_task import settings, utils%0A%0A%0Adef generate_data():%0A if not os.path.exists(settings.DATA_DIR):%0A os.mkdir(settings.DATA_DIR, 0o755)%0A%0A files_to_submit = %5B'arc-%7B%7D.zip'.format(arc_num... | |
4ccf9b6135ca5c6317502ffd663d5de4d180eea3 | Add migration for commit b52f572646f30a8a4f2fc2bec6fc31c8f498f33f | mcf_standard_browser/standards_review/migrations/0032_auto_20160307_1802.py | mcf_standard_browser/standards_review/migrations/0032_auto_20160307_1802.py | Python | 0.000001 | @@ -0,0 +1,1254 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9.3 on 2016-03-07 18:02%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('standards_review... | |
bc5105d7e8263bcaf0be8cc88bff8438fa1972a4 | add import script for ryedale | polling_stations/apps/data_collection/management/commands/import_ryedale.py | polling_stations/apps/data_collection/management/commands/import_ryedale.py | Python | 0 | @@ -0,0 +1,1616 @@
+%22%22%22%0AImports Ryedale%0A%22%22%22%0Afrom django.contrib.gis.geos import Point, GEOSGeometry%0A%0Afrom data_collection.management.commands import BaseKamlImporter%0A%0Aclass Command(BaseKamlImporter):%0A %22%22%22%0A Imports the Polling Station data from Ryedale Council%0A %22%22%22%0A... | |
d44bf960aa597e5a38fbc2f8f7dd18fbd704cf7c | add nova start vm to recovery | drcontroller/recovery/nova_start_vm.py | drcontroller/recovery/nova_start_vm.py | Python | 0 | @@ -0,0 +1,513 @@
+import novaclient.v1_1.client as novaclient%0Aimport ConfigParser%0A%0Adef start_vm(server_id):%0A cf=ConfigParser.ConfigParser()%0A cf.read(%22/home/eshufan/projects/drcontroller/drcontroller/conf/set.conf%22)%0A drc_ncred=%7B%7D%0A drc_ncred%5B'auth_url'%5D= cf.get(%22drc%22,%22auth_url... | |
6d03266160ce95a41b94561d707e399df78aae14 | Add sanity test case comm_wifi_connect | lib/oeqa/runtime/sanity/comm_wifi_connect.py | lib/oeqa/runtime/sanity/comm_wifi_connect.py | Python | 0.000143 | @@ -0,0 +1,1568 @@
+import time%0Afrom oeqa.oetest import oeRuntimeTest%0A%0Aclass CommWiFiTest(oeRuntimeTest):%0A '''WiFi test by connmanctl'''%0A def test_wifi_connect_nopassword(self):%0A '''connmanctl to connect a no-password wifi AP'''%0A # un-block software rfkill lock%0A self.target.ru... | |
2cc6edec8295a216261fff09388a35e0805f474c | Add test to validate service names | tests/functional/test_service_names.py | tests/functional/test_service_names.py | Python | 0.000001 | @@ -0,0 +1,2437 @@
+# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22). You%0A# may not use this file except in compliance with the License. A copy of%0A# the License is located at%0A#%0A# http://aws.amazon.com/apache2.0/%... | |
6ad9b8e65562c00607fe0fe9f92cdba3c022ef2b | Add initial version Teach First Oauth2 backend. | lms/djangoapps/student_account/teachfirst.py | lms/djangoapps/student_account/teachfirst.py | Python | 0 | @@ -0,0 +1,2121 @@
+from django.conf import settings%0Afrom social_core.backends.oauth import BaseOAuth2%0Aimport logging%0A%0Alog = logging.getLogger(__name__)%0A%0A%0Aclass TeachFirstOAuth2(BaseOAuth2):%0A %22%22%22TeachFirst OAuth2 authentication backend.%22%22%22%0A settings_dict = settings.CUSTOM_BACKENDS.ge... | |
fde3496e41c9c00231d0f4d309147ff7dbae0f16 | Improve heredoc | cms/wizards/wizard_base.py | cms/wizards/wizard_base.py | # -*- coding: utf-8 -*-
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured
from django.forms.models import ModelForm
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import (
override as force_language,
f... | Python | 0.000001 | @@ -710,16 +710,33 @@
am form:
+ The form to use.
%0A
|
372469139dc103f75003f96616ac53bce8986274 | Add prediction module | src/righter/predict.py | src/righter/predict.py | Python | 0.000001 | @@ -0,0 +1,679 @@
+import json%0Aimport argparse%0A%0Aimport righter%0A%0Aif __name__ == '__main__':%0A parser = argparse.ArgumentParser()%0A parser.add_argument('-i', '--input-file', help='File with one json per line containing the key text', required=True)%0A parser.add_argument('-o', '--file-output', help='... | |
1490aa8b11f9a7766eb03883214ded87ce1de439 | Generate a sample binomial distribution | stats/binomial_plot.py | stats/binomial_plot.py | Python | 0.999999 | @@ -0,0 +1,805 @@
+import numpy as np%0Aimport random%0Aimport matplotlib.pylab as plt%0A%0Afrom collections import Counter%0A%0A%0Adef run_trial():%0A coin_tosses = 10%0A p = 0.5%0A successes = 0%0A for t in range(coin_tosses):%0A if random.random() %3C p:%0A successes = successes + 1%0A ... | |
15daff9a7823ddd7dbc3fb6f141d539d6b636301 | Add description field to Config | project/timeslot/migrations/0008_auto_20160622_0937.py | project/timeslot/migrations/0008_auto_20160622_0937.py | Python | 0.000001 | @@ -0,0 +1,433 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('timeslot', '0007_auto_20160616_0049'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterF... | |
757812e63c42f38ad065c31744427c5902a5d322 | Move some Utils outside of the main script. | data-preprocessor/listFile.py | data-preprocessor/listFile.py | Python | 0 | @@ -0,0 +1,540 @@
+# -*- coding: utf-8 -*-%0D%0A%22%22%22%0D%0ACreated on Sun Sep 11 10:23:38 2016%0D%0A%0D%0A@author: SISQUAKE%0D%0A%22%22%22%0D%0Aimport os%0D%0Adef listFilePath(path):%0D%0A File = %5B%5D;%0D%0A Dir = %5B%5D;%0D%0A%0D%0A for (dirpath, dirnames, filenames) in os.walk(path):%0D%0A for n... | |
1bf55df37a12af7984f08eb429e61a2c3a7cd836 | Add initial server states | blitz/io/server_states.py | blitz/io/server_states.py | Python | 0.000001 | @@ -0,0 +1,2828 @@
+__author__ = 'Will Hart'%0A%0Afrom blitz.constants import *%0Afrom blitz.io.client_states import BaseState%0A%0A%0Adef validate_command(tcp, msg, commands):%0A %22%22%22%0A Helper function which checks to see if a message is in the list of valid commands%0A and sends an appropriate response... | |
8e8cb549251b6914a34a729bb06c02462ed95af9 | convert old wizard into osv memory wizard for configuration | bin/addons/base/module/wizard/base_module_configuration.py | bin/addons/base/module/wizard/base_module_configuration.py | Python | 0.000002 | @@ -0,0 +1,1340 @@
+# -*- coding: utf-8 -*-%0A##############################################################################%0A#%0A# OpenERP, Open Source Management Solution%0A# Copyright (C) 2004-2010 Tiny SPRL (%3Chttp://tiny.be%3E).%0A#%0A# This program is free software: you can redistribute it and/or modif... | |
90c27c1444f80b6d746c8f92b6b79e38ae5ce87e | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/1a04c55547456cffd9b9d250dc8680eb9d89f750. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "5e36ba4f8e42a4022062a10a75684d5a2dfb1b53"
TFRT_SHA256 = "3bf90326b6dd4f938825dd7ab3424abbee7cc86b370f24... | Python | 0.000002 | @@ -210,133 +210,133 @@
= %22
-5e36ba4f8e42a4022062a10a75684d5a2dfb1b53%22%0A TFRT_SHA256 = %223bf90326b6dd4f938825dd7ab3424abbee7cc86b370f24e285ff60440c3db360
+1a04c55547456cffd9b9d250dc8680eb9d89f750%22%0A TFRT_SHA256 = %22296130004f8b3ce22b46b9f263c9379dd462eff53c2332f2ddd2d5ab26ab87ec
%22%0A%0A
|
f099d055279abfea2bd58c8e0b28c2fa162ac8cd | modify zqplant crawler script | crawler/DzwBaikeCrawler.py | crawler/DzwBaikeCrawler.py | Python | 0 | @@ -0,0 +1,735 @@
+import hashlib%0A%0A%0A'''%0Acurl%0A-H 'Host: api.dzwbaike.xyz'%0A-H 'Content-Type: text/html;charset=UTF-8'%0A-H 'Accept: */*' -H 'Accept-Language: zh-cn'%0A-H 'token: 05e33d91-dd85-40d5-aa67-a90130270a95'%0A-H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8... | |
32a569f0f6f33ef5cf11031bb359989379582489 | add script to create cloudtrail table in Athena | create_cloudtrail_table.py | create_cloudtrail_table.py | Python | 0 | @@ -0,0 +1,2253 @@
+import boto3%0A%0A%0A# Create AWS session%0Atry:%0A session = boto3.session.Session(profile_name='training')%0Aexcept Exception as e:%0A session = boto3.session.Session()%0A%0A# Connect to Athena%0Aathena = session.client('athena', region_name='us-east-1')%0A%0A%0Adef lambda_handler(event, con... | |
4d6cbf52620c7af6b5b0698839712e35e303ff8f | Use self.get_column_types() | csvkit/utilities/in2csv.py | csvkit/utilities/in2csv.py | #!/usr/bin/env python
import agate
import agatedbf # noqa
import agateexcel # noqa
from csvkit import convert
from csvkit.convert.fixed import fixed2csv
from csvkit.convert.geojs import geojson2csv
from csvkit.cli import CSVKitUtility
SUPPORTED_FORMATS = ['csv', 'dbf', 'fixed', 'geojson', 'json', 'ndjson', 'xls', ... | Python | 0.000003 | @@ -3776,24 +3776,25 @@
der_row%0A
+%0A
elif sel
@@ -3789,115 +3789,29 @@
-el
if
-self.args.no_inference:%0A # Streaming CSV musn't set column_types, but other formats should.
+filetype != 'dbf':
%0A
@@ -3848,32 +3848,30 @@
%5D =
-agate.TypeTester(limit=0
+self.get_column_types(
)%... |
f693949a21864938991904ed1503ae5303426c90 | Revert "Remove test stub" | test/TestLineNumber.py | test/TestLineNumber.py | Python | 0 | @@ -0,0 +1,1952 @@
+# Copyright (c) 2020 Albin Vass %3Calbin.vass@gmail.com%3E%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 ... | |
4404f1e81d9be6d7493388ca98300abf916136a6 | Fix typo in the power of H. | pyflation/analysis/deltaprel.py | pyflation/analysis/deltaprel.py | ''' pyflation.analysis.deltaprel - Module to calculate relative pressure
perturbations.
Author: Ian Huston
For license and copyright information see LICENSE.txt which was distributed with this file.
'''
from __future__ import division
import numpy as np
def soundspeeds(Vphi, phidot, H):
"""Sound speeds of the ba... | Python | 0.001612 | @@ -4574,16 +4574,19 @@
ult = H*
+*2*
phidot*m
|
3bb43f31263cce7ceebab943a1eed9e8c83cb90d | Set dbtable for models to use the "celery_" prefix not "djcelery". | djcelery/models.py | djcelery/models.py | import django
from django.db import models
from django.utils.translation import ugettext_lazy as _
from picklefield.fields import PickledObjectField
from celery import conf
from celery import states
from djcelery.managers import TaskManager, TaskSetManager
TASK_STATUSES_CHOICES = zip(states.ALL_STATES, states.ALL_S... | Python | 0 | @@ -942,24 +942,61 @@
%22task meta%22)
+%0A db_table = %22celery_taskmeta%22
%0A%0A def to
@@ -1723,16 +1723,56 @@
t meta%22)
+%0A db_table = %22celery_tasksetmeta%22
%0A%0A de
|
00990b531f1f78b372b0b08a649a84e6168a3c0e | Use ugettext_lazy for import-time translations. | debug_toolbar/panels/timer.py | debug_toolbar/panels/timer.py | from __future__ import absolute_import, unicode_literals
try:
import resource # Not available on Win32 systems
except ImportError:
resource = None
import time
from django.template.loader import render_to_string
from django.utils.translation import ugettext as _
from debug_toolbar.panels import Panel
clas... | Python | 0 | @@ -262,16 +262,21 @@
ugettext
+_lazy
as _%0Afr
|
317c74fb6a31aad82f080b3bb8383c4047ae2f63 | Create tests.py | demo/openmrs/openmrs/tests.py | demo/openmrs/openmrs/tests.py | Python | 0.000001 | @@ -0,0 +1,1869 @@
+import unittest%0Afrom BaseOpenmrsObject import *%0A%0Aclass TestOrderFunctions(unittest.TestCase):%0A%0A def setUp(self):%0A self.order = Order()%0A self.order.setOrderId(9112)%0A self.order.setOrderNumber('911')%0A %0A def test_copy_methods(self):%0A copy1 ... | |
9f18d31b85067fac2fd4d41d59c3158b50bd8c87 | math2 | tests/domains/math2.py | tests/domains/math2.py | Python | 0.999621 | @@ -0,0 +1,374 @@
+#!/usr/bin/env python3%0A%0Afrom collections import defaultdict%0Afrom copy import copy%0Afrom strips import *%0A%0Aclass S(State):%0A def __init__(self, n):%0A self.n = n%0A%0A @Action%0A def incr(self):%0A if self.n %25 4 != 0: raise UnsatisfiedPreconditions()%0A self.... | |
274d539e0cf08a3417315bd68bc5544dbb21d0ff | Add config test | tests/config.py | tests/config.py | Python | 0.000001 | @@ -0,0 +1,1364 @@
+import wakefs.config%0Aimport os%0Aimport unittest%0Aimport random%0Aimport string%0A%0Adef random_str(N):%0A ''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for x in range(N))%0A%0Aclass TestConfigFileCreate(unittest.TestCase):%0A def test_file_create(se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.