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 |
|---|---|---|---|---|---|---|---|
69939f351cd9c9d555fa1cd091b67314558e862b | Add __future__ import | powerline/segments/tmux.py | powerline/segments/tmux.py | # vim:fileencoding=utf-8:noet
from powerline.bindings.tmux import get_tmux_output
def attached_clients(pl, minimum=1):
'''Return the number of tmux clients attached to the currently active session
:param int minimum:
The minimum number of attached clients that must be present for this
segment to be visible.
... | Python | 0.999979 | @@ -22,16 +22,99 @@
f-8:noet
+%0Afrom __future__ import absolute_import, unicode_literals, division, print_function
%0A%0Afrom p
|
ba76ae145c570fce671f0ab115d4a0740a29cde4 | add hadoop | conpaas-client/cps/hadoop.py | conpaas-client/cps/hadoop.py | Python | 0.000001 | @@ -0,0 +1,227 @@
+import sys%0A%0Afrom cps.base import BaseClient%0A%0Aclass Client(BaseClient):%0A%0A def info(self, service_id):%0A service = BaseClient.info(self, service_id)%0A%0A def usage(self, cmdname):%0A BaseClient.usage(self, cmdname)%0A
| |
2476e7202933c197004688d32994d3b24a7ce74f | Add missing fulltoc for Sphinx documentation. | docs/vendor/sphinxcontrib/fulltoc.py | docs/vendor/sphinxcontrib/fulltoc.py | Python | 0 | @@ -0,0 +1,3288 @@
+# -*- encoding: utf-8 -*-%0A#%0A# Copyright %C2%A9 2012 New Dream Network, LLC (DreamHost)%0A#%0A# Author: Doug Hellmann %3Cdoug.hellmann@dreamhost.com%3E%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. ... | |
0822547f3fcd79a5332c450d78cd24999e5e81d0 | Migrate huts | c2corg_api/scripts/migration/documents/waypoints/huts.py | c2corg_api/scripts/migration/documents/waypoints/huts.py | Python | 0.000001 | @@ -0,0 +1,3209 @@
+from c2corg_api.scripts.migration.documents.waypoints.waypoint import %5C%0A MigrateWaypoints%0A%0A%0Aclass MigrateHuts(MigrateWaypoints):%0A%0A def get_name(self):%0A return 'huts'%0A%0A def get_count_query(self):%0A return (%0A 'select count(*) from app_huts_archi... | |
c994c1c86df7e6698ccef342b1b2101f03c01587 | Add daily stats | tpt/ppatrigger/management/commands/dailystats.py | tpt/ppatrigger/management/commands/dailystats.py | Python | 0.000012 | @@ -0,0 +1,1989 @@
+import traceback%0Aimport pytz%0Afrom datetime import datetime, timedelta%0Afrom django.core.management.base import BaseCommand%0Afrom ppatrigger.models import Package%0Afrom ppatrigger.models import DailyStats%0Afrom ppatrigger.models import Build%0A%0Aclass Command(BaseCommand):%0A args = ''%0A... | |
7c2095c0330d14382db76bef944efae5f8d76faf | Add file with tests from rainbow categorical type example | dynd/tests/test_types_categorical.py | dynd/tests/test_types_categorical.py | Python | 0 | @@ -0,0 +1,2723 @@
+import sys%0Aimport unittest%0Afrom dynd import nd, ndt%0A%0Aclass TestDType(unittest.TestCase):%0A def test_make_categorical(self):%0A # Create categorical type with 256 values%0A tp = ndt.make_categorical(nd.range(0, 512, 2))%0A self.assertEqual(tp.type_id, 'categorical')%0... | |
9f73e60ba9d3775ef4dda9c815412f28ed80b518 | Add new package: lzop (#17098) | var/spack/repos/builtin/packages/lzop/package.py | var/spack/repos/builtin/packages/lzop/package.py | Python | 0 | @@ -0,0 +1,984 @@
+# 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 Lzop(CMakePackage):%0A %22%22%22lzop is a file compresso... | |
1f5158d7c24e304b1b2ed2c374cd05aa662aa333 | Add LruCache object. | statbot/cache.py | statbot/cache.py | Python | 0 | @@ -0,0 +1,1336 @@
+#%0A# cache.py%0A#%0A# statbot - Store Discord records for later analysis%0A# Copyright (c) 2017 Ammon Smith%0A#%0A# statbot is available free of charge under the terms of the MIT%0A# License. You are free to redistribute and/or modify it under those%0A# terms. It is distributed in the hopes that it... | |
20b8f5c5d390d8449e4dc18cf98291486aeb7153 | [151. Reverse Words in a String][Accepted]committed by Victor | 151-Reverse-Words-in-a-String/solution.py | 151-Reverse-Words-in-a-String/solution.py | Python | 0.999993 | @@ -0,0 +1,479 @@
+class Solution(object):%0A def reverseWords(self, s):%0A %22%22%22%0A :type s: str%0A :rtype: str%0A %22%22%22%0A if not s:%0A return %22%22%0A %0A words=s.split()%0A print words%0A i,j=0,len(words)-1%0A while i%3Cj:%... | |
8d7a4dd6c7a1d7a3ed65ff1ce9ddbde21e1b7cdb | set mac address properly | scripts/opencontrail-kubelet/opencontrail_kubelet/lxc_manager.py | scripts/opencontrail-kubelet/opencontrail_kubelet/lxc_manager.py | import logging
import re
import subprocess
import sys
def shell_command(str):
logging.debug('Ran shell command: %s' % str)
cmd = subprocess.check_output(str, shell=True)
logging.debug('output: %s' % cmd.rstrip())
return cmd
class LxcManager(object):
def __init__(self):
pass
def _int... | Python | 0 | @@ -2404,32 +2404,153 @@
(nsname, mac))%0A
+ shell_command('ip netns exec %25s ip addr flush dev %25s'%0A %25 (nsname, ifname_instance))%0A
return i
|
0eb573afa067e23422c5a5495563a6f4d87a549d | Create soundcloud.py | apis/soundcloud.py | apis/soundcloud.py | Python | 0.000009 | @@ -0,0 +1,2060 @@
+%22%22%22 Contains functions to fetch info from api.soundcloud.com %22%22%22%0Afrom utilities import web%0A%0A# Soundcloud API key.%0ASOUNDCLOUD_API_KEY = '4ce43a6430270a1eea977ff8357a25a3'%0A%0A%0Adef soundcloud_search(search):%0A %22%22%22%0A Searches soundcloud's API for a given search term... | |
4d01b80a6ef61f50604a8f996fa1f3bf3205b017 | check point | scripts/opencontrail-kubelet/opencontrail_kubelet/lxc_manager.py | scripts/opencontrail-kubelet/opencontrail_kubelet/lxc_manager.py | import logging
import re
import subprocess
import sys
def shell_command(str):
cmd = subprocess.check_output(str, shell=True)
logging.debug('Ran shell command: %s' % str)
logging.debug('output: %s' % cmd.rstrip())
return cmd
class LxcManager(object):
def __init__(self):
pass
def _int... | Python | 0.000001 | @@ -1169,38 +1169,28 @@
s
-ubprocess.check_output
+hell_command
(%22brctl
@@ -1218,26 +1218,16 @@
eth%22, %5C%0A
-
@@ -1432,38 +1432,28 @@
ex = %5B s
-ubprocess.check_output
+hell_command
( %5C%0A
|
5feef18ca3dda099f33568bf0f2b189fe297a3e0 | add test function rosenbrock | pyea/functions/__init__.py | pyea/functions/__init__.py | Python | 0.000002 | @@ -0,0 +1,1165 @@
+#TODO: Add documentation%0A%0Aimport numpy as np%0A%0A%0Adef func_rosenbrock(pop, a=1, b=100):%0A # http://en.wikipedia.org/wiki/Rosenbrock_function%0A x = pop%5B:, 0%5D%0A y = pop%5B:, 1%5D%0A return (a - x)**2 + b * (y - x**2)**2%0A%0A%0Adef print_func(func, **kwargs):%0A from mpl_t... | |
378bd7f4d647243a1e736f4dc0bfd0742d5f3d0b | Create Combinations.py | Array/Combinations.py | Array/Combinations.py | Python | 0.000001 | @@ -0,0 +1,684 @@
+%60%60%60%0AGiven two integers n and k, return all possible combinations of k numbers out of 1 ... n.%0A%0AFor example,%0AIf n = 4 and k = 2, a solution is:%0A%0A%5B%0A %5B2,4%5D,%0A %5B3,4%5D,%0A %5B2,3%5D,%0A %5B1,2%5D,%0A %5B1,3%5D,%0A %5B1,4%5D,%0A%5D%0A%60%60%60%0A%0Aclass Solution:%0A ... | |
be9a1afc61be483e8c585cef247f62071809c894 | add BuildWorktree.set_default_config | python/qibuild/worktree.py | python/qibuild/worktree.py | import os
import qisys.command
import qisys.worktree
from qibuild.dependencies_solver import topological_sort
import qibuild.build
import qibuild.build_config
import qibuild.project
class BuildWorkTreeError(Exception):
pass
class BuildWorkTree(qisys.worktree.WorkTreeObserver):
"""
"""
def __init__(s... | Python | 0.000001 | @@ -285,16 +285,72 @@
%0A %22%22%22
+ Stores a list of projects that can be built using CMake
%0A%0A %22%22
@@ -3230,10 +3230,382 @@
name)%0A%0A
-%0A
+ def set_default_config(self, name):%0A %22%22%22 Set the default toolchain for this worktree %22%22%22%0A local_settings = qibuild.config.Loc... |
474c5f977ab5b035567f0107c457622c51189ac6 | Add new topics migration file | csunplugged/topics/migrations/0086_auto_20171108_0840.py | csunplugged/topics/migrations/0086_auto_20171108_0840.py | Python | 0 | @@ -0,0 +1,2529 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.5 on 2017-11-08 08:40%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('topics', '0085_auto_20171030_0035'),%0A %5D%0A%... | |
afe0f8fc731639cbe28798bb2a554c84ccbd8b2a | Create test_script.py | test_script.py | test_script.py | Python | 0.000004 | @@ -0,0 +1,20 @@
+print %22hello world%22%0A
| |
a2bc05454ba166e3931fba130e44f49f66a79080 | Add virtualshackles crawler | comics/comics/virtualshackles.py | comics/comics/virtualshackles.py | Python | 0 | @@ -0,0 +1,1278 @@
+import re%0A%0Afrom comics.aggregator.crawler import CrawlerBase, CrawlerResult%0Afrom comics.meta.base import MetaBase%0A%0Aclass Meta(MetaBase):%0A name = 'Virtual Shackles'%0A language = 'en'%0A url = 'http://www.virtualshackles.com/'%0A start_date = '2009-03-27'%0A rights = 'Jerem... | |
9fc7f98812a67606bb707a02c1acbe9dd77d94fa | Update ExamLogFilter.filter_collection | kolibri/logger/api.py | kolibri/logger/api.py | from django.db.models.query import F
from django_filters import ModelChoiceFilter
from django_filters.rest_framework import CharFilter, DjangoFilterBackend, FilterSet
from kolibri.auth.api import KolibriAuthPermissions, KolibriAuthPermissionsFilter
from kolibri.auth.filters import HierarchyRelationsFilter
from kolibri.... | Python | 0.000001 | @@ -5943,16 +5943,22 @@
ueryset,
+ name,
collect
|
c13014c18496f35c4c94f156a18d442d3859f73b | Add assembly testing module | testing_ops.py | testing_ops.py | Python | 0 | @@ -0,0 +1,648 @@
+from __future__ import absolute_import, print_function, division%0A%0Afrom firedrake import *%0A%0Amesh = UnitSquareMesh(2, 2, quadrilateral=False)%0An = FacetNormal(mesh)%0A%0Adegree = 1%0AV = FunctionSpace(mesh, %22RT%22, degree)%0AU = FunctionSpace(mesh, %22DG%22, degree - 1)%0AW = V * U%0A%0Au, p... | |
71afe426a84789b65953ccd057014d17a11de859 | Add a command to extend the generation_high from generation 1 to 2 | mzalendo/core/management/commands/core_extend_areas_to_generation_2.py | mzalendo/core/management/commands/core_extend_areas_to_generation_2.py | Python | 0.002458 | @@ -0,0 +1,858 @@
+# The import of data into Kenyan MapIt had the constituencies in%0A# generation 2, while all the other area types were in generation 1.%0A# This is unfortunate since it makes it appear to later import scripts%0A# that the district type disappeared between generation 1 and 3.%0A#%0A# This script just ... | |
17fddbb1df78420aaebb811785b8e99769b45fa9 | Create keyradius.py | bin/keyradius.py | bin/keyradius.py | Python | 0 | @@ -0,0 +1,919 @@
+%0Aimport csv%0Afrom numpy import sqrt%0A%0A# Midpoint for Key Bridge%0Ax1 = 38.902543%0Ay1 = -77.069830%0A%0A# Threshold marker %0Ax2 = 38.900122%0Ay2 = -77.071176%0A%0A%0Aradius_squared = (x2 - x1)**2 + (y2 - y1)**2%0Aradius = sqrt(radius_squared)%0A%0Adata_file = open(%22IncidentData_24OCT14.csv%2... | |
431fab0520c38a8698c8a1569f31a860012cfd7c | fix reset_password show twice in reset email (#134) | CTFd/auth.py | CTFd/auth.py | from flask import render_template, request, redirect, abort, jsonify, url_for, session, Blueprint
from CTFd.utils import sha512, is_safe_url, authed, mailserver, sendmail, can_register, get_config, verify_email
from CTFd.models import db, Teams
from itsdangerous import TimedSerializer, BadTimeSignature, Signer, BadSig... | Python | 0.001005 | @@ -2854,31 +2854,16 @@
? %0A%0A%7B0%7D/
-reset_password/
%7B1%7D%0A%0A%22%22%22
|
c27e97ea959a9863e57ce12b0afc5fa092562548 | Create Character.py | Character.py | Character.py | Python | 0 | @@ -0,0 +1,1182 @@
+import untangle%0A%0Aclass Character(object):%0A def __init__(self, data):%0A assert isinstance(data, dict)%0A self.__dict__ = data%0A%0A%0Adef get_data(character):%0A '''%0A :param character: String, character name%0A :return: Dictionary, character data%0A '''%0... | |
983d6b12db4050ff7d252e1717adbfe39add2f49 | Add missing file | Allura/allura/lib/widgets/auth_widgets.py | Allura/allura/lib/widgets/auth_widgets.py | Python | 0 | @@ -0,0 +1,876 @@
+import ew as ew_core%0Aimport ew.jinja2_ew as ew%0Afrom ew.core import validator%0A%0Afrom pylons import request%0Afrom formencode import Invalid%0Afrom webob import exc%0A%0Afrom .forms import ForgeForm%0A%0Afrom allura.lib import plugin%0A%0Aclass LoginForm(ForgeForm):%0A submit_text='Login'%0A ... | |
c349e8df72c09a98fe6b038c763c41008bef70a2 | add migration for reimporting universities | hs_dictionary/migrations/0005_reimport_universities.py | hs_dictionary/migrations/0005_reimport_universities.py | Python | 0 | @@ -0,0 +1,720 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Aimport csv%0Aimport os%0A%0Afrom django.db import migrations, models%0A%0Afrom hs_dictionary.models import University%0A%0A%0Adef forwards(apps, schema_editor):%0A University.objects.all().delete()%0A with open(os.path.dirna... | |
d77e8df3fa913e7a60c1870e49a6b6197d7a9125 | Add tests for zerver/views/realm_emoji.py. | zerver/tests/test_realm_emoji.py | zerver/tests/test_realm_emoji.py | Python | 0 | @@ -0,0 +1,1923 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import absolute_import%0A%0Afrom zerver.lib.actions import get_realm, check_add_realm_emoji%0Afrom zerver.lib.test_helpers import AuthedTestCase%0Aimport ujson%0A%0Aclass RealmEmojiTest(AuthedTestCase):%0A%0A def test_list(self):%0A self.login(%22i... | |
6cb66978e44d447fd210dd92de194659b5f33fb3 | Add debug util for WORKSPACE. | bazel/debug_repository.bzl | bazel/debug_repository.bzl | Python | 0.000433 | @@ -0,0 +1,830 @@
+%22%22%22Debug util for repository definitions.%22%22%22%0A%0Adef debug_repository(repo, *fields):%0A %22%22%22debug_repository(repo) identifies which version of a repository has been%0A defined in the WORKSPACE by printing some of its fields. Example:%0A%0A # at the bottom of the WORKSPACE ... | |
316bef330c0770739e95f9c1108e07697655d27e | fix when multi python version bug | cobra/__version__.py | cobra/__version__.py | import sys
import platform
__title__ = 'cobra'
__description__ = 'Code Security Audit'
__url__ = 'https://github.com/wufeifei/cobra'
__issue_page__ = 'https://github.com/wufeifei/cobra/issues/new'
__python_version__ = sys.version.split()[0]
__platform__ = platform.platform()
__version__ = '2.0.0-alpha'
__author__ = 'F... | Python | 0.000001 | @@ -787,16 +787,23 @@
sage:%0A
+python
%7Bm%7D -t %7B
@@ -808,16 +808,23 @@
%7Btd%7D%0A
+python
%7Bm%7D -t %7B
@@ -854,16 +854,23 @@
90002%0A
+python
%7Bm%7D -t %7B
@@ -900,24 +900,31 @@
ort.json %0A
+python
%7Bm%7D -t %7Btg%7D
@@ -950,16 +950,23 @@
i.cn %0A
+python
%7Bm%7D -t %7B
@@ -1011,16... |
1483b352683ecf126e1063c3a6fa2f07dcdb7720 | add new module.wq | cno/core/gtt.py | cno/core/gtt.py | Python | 0.000001 | @@ -0,0 +1,2397 @@
+import numpy as np%0Aimport pylab%0Aimport pandas as pd%0Afrom biokit.rtools import RSession%0Afrom cno.core import CNORBase%0Afrom easydev import TempFile%0A__all__ = %5B'GTTBool'%5D%0A%0A%0Aclass GTTBool(CNORBase):%0A %22%22%22%0A%0A%0A ::%0A%0A from cno import *%0A c = cnorboo... | |
e307bf72a8aa21088d491c90efd9a731014e63f1 | move states into separate file | stacks/states.py | stacks/states.py | Python | 0.000004 | @@ -0,0 +1,546 @@
+FAILED_STACK_STATES = %5B%0A 'CREATE_FAILED',%0A 'ROLLBACK_FAILED',%0A 'DELETE_FAILED',%0A 'UPDATE_ROLLBACK_FAILED'%0A%5D%0ACOMPLETE_STACK_STATES = %5B%0A 'CREATE_COMPLETE',%0A 'UPDATE_COMPLETE',%0A%5D%0AROLLBACK_STACK_STATES = %5B%0A 'ROLLBACK_COMPLETE',%0A 'UPDATE_ROLLBACK_C... | |
13dfb4f7d4972edbc7ccc0e4f62ea3db1a5b16f4 | Add ctx module | srw/ctx.py | srw/ctx.py | Python | 0.000001 | @@ -0,0 +1,72 @@
+def wd2jd(wd):%0A jd_ref = 2453005.5%0A return (wd / 86400.) + jd_ref%0A
| |
19acf7ad2a14b71f672d02cb8cb47a4393665bc7 | Add benchmarks | bin/serialize.py | bin/serialize.py | Python | 0.00001 | @@ -0,0 +1,809 @@
+%22%22%22Timing serializtion of deeply nested geometry collections.%0A%0ATo and from JSON using dumps and loads from Python's json module. I'm%0Ahappy to report that writing such GeoJSON geometry collections is more%0Aexpensive than parsing them and, at least for Python, deeply nested%0Ageometry coll... | |
7c9b97a81d4c8e41ce81cc881d30323dfb1f9c72 | Add layer normalization | chainer/links/normalization/layer_normalization.py | chainer/links/normalization/layer_normalization.py | Python | 0.000001 | @@ -0,0 +1,1462 @@
+from chainer import functions%0Afrom chainer import initializers%0Afrom chainer import link%0Afrom chainer import links%0A%0A%0Aclass LayerNormalization(link.Chain):%0A%0A %22%22%22Layer normalization layer on outputs of linear functions.%0A%0A This is a link of %22Layer Normalization%22. This... | |
b88b97c7d56506804fc9eb93ce7074454fc492f3 | Add the migration for designations. | base/apps/people/migrations/0002_auto_20141223_0316.py | base/apps/people/migrations/0002_auto_20141223_0316.py | Python | 0.000001 | @@ -0,0 +1,1077 @@
+# -*- 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 ('people', '0001_initial'),%0A %5D%0A%0A operations = %5B%0A migrations.CreateModel(%0A ... | |
3b23e35e58c9269a7fb9275aafadb276ba2b30d0 | Problem 12 Completed | project_euler_12.py | project_euler_12.py | Python | 0.999244 | @@ -0,0 +1,949 @@
+'''%0AShayne Hodge%0A2/15/2014%0A%0AProject Euler Problem 12%0A%0An -%3E n/2 (n is even)%0An -%3E 3n + 1 (n is odd)%0ALongest sequence under one million?%0A'''%0A%0A#currently a brute force implementation with no niceities%0A# including, apparently, spell check in the comments%0Aimport numpy as np%0A... | |
f3dbe9bb2aa627b3485c2ed44f889a1bc5463081 | Bump to version 3.1.3 | rest_framework/__init__.py | rest_framework/__init__.py | """
______ _____ _____ _____ __
| ___ \ ___/ ___|_ _| / _| | |
| |_/ / |__ \ `--. | | | |_ _ __ __ _ _ __ ___ _____ _____ _ __| |__
| /| __| `--. \ | | | _| '__/ _` | '_ ` _ \ / _ \ \ /\ / / _ \| '__| |/ /
| |\ \| |___/\__/ / | | | | | | | (_| | | | ... | Python | 0 | @@ -488,17 +488,17 @@
= '3.1.
-2
+3
'%0A__auth
|
57714fd6838f48920f7093a24ec4d85abf4278ee | Fix merge issue | src/naarad/naarad_imports.py | src/naarad/naarad_imports.py | # coding=utf-8
"""
© 2013 LinkedIn Corp. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | Python | 0.000001 | @@ -801,20 +801,8 @@
%7D%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD
%0Arep
@@ -848,15 +848,8 @@
t%0A%7D%0A
-=======
%0Aimp
@@ -954,28 +954,4 @@
%7D%0A
-%3E%3E%3E%3E%3E%3E%3E upstream/master%0A
|
6de41e5acfe55b6cb7698f81e3031079a530b1af | test for cli mode | tests/test_cli_mode.py | tests/test_cli_mode.py | Python | 0.000001 | @@ -0,0 +1,335 @@
+import unittest%0Afrom unittest.mock import Mock%0A%0Afrom rawdisk.ui.cli.cli_mode import CliMode, CliShell%0A%0A%0Aclass CliModeTest(unittest.TestCase):%0A def test_initialize_loads_fs_plugins(self):%0A session = Mock()%0A cli = CliShell(session=session)%0A cli.initialize()%0... | |
f007cacdba7bb3e46a6c4c730dde50dc495d9c64 | Add hypothesis test for metasync | tests/test_metasync.py | tests/test_metasync.py | # -*- coding: utf-8 -*-
import pytest
from vdirsyncer.metasync import MetaSyncConflict, metasync
from vdirsyncer.storage.memory import MemoryStorage
from . import blow_up
def test_irrelevant_status():
a = MemoryStorage()
b = MemoryStorage()
status = {'foo': 'bar'}
metasync(a, b, status, keys=())
... | Python | 0.000074 | @@ -18,16 +18,81 @@
-8 -*-%0A%0A
+from hypothesis import given%0Aimport hypothesis.strategies as st%0A%0A
import p
@@ -2162,8 +2162,974 @@
'%0A )%0A
+%0A%0Akeys = st.text(min_size=1).filter(lambda x: x.strip() == x)%0A%0Ametadata = st.dictionaries(%0A keys,%0A st.text()%0A)%0A%0A%0A@given(%0A a=metadata,... |
be0cb304047c7a410eac577b8aa2765747991100 | add script to summarise output | summary.py | summary.py | Python | 0.000002 | @@ -0,0 +1,584 @@
+%0Aimport string, sys, glob%0A%0Aidir = sys.argv%5B1%5D%0A%0Afl = glob.glob( '%25s/*.txt' %25 idir )%0A%0Aee = %7B%7D%0Afor f in fl:%0A for l in open(f).readlines():%0A if string.find(l, 'FAILED') != -1:%0A bits = string.split(l, ':' )%0A if len(bits) %3E 3:%0A code = bits%5B0%5D... | |
6d90ccd7d6f03630106f78ec7d75666429e26e45 | Add an example workloads module | configs/example/arm/workloads.py | configs/example/arm/workloads.py | Python | 0.000003 | @@ -0,0 +1,3540 @@
+# Copyright (c) 2020 ARM Limited%0A# All rights reserved.%0A#%0A# The license below extends only to copyright in the software and shall%0A# not be construed as granting a license to any other intellectual%0A# property including but not limited to intellectual property relating%0A# to a hardware impl... | |
d38148097b96ecf7681d0e6c5f7dbc0de5c4b16b | Create backpackI.py | LintCode/backpackI.py | LintCode/backpackI.py | Python | 0.000006 | @@ -0,0 +1,1879 @@
+'''%0AGiven n items with size Ai, an integer m denotes the size of a backpack. How full you can fill this backpack?%0A%0AHave you met this question in a real interview? Yes%0AExample%0AIf we have 4 items with size %5B2, 3, 5, 7%5D, the backpack size is 11, we can select %5B2, 3, 5%5D, so that the ma... | |
6a65640d1567d3cf2a9dac232e705e4697022987 | add migration for hidden col | migrations/versions/388d0cc48e7c_.py | migrations/versions/388d0cc48e7c_.py | Python | 0 | @@ -0,0 +1,601 @@
+%22%22%22empty message%0A%0ARevision ID: 388d0cc48e7c%0ARevises: 21a633e449ce%0ACreate Date: 2014-11-13 10:49:45.512414%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '388d0cc48e7c'%0Adown_revision = '21a633e449ce'%0A%0Afrom alembic import op%0Aimport sqlalchemy as sa%0A%0A... | |
9d0e85a10b1073000d22500938e3d8d65107f062 | Update migrations | migrations/versions/70e630638c64_.py | migrations/versions/70e630638c64_.py | Python | 0.000001 | @@ -0,0 +1,1611 @@
+%22%22%22empty message%0A%0ARevision ID: 70e630638c64%0ARevises: %0ACreate Date: 2017-05-23 13:19:47.177767%0A%0A%22%22%22%0Afrom alembic import op%0Aimport sqlalchemy as sa%0A%0A%0A# revision identifiers, used by Alembic.%0Arevision = '70e630638c64'%0Adown_revision = None%0Abranch_labels = None%0Ad... | |
c934c77392b98e7625bc5e03ea6c3c7960cdcd5d | Create syslog_parser.py | syslog_parser.py | syslog_parser.py | Python | 0.00062 | @@ -0,0 +1,1096 @@
+import re%0Aimport sys%0Aimport argparse%0A%0A__author__ = 'sif.baksh@gmail.com'%0A__version__ = %22$Revision: 1.6 $%22%0A'''%0ATODO%0A- nothing%0A%0AUSAGE%0Apython syslog_parser.py -i syslog.log -o customerxyz.txt%0A%0A'''%0A# This will allow us to pass command line arguments%0A# FOR HELP - python ... | |
375f63b76fccc89ce0ee9b4246e5fb9a2400d1eb | Add Austrian Versicherungsnummer | stdnum/at/vnr.py | stdnum/at/vnr.py | Python | 0.000025 | @@ -0,0 +1,2451 @@
+# vnr.py - functions for handling Austrian social security numbers%0A# coding: utf-8%0A#%0A# Copyright (C) 2018 Arthur de Jong%0A#%0A# This library is free software; you can redistribute it and/or%0A# modify it under the terms of the GNU Lesser General Public%0A# License as published by the Free Sof... | |
33d3f3f0805fb2e34144eec1870442427c2a12b5 | Add initial config management interface for the wheel module | salt/wheel/config.py | salt/wheel/config.py | Python | 0 | @@ -0,0 +1,610 @@
+'''%0AManage the master configuration file%0A'''%0A%0A# Import python libs%0Aimport os%0A%0A# Import third party libs%0Aimport yaml%0A%0A# Import salt libs%0Aimport salt.config%0A%0A%0Adef values():%0A '''%0A Return the raw values of the config file%0A '''%0A data = salt.config.master_con... | |
bf6bec04c520241eb6c572b70e2219e989806a2e | sumOfN2 time | sumOfN2.py | sumOfN2.py | Python | 0.999478 | @@ -0,0 +1,270 @@
+import time%0A%0Adef sumOfN2(n):%0A start = time.time()%0A%0A theSum = 0%0A%0A for i in range(1, n+1):%0A theSum = theSum + 1%0A %0A end = time.time()%0A %0A%0A return theSum, end-start%0A%0Afor i in range(5):%0A print(%22Sum is %25d required %2510.7f seconds%22%25sumOf... | |
9e835d341513d7477b05f19ec2b72499b170db40 | Add initial libguestfs module | salt/modules/libguestfs.py | salt/modules/libguestfs.py | Python | 0 | @@ -0,0 +1,516 @@
+'''%0AInteract with virtual machine images via libguestfs%0A%0A:depends: - libguestfs%0A'''%0A%0A# Import Salt libs%0Aimport salt.utils%0A%0Adef __virtual__():%0A '''%0A Only load if libguestfs python bindings are installed%0A '''%0A if salt.utils.which('guestmount'):%0A return '... | |
e2c46d78cc4efe2d8778b0580b37ac95299c4ee1 | Implement DefaultConfigMixin | utils/mixin.py | utils/mixin.py | Python | 0.000001 | @@ -0,0 +1,1276 @@
+from itertools import chain%0A%0Aclass DefaultConfigMixin():%0A%0A @property%0A def _default_config(self):%0A if (hasattr(self.bot_config, 'DEFAULT_CONFIG') and%0A self.name in self.bot_config.DEFAULT_CONFIG):%0A return self.bot_config.DEFAULT_CONFIG%5Bself.nam... | |
1c631f8a6426a50e2e86d77a9b2729e102c5ad32 | add DecomposeComponentsFilter | Lib/ufo2ft/filters/decomposeComponents.py | Lib/ufo2ft/filters/decomposeComponents.py | Python | 0 | @@ -0,0 +1,1372 @@
+from __future__ import (%0A print_function, division, absolute_import, unicode_literals)%0A%0Afrom fontTools.pens.reverseContourPen import ReverseContourPen%0Afrom fontTools.misc.transform import Transform, Identity%0Afrom fontTools.pens.transformPen import TransformPen%0Afrom ufo2ft.filters impo... | |
f4a53d623177c698bc45fa7404e90a944dd1962c | Fix URL in config_webrx.py | config_webrx.py | config_webrx.py | # -*- coding: utf-8 -*-
"""
config_webrx: configuration options for OpenWebRX
This file is part of OpenWebRX,
an open-source SDR receiver software with a web UI.
Copyright (c) 2013-2015 by Andras Retzler <randras@sdr.hu>
This program is free software: you can redistribute it and/or modify
it under the t... | Python | 0.00005 | @@ -4179,26 +4179,25 @@
i/Using-
-gr-osmosdr
+GrOsmoSDR
-as-sign
|
b7e024913d1d1bc87306f4a85b8737a8d5c35ec7 | add XML validation utility | sbin/validate_xml.py | sbin/validate_xml.py | Python | 0.000001 | @@ -0,0 +1,1779 @@
+#!/usr/bin/python%0A# -*- coding: ISO-8859-15 -*-%0A# =================================================================%0A#%0A# $Id$%0A#%0A# Authors: Angelos Tzotsos %3Ctzotsos@gmail.com%3E%0A#%0A# Copyright (c) 2011 Angelos Tzotsos%0A#%0A# Permission is hereby granted, free of charge, to any person... | |
cf3ca764c571a51952cd7c98c9752aedc701c3eb | Drop the status column | migrations/versions/0053_perform_drop_status_column.py | migrations/versions/0053_perform_drop_status_column.py | Python | 0.000003 | @@ -0,0 +1,620 @@
+%22%22%22empty message%0A%0ARevision ID: 0053_perform_drop_status_column%0ARevises: 0052_drop_jobs_status%0ACreate Date: 2016-08-25 15:56:31.779399%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '0053_perform_drop_status_column'%0Adown_revision = '0052_drop_jobs_status'%0A%... | |
653221002d97f4ab646b11c01016763550912036 | Update word-ladder.py | Python/word-ladder.py | Python/word-ladder.py | # Time: O(n * d), n is length of string, d is size of dictionary
# Space: O(d)
#
# Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:
#
# Only one letter can be changed at a time
# Each intermediate word must exist in the dictionary
# F... | Python | 0.000003 | @@ -696,233 +696,297 @@
tion
-:%0A # @param start, a string%0A # @param end, a string%0A # @param dict, a set of
+(object):%0A def ladderLength(self, beginWord, endWord, wordList):%0A %22%22%22%0A :type beginWord:
str
-ing
%0A
-# @return an integer%0A def ladderLength(self, start, e... |
8affa8de7338f08c2bb77e290fd7509440d6eee6 | Add test for issue #169 | numba/tests/issues/test_issue_169.py | numba/tests/issues/test_issue_169.py | Python | 0 | @@ -0,0 +1,316 @@
+# -*- coding: utf-8 -*-%0A%0A%22%22%22%0ATest binding of autojit methods.%0A%22%22%22%0A%0Afrom __future__ import print_function, division, absolute_import%0A%0Afrom numba import *%0A%0Aclass A(object):%0A @autojit%0A def a(self, arg):%0A return self * arg%0A%0A def __mul__(self, othe... | |
5617038f4ec48915411ec5ce4bf5ae2df98e9e0e | Add dodo dockerkill command | dodo_commands/extra/standard_commands/dockerkill.py | dodo_commands/extra/standard_commands/dockerkill.py | Python | 0.000002 | @@ -0,0 +1,1316 @@
+# noqa%0Afrom dodo_commands.system_commands import DodoCommand%0Afrom plumbum.cmd import docker%0Afrom six.moves import input as raw_input%0A%0A%0Aclass Command(DodoCommand): # noqa%0A help = %22%22%0A%0A def _containers(self):%0A result = %5B%5D%0A for line in docker(%22ps%22, ... | |
37ab6b858b6f115bef7a6500a8c81da161e4c659 | Add normal list params to list method for telemetry statistics | openstack/telemetry/v2/statistics.py | openstack/telemetry/v2/statistics.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Python | 0.000007 | @@ -1554,16 +1554,41 @@
session,
+ limit=None, marker=None,
path_ar
@@ -1595,16 +1595,29 @@
gs=None,
+%0A
paginat
|
c350a2ce7a65281c4a8e85c2569f4ae8c5791dc1 | Fix deb installl. | package_managers/apt_get/apt_get.bzl | package_managers/apt_get/apt_get.bzl | # Copyright 2017 Google Inc. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | Python | 0 | @@ -1817,15 +1817,60 @@
-i
-./*.deb
+ --force-depends ./*.deb%0Adpkg --configure -a command
%0Aapt
|
b10765b5f1ea84eed69c083341d9db9eda49cc38 | insert missing import | tabular_predDB/convergence_analysis/automated_convergence_tests.py | tabular_predDB/convergence_analysis/automated_convergence_tests.py | import os
import csv
import argparse
import tempfile
#
import numpy
import itertools
#
import tabular_predDB.python_utils.data_utils as du
import tabular_predDB.python_utils.file_utils as fu
import tabular_predDB.python_utils.xnet_utils as xu
import tabular_predDB.LocalEngine as LE
import tabular_predDB.HadoopEngine as... | Python | 0.000003 | @@ -132,16 +132,70 @@
s as du%0A
+import tabular_predDB.python_utils.hadoop_utils as hu%0A
import t
|
1b217b7990453b4b20c8d255b27825971a32092c | add testing python script for tring out | python/setup.py | python/setup.py | Python | 0 | @@ -0,0 +1,138 @@
+from sys import argv%0A%0A# main method as entry point %0Adef main(arg_inputs):%0A pass%0A%0Aif __name__ == %22__main__%22:%0A main(argv%5B1%5D)%0A pass%0A
| |
5dba05e3012b2004fd63f29200ba83b36529da41 | add caesar cipher python exercise | Text/caesar_cipher.py | Text/caesar_cipher.py | Python | 0.999965 | @@ -0,0 +1,1639 @@
+#Global constants for menu choices%0A%0ASHIFT_ONE = 1%0ASHIFT_TWO = 2%0Adef caesar(plaintext, shift):%0A alphabet=%5B%22a%22,%22b%22,%22c%22,%22d%22,%22e%22,%22f%22,%22g%22,%22h%22,%22i%22,%22j%22,%22k%22,%22l%22,%0A %22m%22,%22n%22,%22o%22,%22p%22,%22q%22,%22r%22,%22s%22,%22t%22,%22u%22,%22v%... | |
440fd9e5825e3ce37907b46248210bab6c564ea6 | Improve error checking | pylxd/connection.py | pylxd/connection.py | # Copyright (c) 2015 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python | 0.000001 | @@ -3513,32 +3513,86 @@
Exception(msg)%0A
+ elif state == 404:%0A status = False%0A
elif dat
|
f901632651fa0d177a3ba7fc99504aa874eb48b8 | add watcher | watcher.py | watcher.py | Python | 0.000001 | @@ -0,0 +1,410 @@
+class Watcher:%0A def __init__(self, topic, client):%0A self.value = None%0A self.topic = topic%0A self.client = client%0A%0A def set_value(self, new_value):%0A if self.value != new_value:%0A self.value = new_value%0A self.change()%0A%0A def ... | |
679e969e1cab73139406bdeb5a2f6d03757a89af | Allow Authentication header in CORS | sentry/utils/http.py | sentry/utils/http.py | """
sentry.utils.http
~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import urllib
from urlparse import urlparse
from sentry.conf import settings
from sentry.plugins.helpers import get_option
def safe_urlencode(params, d... | Python | 0.000001 | @@ -1908,16 +1908,32 @@
try-Auth
+, Authentication
'%0A
|
553825a2bd5db860d2842a8f72b0142e36d61ba0 | build the very basic web server->app.py | www/app.py | www/app.py | Python | 0.000001 | @@ -0,0 +1,586 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0A__author__ = 'mookaka'%0A%0Aimport logging%0Aimport asyncio%0Afrom aiohttp import web%0A%0A%0Alogging.basicConfig(level=logging.INFO)%0A%0Adef index(request):%0A return web.Response(body=b'%3Ch1%3EAwesome!%3C/h1%3E')%0A%0Aasync def init(loop):%... | |
e9e845b33891f50834e9b8bfb1796e43e9faac81 | Create complete_the_pattern_#9.py | complete_the_pattern_#9.py | complete_the_pattern_#9.py | Python | 0.998654 | @@ -0,0 +1,513 @@
+#Kunal Gautam%0A#Codewars : @Kunalpod%0A#Problem name: Complete The Pattern #9 - Diamond%0A#Problem level: 6 kyu%0A%0Adef pattern(n):%0A top = '%5Cn'.join(' '*(n-i) + ''.join(str(j%2510) for j in range(1, i+1)) + ''.join(str(j%2510) for j in list(range(1,i))%5B::-1%5D) + ' '*(n-i) for i in range(1... | |
37061643f4e416c8926411229a2e4d2737cef2e5 | Create sportability2shutterfly.py | sportability2shutterfly.py | sportability2shutterfly.py | Python | 0.000619 | @@ -0,0 +1,1265 @@
+#!/usr/bin/python%0A#%0A# convert sportability.com player info to shutterfly.com format.%0A#%0Aimport sys%0Aimport csv%0Adef pullContact(list,row,num):%0A if row%5B%22Parent%22+num+%22_FirstName%22%5D != %22%22 and row%5B%22Parent1_LastName%22%5D != %22%22:%0A key=row%5B%22Parent%22+num+... | |
2bc33138e7e110486f98145548b05da65577491c | Fix test set up | src/tests/ggrc/__init__.py | src/tests/ggrc/__init__.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: david@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
import os
import logging
from flask.ext.testing import TestCase as BaseTestCase... | Python | 0 | @@ -968,16 +968,39 @@
options%22
+,%0A %22categories%22,
%0A )%0A
|
b08cbbf353da0e84f0f1a160de5e79d5d05c0ea6 | add gensim utils | nlpia/gensim_utils.py | nlpia/gensim_utils.py | Python | 0 | @@ -0,0 +1,3083 @@
+from __future__ import print_function, unicode_literals, division, absolute_import%0Afrom future import standard_library%0Astandard_library.install_aliases() # noqa%0Afrom builtins import object # noqa%0A%0A# from gensim.models import Word2Vec%0Afrom gensim import corpora%0Afrom gensim import utils... | |
1e9498ab2a947e10e59ebcc8fa9759c35405e870 | Enable --verbose and unify log format | vint/__init__.py | vint/__init__.py | import sys
from argparse import ArgumentParser
import pkg_resources
from vint.linting.linter import Linter
from vint.linting.env import build_environment
from vint.linting.config.config_container import ConfigContainer
from vint.linting.config.config_cmdargs_source import ConfigCmdargsSource
from vint.linting.config.c... | Python | 0.000001 | @@ -60,16 +60,31 @@
esources
+%0Aimport logging
%0A%0Afrom v
@@ -758,24 +758,72 @@
cFormatter%0A%0A
+LOG_FORMAT = 'vint %25(levelname)s: %25(message)s'%0A%0A
%0Adef main():
@@ -929,16 +929,47 @@
rser()%0A%0A
+ _init_logger(config_dict)%0A%0A
path
@@ -1039,35 +1039,31 @@
-print('vint
+logging.
e... |
da8bb1fd01a34686474f66cdaf3f7376b1c6c901 | Set extra forms for the RecordInline to 3. | src/powerdns_manager/admin.py | src/powerdns_manager/admin.py | # -*- coding: utf-8 -*-
#
# This file is part of django-powerdns-manager.
#
# django-powerdns-manager is a web based PowerDNS administration panel.
#
# Development Web Site:
# - http://www.codetrax.org/projects/django-powerdns-manager
# Public Source Code Repository:
# - https://source.codetrax.org/hgroot/dja... | Python | 0 | @@ -2231,17 +2231,17 @@
extra =
-1
+3
%0A%0Aclass
|
01c0518d88d3b1a6919f9841752eb676bed8f68a | Create test.py | scripts/test.py | scripts/test.py | Python | 0.000005 | @@ -0,0 +1,20 @@
+print %22hello world%22%0A
| |
ffa1a6711a616582c38ffeeef47df9f6ff272fe2 | Create DAGUtilities.py | DAGUtilities.py | DAGUtilities.py | Python | 0 | @@ -0,0 +1,599 @@
+'''%0ACreated on Apr 6, 2016%0A%0A@author: Noah Higa%0A'''%0Aimport sys%0Afrom Job import Job%0A%0Adef newJob(identity):%0A aNewJob = Job(identity, 1, 1, 1, 1, 1, 1, 1, 1)%0A return aNewJob%0A%0Adef printEdges(G):%0A edges = G.edges()%0A for edge in edges:%0A sys.stdout.write('(')%... | |
569be57e96a97885c4f7d92a3ce524aa47413897 | Create for_loops.py | _ptopics/for_loops.py | _ptopics/for_loops.py | Python | 0.000012 | @@ -0,0 +1,518 @@
+---%0Atopic: %22for loops%22%0Adesc: %22for loops in Python, from basic to advanced%22%0A---%0A%0A# Basic for loop over a list%0A%0A%60%60%60python%0Aschools = %5B%22UCSB%22,%22UCLA%22,%22UCI%22,%22Cal Poly%22%5D%0Afor s in schools:%0A print(s,len(s))%0A%60%60%60%0A%0AOutput:%0A%60%60%60%0AUCSB 4%0... | |
58b5ff7daf0c240ddbb4b83d11b361dcf574ae74 | Add mkaudiocd.py for making Audio CD for dosbox | mkaudiocd.py | mkaudiocd.py | Python | 0 | @@ -0,0 +1,1174 @@
+#!/usr/bin/env python3%0Aimport sys, subprocess, os, multiprocessing, magic, tempfile;%0Afiles = sys.argv%5B1:%5D;%0Atempfiles = %5B%5D;%0A%0Amime = magic.open(magic.MIME);%0Amime.load();%0Afor i in range(len(files)):%0A mime_type = mime.file(files%5Bi%5D).split(';')%5B0%5D;%0A if (mime_type i... | |
0cabf3c4dae3599e2d1627ff41707cf36b4d2ddd | Load all modules by default | acoustics/__init__.py | acoustics/__init__.py | """
Acoustics
=========
The acoustics module...
"""
import acoustics.ambisonics
import acoustics.utils
import acoustics.octave
import acoustics.doppler
import acoustics.signal
import acoustics.directivity
import acoustics.building
import acoustics.room
import acoustics.standards
import acoustics.cepstrum
from acoust... | Python | 0 | @@ -47,16 +47,37 @@
..%0A%0A%22%22%22%0A
+import acoustics.aio%0A
import a
@@ -117,37 +117,203 @@
ics.
-utils%0Aimport acoustics.octave
+atmosphere%0Aimport acoustics.bands%0Aimport acoustics.building%0Aimport acoustics.cepstrum%0Aimport acoustics.criterion%0Aimport acoustics.decibel%0Aimport acoustics.descriptors%0... |
68a37792fd7c5a197758aff738a69c7ce08b4a8b | Add manhole module | txircd/modules/manhole.py | txircd/modules/manhole.py | Python | 0.000001 | @@ -0,0 +1,435 @@
+from twisted.conch.manhole_tap import makeService%0A%0Aclass Spawner(object):%0A def __init__(self, ircd):%0A self.manhole = makeService(%7B%0A 'namespace': %7B'ircd': ircd%7D,%0A 'passwd': 'manhole.passwd',%0A 'telnetPort': None,%0A 'sshPort': '6... | |
513af3716c596bb67c0f6552824b854b3735858c | Add simple tests for password strength and sensitivity to MINIMUM_ZXCVBN_SCORE setting | corehq/apps/domain/tests/test_password_strength.py | corehq/apps/domain/tests/test_password_strength.py | Python | 0 | @@ -0,0 +1,1160 @@
+from django import forms%0Afrom django.test import SimpleTestCase, override_settings%0A%0Afrom corehq.apps.domain.forms import clean_password%0A%0A%0Aclass PasswordStrengthTest(SimpleTestCase):%0A%0A @override_settings(MINIMUM_ZXCVBN_SCORE=2)%0A def test_score_0_password(self):%0A self.... | |
e4a5761d997bee3eefad80c6b92c4c4a0c3568fd | Create day_14_part_1.py | day_14_part_1.py | day_14_part_1.py | Python | 0.000198 | @@ -0,0 +1,653 @@
+import hashlib, re%0Asalt = %22yjdafjpo%22%0Akeys = %5B%5D%0Ai = 0%0A%0Awhile len(keys) %3C 64:%0A first_key = hashlib.md5((salt + str(i)).encode(%22utf-8%22)).hexdigest()%0A # for every 3-gram in key%0A m1 = re.search(r'(.)%5C1%7B2,2%7D', first_key)%0A if m1:%0A for j in range(i +... | |
a2ffd8ea0b2b1b7ace6ed5b37dd76d9dd9063d25 | Add utility function. | yaka/web/util.py | yaka/web/util.py | Python | 0 | @@ -0,0 +1,84 @@
+%0Adef get_object_or_404(cls, *args):%0A return cls.query.filter(*args).first_or_404()%0A
| |
cdc311adcd05e5292f61bf5718ba68dceb4121c3 | install requirements | tornado/setup.py | tornado/setup.py | import subprocess
import sys
import setup_util
import os
from os.path import expanduser
home = expanduser("~")
cwd = "%s/FrameworkBenchmarks/tornado" % home
def start(args):
setup_util.replace_text(
cwd + "/server.py", "127.0.0.1", args.database_host)
subprocess.Popen("python %s/FrameworkBenchmarks/... | Python | 0 | @@ -261,16 +261,81 @@
_host)%0A%0A
+ subprocess.check_call(%22pip install -r %25s/requirements.txt%22)%0A%0A
subp
|
fd6fe20c74463d88b957d22d0f9f2f0316a489cf | add energy_future_csv | amaascore/csv_upload/assets/energy_future.py | amaascore/csv_upload/assets/energy_future.py | Python | 0.999796 | @@ -0,0 +1,2003 @@
+import logging.config%0Aimport csv%0A%0Afrom amaascore.tools.csv_tools import csv_stream_to_objects%0Afrom amaascore.assets.energy_future import EnergyFuture%0Afrom amaascore.assets.interface import AssetsInterface%0Afrom amaasutils.logging_utils import DEFAULT_LOGGING%0A%0Aclass EnergyFutureUploade... | |
a68b6c46b7bfe16ecf83cc21398d1746275b03e2 | add a convert tool | convert_olddb.py | convert_olddb.py | Python | 0.000001 | @@ -0,0 +1,577 @@
+import sqlalchemy%0Aimport os%0Afrom photomanager.db.dbutils import get_db_session%0Afrom photomanager.db.models import ImageMeta%0A%0A%0Adef do_convert(db_name):%0A db_session = get_db_session(db_name)%0A%0A image_metas = db_session.query(ImageMeta)%0A for meta in image_metas:%0A filename = ... | |
8f897ea096ca4f7e0ee1a920569d18c8bb4a184d | Create SECURITYHUB_ENABLED.py | python-rdklib/SECURITYHUB_ENABLED/SECURITYHUB_ENABLED.py | python-rdklib/SECURITYHUB_ENABLED/SECURITYHUB_ENABLED.py | Python | 0.000002 | @@ -0,0 +1,2079 @@
+%22%22%22%0A#####################################%0A## Gherkin ##%0A#####################################%0A%0ARule Name:%0A SECURITYHUB_ENABLED%0A%0ADescription:%0A Checks that AWS Security Hub is enabled for an AWS Account. The rule is NON_COMPLIANT if AWS Security Hub is... | |
446f5785a5db301de68adffe9e114b3ebafe0b6f | add tests for removing failed jobs | frappe/tests/test_background_jobs.py | frappe/tests/test_background_jobs.py | Python | 0.000009 | @@ -0,0 +1,756 @@
+import unittest%0A%0Afrom rq import Queue%0A%0Aimport frappe%0Afrom frappe.core.page.background_jobs.background_jobs import remove_failed_jobs%0Afrom frappe.utils.background_jobs import get_redis_conn%0A%0A%0Aclass TestBackgroundJobs(unittest.TestCase):%0A%09def test_remove_failed_jobs(self):%0A%09%0... | |
5ba8c63daee6c0cb8667c916e10fd813d2cc8d88 | Add in the cmd module, this is simple and can be expanded, although the basic bases are covered | salt/modules/cmd.py | salt/modules/cmd.py | Python | 0 | @@ -0,0 +1,1321 @@
+'''%0AA module for shelling out%0A%0AKeep in mind that this module is insecure, in that it can give whomever has%0Aaccess to the master root execution access to all salt minions%0A'''%0A%0Aimport subprocess%0Aimport tempfile%0A%0Adef run(cmd):%0A '''%0A Execute the passed command and return th... | |
e3efa4483f43deb9d2e8515ef3a797c03626f892 | add serializtion tests for pandas (#844) | distributed/protocol/tests/test_pandas.py | distributed/protocol/tests/test_pandas.py | Python | 0 | @@ -0,0 +1,1830 @@
+from __future__ import print_function, division, absolute_import%0A%0Afrom zlib import crc32%0A%0Aimport pandas as pd%0Aimport pandas.util.testing as tm%0Aimport pytest%0A%0Afrom dask.dataframe.utils import assert_eq%0A%0Afrom distributed.protocol import (serialize, deserialize, decompress, dumps,%0... | |
9d94f581b803e5050f0bf76436cb97d92184b4fb | add tests for country model | openspending/tests/model/test_country.py | openspending/tests/model/test_country.py | Python | 0 | @@ -0,0 +1,919 @@
+import json%0Aimport urllib2%0A%0Afrom flask import url_for, current_app%0A%0Afrom openspending.core import db%0Afrom openspending.model.country import Country%0Afrom openspending.tests.base import ControllerTestCase%0A%0Afrom openspending.command.geometry import create as createcountries%0A%0A%0A%0A... | |
97d6cce2a5c0c905f0c33c41316c8e65eaed0e08 | Update way we synchronize from citybik.es | update-bikestations.py | update-bikestations.py | Python | 0 | @@ -0,0 +1,1634 @@
+#!/usr/bin/env python%0A%0Afrom multiprocessing.pool import ThreadPool%0Aimport requests%0Aimport json%0A%0Abaseurl = 'http://api.citybik.es/v2/networks/'%0Anetworkids = %5B 'bixi-montreal', 'bixi-toronto', 'capital-bixi', 'hubway',%0A 'capital-bikeshare', 'citi-bike-nyc', 'barclays-cy... | |
064c2b53089611e838934c76d8fba19eaad85e75 | add cot verify test stub | scriptworker/test/test_cot_verify.py | scriptworker/test/test_cot_verify.py | Python | 0 | @@ -0,0 +1,473 @@
+#!/usr/bin/env python%0A# coding=utf-8%0A%22%22%22Test scriptworker.cot.verify%0A%22%22%22%0Aimport logging%0Aimport pytest%0Afrom scriptworker.exceptions import CoTError%0Aimport scriptworker.cot.verify as verify%0Afrom . import rw_context%0A%0Aassert rw_context # silence pyflakes%0A%0A# TODO remov... | |
9376ab25e4b5713b8b354a3a03c37b1e356fa5c2 | Create unlock-device.py | unlock-device.py | unlock-device.py | Python | 0.000001 | @@ -0,0 +1,323 @@
+from com.dtmilano.android.viewclient import ViewClient%0A%0Adevice, serial = ViewClient.connectToDeviceOrExit()%0Aif device.checkConnected():%0A print(%22Device connected - serial: %7B%7D%22.format(serial))%0A print(%22Device is going to be unlocked...%22)%0A device.wake()%0A device.unloc... | |
47b93bee1ebcf5fcf6ea2ff3ad7eaabb831f692c | Add WATERS_Utils folder | ET_Utils/WATERS_Utils/__init__.py | ET_Utils/WATERS_Utils/__init__.py | Python | 0 | @@ -0,0 +1 @@
+%0A
| |
d9af619ee1f614d5e1a5cda5d37f5757d91567c9 | resource_impala uses resource_sql | blaze/sql.py | blaze/sql.py | from __future__ import absolute_import, division, print_function
from datashape.predicates import isscalar
import sqlalchemy
from sqlalchemy import Table, MetaData
from sqlalchemy.engine import Engine
from toolz import first, keyfilter
from .compute.sql import select
from .data.sql import SQL, dispatch
from .expr imp... | Python | 0.999998 | @@ -3522,27 +3522,18 @@
rce_
-sql(uri, table_name
+impala(uri
, *a
@@ -3696,35 +3696,32 @@
return
-SQL(uri, table_name
+resource_sql(uri
, *args,
|
60f76f01c6961f6aceb3b67643057798aed056c7 | Add python script for validating version files on vaadin.com | scripts/ValidateVaadinDownload.py | scripts/ValidateVaadinDownload.py | Python | 0.000001 | @@ -0,0 +1,2377 @@
+#coding=UTF-8%0A%0Aimport argparse, sys%0Afrom urllib.request import urlopen%0A%0Aparse = argparse.ArgumentParser(description=%22Check vaadin.com version lists%22)%0Aparse.add_argument(%22version%22, help=%22Released Vaadin version number%22)%0A%0Aargs = parse.parse_args()%0Aif hasattr(args, %22echo... | |
665b3372e089fda3dde104b0754efa65a87a9bd2 | Test harness for checking wtf the HTTPClientResponseHandler is actually doing with data from the network | Sketches/MPS/Bookmarks/TestHTTPResponseHandler.py | Sketches/MPS/Bookmarks/TestHTTPResponseHandler.py | Python | 0 | @@ -0,0 +1,560 @@
+#!/usr/bin/python%0A%0Aimport base64%0Afrom Kamaelia.File.ReadFileAdaptor import ReadFileAdaptor %0Afrom Kamaelia.File.Writing import SimpleFileWriter%0Afrom Kamaelia.Chassis.Pipeline import Pipeline%0Afrom TwitterStream import HTTPClientResponseHandler%0Afrom Kamaelia.Util.PureTransformer import Pur... | |
53467bd7d4c9c12b73c66244a91f31f0dbadeeec | Add pagerteam tests file which had been missed despite its existence | hc/front/tests/test_add_pagerteam.py | hc/front/tests/test_add_pagerteam.py | Python | 0 | @@ -0,0 +1,1041 @@
+from hc.api.models import Channel%0Afrom hc.test import BaseTestCase%0A%0A%0Aclass AddPagerTeamTestCase(BaseTestCase):%0A url = %22/integrations/add_pagerteam/%22%0A%0A def test_instructions_work(self):%0A self.client.login(username=%22alice@example.org%22, password=%22password%22)%0A ... | |
9f9916d662d1ab130c9685c415c25b19a14733d7 | Add example to illustrate different optimization procedures | examples/svm_objectives.py | examples/svm_objectives.py | Python | 0 | @@ -0,0 +1,1821 @@
+# showing the relation between cutting plane and primal objectives%0A%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0A%0Afrom sklearn.datasets import load_digits%0Afrom sklearn.cross_validation import train_test_split%0A%0Afrom pystruct.problems import CrammerSingerSVMProblem%0Afrom pystruc... | |
3a2e9a19feab0c882a9821b7ff555bd1e2693190 | Test effect of change in Laplacian. | exp/sandbox/DeltaLaplacianExp.py | exp/sandbox/DeltaLaplacianExp.py | Python | 0 | @@ -0,0 +1,630 @@
+import numpy %0Aimport scipy.sparse %0Afrom apgl.graph import GraphUtils %0Afrom apgl.util.Util import Util %0A%0Anumpy.set_printoptions(suppress=True, precision=3)%0An = 10%0AW1 = scipy.sparse.rand(n, n, 0.5).todense()%0AW1 = W1.T.dot(W1)%0AW2 = W1.copy()%0A%0AW2%5B1, 2%5D = 1 %0AW2%5B2, 1%5D = 1 %... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.