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 |
|---|---|---|---|---|---|---|---|
d34b2a13b454ca2c08bd5e8bc3b38d80fb5367c6 | add initial mockup of curses UI | pyfs/ui.py | pyfs/ui.py | Python | 0.000001 | @@ -0,0 +1,2006 @@
+import curses%0Aimport os%0Aimport sys%0A%0Aimport pyfs%0A%0Aclass SimplePager(object):%0A def __init__(self):%0A self._old_stdout = sys.__stdout__%0A self._old_stdout_fd = os.dup(sys.stdout.fileno())%0A os.dup2(sys.stderr.fileno(), sys.stdout.fileno())%0A%0A tty = ope... | |
01b9d4a491e2d732e9684d0782dcbf38df5eeec9 | Add adapters.py to new channelworm directory | channelworm/adapters.py | channelworm/adapters.py | Python | 0 | @@ -0,0 +1,1634 @@
+# configure django to use default settings%0A# note that this can also be done using an environment variable%0Afrom django.conf import settings%0Afrom django.core.exceptions import ImproperlyConfigured%0A%0Aif hasattr(settings, 'DEBUG'):%0A # settings are configured already%0A pass%0Aelse:%0A ... | |
f4689709f55a5e3209de7221853cb35a36699dcd | add file | check_sphinx.py | check_sphinx.py | Python | 0.000001 | @@ -0,0 +1,500 @@
+import py%0Aimport subprocess%0A%0Adef test_linkcheck(tmpdir):%0A doctrees = tmpdir.join(%22_build/doctrees%22)%0A htmldir = tmpdir.join(%22_build/html%22)%0A subprocess.check_call(%5B%22sphinx-build%22, %22-W%22, %22-blinkcheck%22, %22-d%22,%0A str(doctrees), %22source%22, str(htmldi... | |
9207041afb78f8d36442b7ee19b95055ebbc99cd | add test forms | app/tests/test_form.py | app/tests/test_form.py | Python | 0 | @@ -0,0 +1,982 @@
+from django.test import TestCase%0Afrom app.forms import FormAppOne%0A%0A%0Aclass TestForm(TestCase):%0A%0A def test_invalid_name_form(self):%0A form = FormAppOne(%7B'name': '1234', 'description': 'validate name'%7D)%0A self.assertFalse(form.is_valid())%0A self.assertEquals(fo... | |
a460b73861d406b14519b3e391190d1b8d7e57a9 | Add maximal margin classifier. | max_margin_classifier.py | max_margin_classifier.py | Python | 0.000007 | @@ -0,0 +1,1124 @@
+import numpy as np%0Aimport matplotlib.pylab as plt%0Afrom sklearn.svm import SVC%0A%0AX = np.array(%5B%5B3, 4%5D, %5B2, 2%5D, %5B4, 4%5D, %5B1, 4%5D, %5B2, 1%5D, %5B4, 3%5D, %5B4, 1%5D%5D)%0Ay = np.array(%5B'Red', 'Red', 'Red', 'Red', 'Blue', 'Blue', 'Blue'%5D)%0A%0Alinear_svm = SVC(kernel = 'linea... | |
2e821ab48542c89ac41ebc17036bddc164506a22 | Backup of some unused code | combine_data/cartesianProductOfIDs.py | combine_data/cartesianProductOfIDs.py | Python | 0.000001 | @@ -0,0 +1,806 @@
+import argparse%0Aimport itertools%0A%0Aif __name__ == '__main__':%0A%09parser = argparse.ArgumentParser(description='Generate the cartesian product of two ID files')%0A%09parser.add_argument('--idFileA',required=True,type=str,help='First file of IDs')%0A%09parser.add_argument('--idFileB',required=Tr... | |
d3210b3d25a2eef7c4d066878d444b9b381243eb | add roulette | modules/ruletti.py | modules/ruletti.py | Python | 0.000387 | @@ -0,0 +1,833 @@
+# -*- coding: ISO-8859-15 -*-%0A%0Afrom twisted.internet import reactor%0Afrom core.Uusipuu import UusipuuModule%0Aimport random%0A%0Aclass Module(UusipuuModule):%0A %0A def startup(self):%0A self.scheduled%5B'unban'%5D = %5B%5D%0A%0A def cmd_ruletti(self, user, target, params):%0A ... | |
432cbfc65ea1e6c1b9079915cce20769b88502fe | add wrapper script to run dbify module | scripts/run_dbify.py | scripts/run_dbify.py | Python | 0 | @@ -0,0 +1,1264 @@
+import logging%0Aimport os%0Aimport sys%0A%0Aimport argparse%0A%0Aimport _mypath%0Afrom bripipetools import genlims%0Afrom bripipetools import dbify%0A%0Adef parse_input_args(parser=None):%0A parser.add_argument('-p', '--import_path',%0A required=True,%0A ... | |
d5b3bce22aec3e84b59fad379859aa636f2d3f1a | Create ColorConvolution.py | ColorConvolution.py | ColorConvolution.py | Python | 0 | @@ -0,0 +1,1333 @@
+import numpy%0A%0Adef ColorConvolution ( I, W ):%0A '''%0A Reconstructs a color image from the stain matrix %22W%22 and the stain intensity %0A images generated by ColorDeconvolution.%0A *Inputs:%0A I (rgbimage) - an RGB image of type unsigned char.%0A W (matrix) - a 3x3 ma... | |
8f718c536897711663051a613e7f50d564fb4cbc | Call repair as part of upgrade | src/sentry/management/commands/upgrade.py | src/sentry/management/commands/upgrade.py | """
sentry.management.commands.upgrade
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from django.core.management import call_command
from django.core.mana... | Python | 0 | @@ -987,12 +987,205 @@
,%0A )%0A
+%0A call_command(%0A 'repair',%0A interactive=(not options%5B'noinput'%5D),%0A traceback=options%5B'traceback'%5D,%0A verbosity=options%5B'verbosity'%5D,%0A )%0A
|
6569d7e36693512fdaadfb22a5aaf6f11fe0e084 | migrate dataregistry repeater | corehq/motech/repeaters/management/commands/migrate_dataregistrycaseupdaterepeater.py | corehq/motech/repeaters/management/commands/migrate_dataregistrycaseupdaterepeater.py | Python | 0 | @@ -0,0 +1,411 @@
+from corehq.motech.repeaters.management.commands.migrate_caserepeater import Command as MigrateCaseRepeaters%0Afrom corehq.motech.repeaters.models import SQLDataRegistryCaseUpdateRepeater%0A%0A%0Aclass Command(MigrateCaseRepeaters):%0A%0A @classmethod%0A def couch_doc_type(cls):%0A retur... | |
5aa5ac33d2b841fa1d9c707681a9d024168672c4 | Create cdbtabledef.py | cdbtabledef.py | cdbtabledef.py | Python | 0 | @@ -0,0 +1,2252 @@
+%22%22%22cdbtabledef.py%0A%0ADeveloper: Noelle Todd%0ALast Updated: June 5, 2014%0A%0AThis module will create 4 tables for the client database, using the%0Asqlalchemy module, and the sqlite database. This module is still in%0Aearly testing stages, and as such, is subject to many changes, and %0Aprob... | |
1172811d073e544d249aeba64f2b6828ee75bd5d | test geometry | tests/test_geometry.py | tests/test_geometry.py | Python | 0.000002 | @@ -0,0 +1,759 @@
+import numpy as np%0Afrom numpy.testing import assert_allclose%0A%0Afrom geonet.geometry import unit_vector, angle_between%0A%0Adef test_unit_vector():%0A v1 = np.array(%5B1, 0, 0%5D)%0A assert_allclose(unit_vector(v1), v1)%0A%0A v2 = np.array(%5B1, 1, 0%5D)%0A u2 = unit_vector(v2)%0A ... | |
f5aab57e443e5b5a7c2507f10c0c6f608d677500 | Add simple unparser test | tests/test_unparser.py | tests/test_unparser.py | Python | 0.00003 | @@ -0,0 +1,434 @@
+# -*- coding: utf-8 -*-%0A%0Afrom pyrql.parser import parser%0Afrom pyrql.unparser import unparser%0A%0Aimport pytest%0A%0A%0A@pytest.mark.parametrize('func', %5B'eq', 'lt', 'le', 'gt', 'ge', 'ne'%5D)%0Adef test_cmp_functions(func):%0A parsed = %7B'name': func, 'args': %5B'a', 1%5D%7D%0A assert... | |
5fb7d1912eda9d6381af3e0cfa7655ed2d6795f2 | Create Xclipboard.py | Xclipboard.py | Xclipboard.py | Python | 0.000002 | @@ -0,0 +1,894 @@
+from tkinter import Tk%0A__all__=%5B'copy','paste','clear'%5D%0A%0A__author__='Calvin(Martin)Adyezik adyezik@gmail.com'%0A%0A__doc__=%22%22%22simple Module to work with clipboard based on tkinter -Python 3%22%22%22%0A%0A__name__='Xclipboard'%0A%0A%0Adef copy(text):%0A %22%22%22copy text to clipbo... | |
bbf73c8db9a2af114beb29766d0ca2e16818175b | fix 192: failure in test_disk on linux | test/_linux.py | test/_linux.py | #!/usr/bin/env python
#
# $Id$
#
import unittest
import subprocess
import sys
from test_psutil import sh
import psutil
class LinuxSpecificTestCase(unittest.TestCase):
def test_cached_phymem(self):
# test psutil.cached_phymem against "cached" column of free
# command line utility
p = sub... | Python | 0.000006 | @@ -1328,16 +1328,19 @@
sh('df
+-P
-B 1 %22%25s
|
e095eeb084b11bba857daf51b9d0eb0ef22ab5cc | Update bank_reconciliation_statement.py | erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py | erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.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.utils import flt
from frappe import _
def execute(filters=None):
if not filters: filters = {}
columns = get_columns()
if... | Python | 0.000002 | @@ -1441,22 +1441,52 @@
(_(%22
-System Balance
+Bank Statement balance as per General Ledger
%22),
@@ -1561,54 +1561,54 @@
y%22:
-'%22' + _(%22Amounts not reflected in bank%22) + '%22'
+_(%22Outstanding Cheques and Deposits to clear%22)
,%0A%09%09
@@ -1727,39 +1727,48 @@
(_(%22
-Amounts not reflected in system
+... |
501454e30a93b6ec706add520a6b106940b537d9 | Create card_pick.py | FiveThirtyEightRiddler/2017-04-21/card_pick.py | FiveThirtyEightRiddler/2017-04-21/card_pick.py | Python | 0.000001 | @@ -0,0 +1,2393 @@
+import random%0Afrom collections import Counter%0Aimport matplotlib.pyplot as plt%0Afrom multiprocessing import Pool%0Aimport numpy as np%0Aimport itertools%0Afrom mpl_toolkits.mplot3d import Axes3D%0Afrom matplotlib import cm%0A%0A%0Adef simulate_single_run(num_cards, hand_perc, stop_percentage):%0... | |
4d44d58c91e6a4fdf9ab16acac6320dd5d1f6bb9 | Add senlin-manage service list/clean for engine status | senlin/cmd/manage.py | senlin/cmd/manage.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 unde... | Python | 0.000001 | @@ -664,16 +664,82 @@
logging%0A
+from oslo_utils import timeutils%0A%0Afrom senlin.common.i18n import _
%0Afrom se
@@ -1102,24 +1102,2367 @@
.version)%0A%0A%0A
+class ServiceManageCommand(object):%0A def _format_service(self, service):%0A if service is None:%0A return%0A%0A status = 'dow... |
ab31fea8a0d30bc4b68813ce635880d4682cfc2f | Write base classes for collection profiles. | cohydra/profile.py | cohydra/profile.py | Python | 0 | @@ -0,0 +1,1897 @@
+import abc%0Aimport logging%0A%0Aimport six%0A%0A%0Aclass Profile(six.with_metaclass(abc.ABCMeta)):%0A %22%22%22Base class for all collection profiles.%0A%0A Attributes:%0A top_dir: Where this profile's files will be stored.%0A parent: The profile from which this profile is derived, or%0A ... | |
8fec4b6eef7f1f4ef5840504f6abcdf0d2f9f80d | Adding the concept of a target platform. | tools/cr/cr/base/platform.py | tools/cr/cr/base/platform.py | Python | 0.999998 | @@ -0,0 +1,1810 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0A%22%22%22Module for the target platform support.%22%22%22%0A%0Afrom importlib import import_module%0Aimport os%0A%0Aimport cr%0A%... | |
8cac10350cdbc33d243a561ba06c25f5d01e9a04 | fix for lists | Scripts/SearchIncidents_5.0/SearchIncidents.py | Scripts/SearchIncidents_5.0/SearchIncidents.py | from typing import Dict, List
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
special = ['n', 't', '\\', '"', '\'', '7', 'r']
def check_if_found_incident(res: List):
if res and isinstance(res, list) and isinstance(res[0].get('Contents'), dict):
if 'dat... | Python | 0.000001 | @@ -647,70 +647,248 @@
-error_msg: List%5Bstr%5D = %5B%5D%0A for _key, value in args.items():
+array_args: List%5Bstr%5D = %5B'id', 'name', 'status', 'notstatus', 'reason', 'level', 'owner', 'type', 'query'%5D%0A error_msg: List%5Bstr%5D = %5B%5D%0A for _key, value in args.items():%0A if _key in a... |
37bd6459bff3f9b079897b1392c04681c65fa24e | Fix #8 chat.reply doesn't work in groups | aiotg/chat.py | aiotg/chat.py | import json
import logging
from functools import partialmethod
logger = logging.getLogger("aiotg")
class Chat:
"""
Wrapper for telegram chats, passed to most callbacks
"""
def send_text(self, text, **options):
"""
Send a text message to the chat, for available options see
ht... | Python | 0 | @@ -467,20 +467,18 @@
markup=
-None
+%7B%7D
, parse_
|
1675ecd5ea2d4aaf8d8b6aa76d007d081f92eba6 | add context processor for static | nurseconnect/context_processors.py | nurseconnect/context_processors.py | Python | 0.000002 | @@ -0,0 +1,157 @@
+from django.conf import settings%0A%0A%0Adef compress_settings(request):%0A return %7B%0A 'STATIC_URL': settings.STATIC_URL,%0A 'ENV': settings.ENV%0A %7D%0A
| |
a1820a0e5f9bd891b20f70ab68dfd4bb385047a0 | Add utils to allow multiclass classification. | utils/multiclassification.py | utils/multiclassification.py | Python | 0 | @@ -0,0 +1,1877 @@
+from __future__ import division%0A%0Aimport numpy as np%0A%0Afrom sklearn.multiclass import OneVsOneClassifier%0Afrom sklearn.multiclass import _fit_binary%0Afrom sklearn.externals.joblib import Parallel, delayed%0Afrom unbalanced_dataset import SMOTE%0A%0A%0Adef _fit_ovo_binary(estimator, X, y, i, ... | |
18d11a06e1e84ece32277e0860229555aae321f0 | Add a snippet (Python). | python/cross-platform_home_directory.py | python/cross-platform_home_directory.py | Python | 0.000035 | @@ -0,0 +1,91 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0Aimport os%0A%0Aprint(os.path.expanduser(%22~%22))%0A%0A
| |
cd62dabc7696205fad3d955381d59df48fdeb2b2 | Fix profiler after module structure has been changed in pydevd, take 2 (PY-18442) | python/helpers/profiler/run_profiler.py | python/helpers/profiler/run_profiler.py | import os
import pydev_imports
import sys
import time
import traceback
from _pydevd_bundle.pydevd_utils import save_main_module
from socket import AF_INET
from socket import SOCK_STREAM
from socket import socket
from _prof_imports import ProfilerResponse
from prof_io import ProfWriter, ProfReader
from prof_util import... | Python | 0 | @@ -7,29 +7,8 @@
os%0A
-import pydev_imports%0A
impo
@@ -43,16 +43,56 @@
aceback%0A
+from _pydev_bundle import pydev_imports%0A
from _py
|
d9b991390c11d726c364e09f8010b9beb4cf0fb6 | Add "pa" to languages_by_size | pywikibot/families/wikisource_family.py | pywikibot/families/wikisource_family.py | # -*- coding: utf-8 -*-
"""Family module for Wikisource."""
#
# (C) Pywikibot team, 2004-2017
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
from pywikibot import family
__version__ = '$Id$'
# The Wikimedia family that is known as Wikisource
class Fami... | Python | 0.000008 | @@ -1230,16 +1230,34 @@
, 'fo',%0A
+ 'pa',%0A
|
c8b78cab7a32a300e418033185595fd79a290823 | add bmf study | qlcoder/image_processing/bmp_python3.py | qlcoder/image_processing/bmp_python3.py | Python | 0.000001 | @@ -0,0 +1,500 @@
+import binascii%0Afi = open(%22aaa.bmp%22, %22rb%22)%0Aheader = fi.read(1078)%0Aline = fi.read()%0Afi.close()%0A%0Abinline = ''%0A%0A%0Afor i in range(0,len(line)):%0A binline += bin(line%5Bi%5D)%5B2:%5D.zfill(8)%0Anewbinline = ''%0Afor i in range(len(binline)):%0A if(i%257 == 0):%0A new... | |
c9b3bd8309d3d1448823787160021a8688e8f3c1 | Add python to make vv h5 file | vv_h5_setup.py | vv_h5_setup.py | Python | 0.000001 | @@ -0,0 +1,862 @@
+import tables%0A%0Avv_desc = dict(%0Aobsid=tables.IntCol(pos=0),%0Arevision=tables.IntCol(pos=1),%0Amost_recent=tables.IntCol(pos=2),%0Aslot=tables.IntCol(pos=3),%0Atype=tables.StringCol(10,pos=4),%0An_pts=tables.IntCol(pos=5),%0Arad_off=tables.FloatCol(pos=6),%0Afrac_dy_big=tables.FloatCol(pos=7),%0... | |
836c7aa92cd9d35e7d54046e835f285410780b84 | Create nodejs.py | wigs/nodejs.py | wigs/nodejs.py | Python | 0.000032 | @@ -0,0 +1,181 @@
+class nodejs(Wig):%0A git_uri = 'https://github.com/nodejs/node'%0A tarball_uri = 'https://github.com/nodejs/node/archive/v$RELEASE_VERSION$.tar.gz'%0A last_release_version = 'v4.7.2'%0A
| |
5c4a199c7c7f457131c38b85b1e42abd315b2d2a | Use system_id from event | ryu/services/protocols/ovsdb/manager.py | ryu/services/protocols/ovsdb/manager.py | # Copyright (c) 2014 Rackspace Hosting
#
# 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 ... | Python | 0 | @@ -5120,21 +5120,16 @@
adReply(
-self.
system_i
|
1edf0898422c74173a9b6526c789b140938664b5 | add main module | server/__main__.py | server/__main__.py | Python | 0.000001 | @@ -0,0 +1,13 @@
+import server
| |
d48035b06b952b9ac4d95897d08de50d5977bf9f | Add basic test for OrderedDict. | tests/basics/ordereddict1.py | tests/basics/ordereddict1.py | Python | 0 | @@ -0,0 +1,355 @@
+try:%0A from collections import OrderedDict%0Aexcept ImportError:%0A try:%0A from _collections import OrderedDict%0A except ImportError:%0A print(%22SKIP%22)%0A import sys%0A sys.exit()%0A%0Ad = OrderedDict(%5B(10, 20), (%22b%22, 100), (1, 2)%5D)%0Aprint(list(d.ke... | |
8c13531751552de53de483ec1aad17bd16d4d74d | Configure MEDIA_ROOT and MEDIA_URL properly | mysite/settings.py | mysite/settings.py | # Django settings for mysite project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Asheesh Laroia', 'asheesh@openhatch.org'),
('Raphael Krut-Landau', 'raphael@openhatch.org')
)
MANAGERS = ADMINS
DATABASE_OPTIONS = {
'read_default_file': './my.cnf',
}
TEST_DATABASE_OPTIONS = {
'read_default_file... | Python | 0 | @@ -1,8 +1,18 @@
+import os%0A
# Django
@@ -1753,18 +1753,65 @@
_ROOT =
-''
+os.path.join(os.path.dirname(__file__), 'static')
%0A%0A# URL
@@ -2031,16 +2031,24 @@
_URL = '
+/static/
'%0A%0A# URL
|
45ccdce362694f50c43828e3923fc9e3fa32c8bb | Add list_callbacks.py | scripts/list_callbacks.py | scripts/list_callbacks.py | Python | 0.000003 | @@ -0,0 +1,202 @@
+#!/usr/bin/env python2%0A%0Aimport sys%0A%0Afrom parse_header import *%0A%0Adef main(argv):%0A%09for type, name, args, attrs in get_callbacks(sys.stdin.read()):%0A%09%09print name%0A%0Aif __name__ == %22__main__%22:%0A%09main(sys.argv)%0A
| |
f075f21b53e13d53fc26e38bcf995d55ea44df67 | Patch bump for pypi | exa/__init__.py | exa/__init__.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
'''
Exa
#########
This package creates a systematic infrastructure for an ecosystem of packages,
tailored to specific industry or academic displines, for organizing, processin... | Python | 0 | @@ -976,9 +976,9 @@
2,
-4
+5
)%0D%0A_
|
ec91d5106bfab93e0540e5dc4a0bbd9b7cea151b | add script to update old .h5 files to support normalization | scripts/update_data_h5.py | scripts/update_data_h5.py | Python | 0 | @@ -0,0 +1,719 @@
+# update h5 files created by old versions of pyannote-speaker-embedding%0A# estimate mu/sigma and save it back to the file%0A# usage: update_data_h5.py /path/to/file.h5%0A%0Aimport sys%0Aimport h5py%0Aimport numpy as np%0Afrom tqdm import tqdm%0A%0Adata_h5 = sys.argv%5B1%5D%0A%0Awith h5py.File(data_h... | |
50ba17b46c7fcc7eb42a48a5ec82e295fdbeae13 | Add missing migration | migrations/versions/25ecf1c9b3fb_introduce_deploykey_entity.py | migrations/versions/25ecf1c9b3fb_introduce_deploykey_entity.py | Python | 0.0002 | @@ -0,0 +1,1858 @@
+%22%22%22Introduce DeployKey entity%0A%0ARevision ID: 25ecf1c9b3fb%0ARevises: 1c314d48261a%0ACreate Date: 2014-02-08 02:56:34.174597%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '25ecf1c9b3fb'%0Adown_revision = '1c314d48261a'%0A%0A%0Aimport sqlalchemy as sa%0Afrom alembi... | |
0e833de83903c26fb3ca04c10b140c712350a12f | Create tests.py | unit-3-mixed-reading-and-assignment-lessons/lesson-3-assignment-one-code-block/tests.py | unit-3-mixed-reading-and-assignment-lessons/lesson-3-assignment-one-code-block/tests.py | Python | 0.000001 | @@ -0,0 +1,398 @@
+import unittest%0A%0A%0Aclass ConvertTemperatureTestCase(unittest.TestCase):%0A def test_fahrenheit_to_celsius(self):%0A self.assertEqual(convert_temperature(32, to='celsius'), 0)%0A%0A def test_celsius_to_fahrenheit(self):%0A self.assertEqual(convert_temperature(40, to='fahrenhei... | |
6c6d3d365e021918fe88450136a75bbac7a21d5c | add .percol.d | .percol.d/rc.py | .percol.d/rc.py | Python | 0.000005 | @@ -0,0 +1,1321 @@
+# Emacs like%0Apercol.import_keymap(%7B%0A %22C-h%22 : lambda percol: percol.command.delete_backward_char(),%0A %22C-d%22 : lambda percol: percol.command.delete_forward_char(),%0A %22C-k%22 : lambda percol: percol.command.kill_end_of_line(),%0A %22C-y%22 : lambda percol: percol.command.y... | |
d7595d6d80468ec5f0e4bde86db8a431c4384ad3 | Solve 41. | 041/solution.py | 041/solution.py | Python | 0.998706 | @@ -0,0 +1,1221 @@
+# coding: utf-8%0A%0A%22%22%22 Project Euler problem #41. %22%22%22%0A%0Aimport math as mt%0A%0A%0Adef problem():%0A u%22%22%22 Solve the problem.%0A%0A We shall say that an n-digit number is pandigital if it makes use of all%0A the digits 1 to n exactly once. For example, 2143 is a 4-digit... | |
b395239526a4246193aa9ce0e541538e5690f408 | Return change | python/reddit/least_bills.py | python/reddit/least_bills.py | Python | 0.000015 | @@ -0,0 +1,974 @@
+def bills_needed(money):%0A %22%22%22Determine optimal numbers of each bill denomination for amount.%0A%0A Args:%0A money, int: Amount of money to figure bills for%0A Returns:%0A cash, dict: Count of each type of bill needed for sum%0A %22%22%22%0A denominations = %5B1, 2... | |
9bcb2566afa8191e24fb4f66b3fb882724ba4083 | Test ragged getitem | thinc/tests/test_indexing.py | thinc/tests/test_indexing.py | Python | 0 | @@ -0,0 +1,1119 @@
+import pytest%0Aimport numpy%0Afrom numpy.testing import assert_allclose%0Afrom thinc.types import Ragged%0A%0A%0A@pytest.fixture%0Adef ragged():%0A data = numpy.zeros((20, 4), dtype=%22f%22)%0A lengths = numpy.array(%5B4, 2, 8, 1, 4%5D, dtype=%22i%22)%0A data%5B0%5D = 0%0A data%5B1%5D =... | |
f433cdb41f33a7b9daeaf276bf19d2617534e781 | Add Tensor Flow | python/src/fft/fourier_nd.py | python/src/fft/fourier_nd.py | Python | 0.000019 | @@ -0,0 +1,1172 @@
+import numpy as np%0Aimport pylab as plt%0Aimport pandas as pd%0Afrom numpy import fft%0Aimport src.mylib.mfile as mfile%0A%0Adef bandpass_filter(x, freq, frequency_of_signal=0, band=0.1):%0A if (frequency_of_signal - band) %3C abs(freq) %3C (frequency_of_signal + band):%0A return x%0A ... | |
470063b8d468394432e729e7417c88263614b5f0 | Create msub_cluster.py | snakemake_ChIPseq_pipeline/msub_cluster.py | snakemake_ChIPseq_pipeline/msub_cluster.py | Python | 0.000046 | @@ -0,0 +1 @@
+%0A
| |
a7b0fc1effd0e68018bc3c33f1dc0b952b23003b | update nav access restrictions | accelerator/migrations/0095_update_nav_tree_access_restrictions.py | accelerator/migrations/0095_update_nav_tree_access_restrictions.py | Python | 0 | @@ -0,0 +1,778 @@
+# Generated by Django 2.2.24 on 2022-03-29 16:24%0A%0Afrom django.db import migrations%0A%0A%0Adef update_nav_access_restrictions(apps, schema_editor):%0A NavTreeItem = apps.get_model('accelerator', 'NavTreeItem')%0A urls = %5B'/judging/panel/', '/judging/commitments/', '/nav/judging'%5D%0A ... | |
645efb8ffcc3c9a3e41db2619430ffcb7a6d570f | Migrate Req/Ass to have verified/finished date | src/ggrc/migrations/versions/20160314140338_4fd36860d196_add_finished_date_to_request_and_.py | src/ggrc/migrations/versions/20160314140338_4fd36860d196_add_finished_date_to_request_and_.py | Python | 0 | @@ -0,0 +1,1519 @@
+# Copyright (C) 2016 Google Inc., authors, and contributors %3Csee AUTHORS file%3E%0A# Licensed under http://www.apache.org/licenses/LICENSE-2.0 %3Csee LICENSE file%3E%0A# Created By: andraz@reciprocitylabs.com%0A# Maintained By: andraz@reciprocitylabs.com%0A%0A%22%22%22%0Aadd finished date to reque... | |
bad82f3c77dbeebdc2332d193f0c8290c5186862 | add rudimentary api | frontend/app.py | frontend/app.py | Python | 0.000007 | @@ -0,0 +1,1541 @@
+import os%0Aimport sys%0Aimport inspect%0Aimport json%0Afrom flask import Flask%0A%0A# move to top level%0Acurrentdir = os.path.dirname(%0A os.path.abspath(inspect.getfile(inspect.currentframe())))%0Aparentdir = os.path.dirname(currentdir)%0Asys.path.insert(0, parentdir)%0A%0Afrom api.reporting i... | |
37baa669ed1e00fabddd33478fa75f4047075ce3 | Create Python object detection script. | cs473vision/ObjectDetector.py | cs473vision/ObjectDetector.py | Python | 0 | @@ -0,0 +1,1092 @@
+'''%0ACreated on Feb 28, 2014%0A%0A@author: Vance Zuo%0A'''%0A%0Aimport numpy%0Aimport cv2%0A%0Aclass ObjectDetector(object):%0A '''%0A classdocs%0A '''%0A%0A%0A def __init__(self, params):%0A '''%0A Constructor%0A '''%0A self.bg_img = None%0A self.fg_i... | |
4aacc8d55c138c405d561bbf9ddfd9ddab483e62 | add wxPython example. | trypython/extlib/gui/wx01.py | trypython/extlib/gui/wx01.py | Python | 0 | @@ -0,0 +1,443 @@
+%22%22%22%0AwxPython %E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%E3%81%AE%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%81%A7%E3%81%99%0A%0A%E3%81%8A%E6%B1%BA%E3%81%BE%E3%82%8A%E3%81%AE Hello world %E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6%0A%0AREFERENCES:: http://bit.ly/2OcHRh7%0A%22%22%22%0A# noinspection PyPackageRe... | |
9566d71a267015005ad937cd92bd105d2ffff274 | print users with multiple matching urls | twnews/print_urls_by_user.py | twnews/print_urls_by_user.py | Python | 0.000006 | @@ -0,0 +1,876 @@
+%22%22%22%0APrint users who were found for multiple urls.%0A%0Auser url1 score1 url2 score2 ...%0A%22%22%22%0Aimport codecs%0Afrom collections import defaultdict%0Aimport json%0Aimport sys%0A%0Afrom . import __data__%0A%0Asys.stdout = codecs.getwriter('utf8')(sys.stdout)%0A%0A%0Adef print_urls_by_use... | |
bc9c057d57d4dbc2e3c70eaf3ac182df2b334107 | fix bluffing again | player.py | player.py | import logging
import card as c
class Player(object):
"""
This class represents a player.
It is basically a doubly-linked ring list with the option to reverse the
direction. On initialization, it will connect itself to a game and its
other players by placing itself behind the current player.
... | Python | 0.000009 | @@ -2348,87 +2348,206 @@
if
-it's the only card you can play%0A self.bluffing = bool(len(playable) - 1)
+you have no cards of the correct color%0A self.bluffing = False%0A for card in playable:%0A if card.color == last.color:%0A self.bluffing = True%0A br... |
e5627134d9a2c052a523f66a2ec9867b3432fae2 | Test Issue #461: ent_iob tag incorrect after setting entities. | spacy/tests/tokens/test_add_entities.py | spacy/tests/tokens/test_add_entities.py | Python | 0 | @@ -0,0 +1,1115 @@
+from __future__ import unicode_literals%0Aimport spacy%0Afrom spacy.vocab import Vocab%0Afrom spacy.matcher import Matcher%0Afrom spacy.tokens.doc import Doc%0Afrom spacy.attrs import *%0Afrom spacy.pipeline import EntityRecognizer%0A%0Aimport pytest%0A%0A%0A@pytest.fixture(scope=%22module%22)%0Adef... | |
011c01b1d81f7eed22eaf5418c60016597309789 | Update fetching CA definitions for assessments | src/ggrc/converters/handlers/custom_attribute.py | src/ggrc/converters/handlers/custom_attribute.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: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
"""Handlers used for custom attribute columns."""
from dateutil.parser import p... | Python | 0 | @@ -319,16 +319,45 @@
parse%0A%0A
+from sqlalchemy import and_%0A%0A
from ggr
@@ -6280,30 +6280,79 @@
rn None%0A
-return
+cad = models.CustomAttributeDefinition%0A definition =
self.row_co
@@ -6437,28 +6437,231 @@
obj.id, self.display_name))%0A
+ if not definition:%0A definition = cad.query.filter... |
7cee0980a67b827e4cf06c15e0f1c3b412f68c22 | Create main.py to actually perform the test | main.py | main.py | Python | 0 | @@ -0,0 +1,426 @@
+import io%0Aimport argparse%0A%0Adef initialize_argument_parser():%0A parser = argparse.ArgumentParser(description='Simulate Indian health solutions')%0A parser.add_argument('-s', '--solution', dest='solution', %0A help='the solution to test', default='health kiosk')%0A return var... | |
361c3496274a960c5e927899a39618f8fee9db0a | Add Basic Trellis Histogram to Examples | altair/vegalite/v2/examples/trellis_histogram.py | altair/vegalite/v2/examples/trellis_histogram.py | Python | 0 | @@ -0,0 +1,444 @@
+%22%22%22%0ATrellis Histogram%0A-----------------%0AThis example shows how to make a basic trellis histogram.%0Ahttps://vega.github.io/vega-lite/examples/trellis_bar_histogram.html%0A%22%22%22%0Aimport altair as alt%0A%0Acars = alt.load_dataset('cars')%0A%0Achart = alt.Chart(cars).mark_bar().encode(%... | |
333453fe6a74d7bada941ee7aeed3660452efcaf | add tests | tests/install_tests/test_cupy_builder/test_command.py | tests/install_tests/test_cupy_builder/test_command.py | Python | 0 | @@ -0,0 +1,646 @@
+from cupy_builder._command import filter_files_by_extension%0A%0A%0Adef test_filter_files_by_extension():%0A sources_cpp = %5B'a.cpp', 'b.cpp'%5D%0A sources_pyx = %5B'c.pyx'%5D%0A sources = sources_cpp + sources_pyx%0A assert filter_files_by_extension(%0A sources, '.cpp') == (sourc... | |
76f5a60a9b9217519be132ad7fc86eb439ae9a3f | Fix `TypeError` in Python-3.2 | powerline/bindings/zsh/__init__.py | powerline/bindings/zsh/__init__.py | # vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import atexit
from weakref import WeakValueDictionary, ref
import zsh
from powerline.shell import ShellPowerline
from powerline.lib.overrides import parsedotval, parse_override_var
from powerline.lib.u... | Python | 0.998627 | @@ -1462,18 +1462,45 @@
lit(
-type(ret)(
+(b':' if isinstance(ret, bytes) else
':')
|
8a7963644ff470fc7da8bc22a7f3fd6ef1be3ed2 | define password generator. | rio/utils/token.py | rio/utils/token.py | Python | 0.000001 | @@ -0,0 +1,314 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0Ario.utils.token%0A~~~~~~~~~~~~~~~%0A%22%22%22%0A%0Aimport random%0Aimport string%0A%0Adef password_generator(length):%0A %22%22%22Generate a random password.%0A%0A :param length: integer.%0A %22%22%22%0A return ''.join(random.choice(string.ascii_lower... | |
1d4397860ffd297eb02b5f4b96b0e18a3c7e12cd | Add test recipes. | badgify/tests/recipes.py | badgify/tests/recipes.py | Python | 0 | @@ -0,0 +1,748 @@
+# -*- coding: utf-8 -*-%0Afrom ..recipe import BaseRecipe%0Afrom ..compat import get_user_model%0A%0A%0Aclass BadRecipe(object):%0A pass%0A%0A%0Aclass NotImplementedRecipe(BaseRecipe):%0A pass%0A%0A%0Aclass Recipe1(BaseRecipe):%0A name = 'Recipe 1'%0A slug = 'recipe1'%0A description = ... | |
f6c07ad620f7e3ef73fdad5f2d97d1dd911e390f | Create signal.py | signal.py | signal.py | Python | 0.000002 | @@ -0,0 +1,854 @@
+#!/usr/bin/python3%0A# Send via Signal%0A%0Aimport os%0Afrom pydbus import SystemBus%0Afrom dateutil import parser%0Afrom datetime import datetime%0A%0Aeventhostname=os.environ.get (%22NOTIFY_HOSTNAME%22, %22%3Cno host%3E%22)%0AeventdatetimeString=os.environ.get (%22NOTIFY_LONGDATETIME%22, %22%3Cno t... | |
269e9821a52f1d68e2a48beb76b20c227dc84b55 | add 0007(count one file omitting multiple-line comment) | robot527/0007/count_codes.py | robot527/0007/count_codes.py | Python | 0 | @@ -0,0 +1,1455 @@
+#! usr/bin/python3%0A%22%22%22%0A%E7%AC%AC 0007 %E9%A2%98%EF%BC%9A%E6%9C%89%E4%B8%AA%E7%9B%AE%E5%BD%95%EF%BC%8C%E9%87%8C%E9%9D%A2%E6%98%AF%E4%BD%A0%E8%87%AA%E5%B7%B1%E5%86%99%E8%BF%87%E7%9A%84%E7%A8%8B%E5%BA%8F%EF%BC%8C%E7%BB%9F%E8%AE%A1%E4%B8%80%E4%B8%8B%E4%BD%A0%E5%86%99%E8%BF%87%E5%A4%9A%E5%B0%91... | |
74d8390dce4dd5a8fe8a6f7f4304b80afadfec1d | Add basic calendar framework | app/calender.py | app/calender.py | Python | 0.000002 | @@ -0,0 +1,320 @@
+class CalenderManager:%0A def __init__(self):%0A pass%0A %0A def add_event(self, user, starttime, endtime):%0A pass%0A %0A def get_current_event(self):%0A #Return NONE if no event%0A pass%0A %0A def remove_event(self, id):%0A pass%0A %0A d... | |
68e4b7628da642799d5fccec8ae96d875d1d8089 | Fix for id not showing up in verbose lists of concepts | django-nonrel/ocl/concepts/serializers.py | django-nonrel/ocl/concepts/serializers.py | from django.core.validators import RegexValidator
from rest_framework import serializers
from collection.fields import ConceptReferenceField
from concepts.fields import LocalizedTextListField
from concepts.models import Concept, ConceptVersion, ConceptReference
from oclapi.fields import HyperlinkedRelatedField
from ocl... | Python | 0 | @@ -1074,32 +1074,82 @@
rs.Serializer):%0A
+ id = serializers.CharField(source='mnemonic')%0A
concept_clas
|
23086155315b39e814a1a73b49c80b19cbdb8e12 | 476. Number Complement | p476.py | p476.py | Python | 0.999999 | @@ -0,0 +1,600 @@
+import unittest%0A%0A%0Aclass Solution(object):%0A def findComplement(self, num):%0A %22%22%22%0A :type num: int%0A :rtype: int%0A %22%22%22%0A mask = num%0A mask %7C= mask %3E%3E 1%0A mask %7C= mask %3E%3E 2%0A mask %7C= mask %3E%3E 4%0A ... | |
af19c62cfa27f27cd37bf558ac77a7845dff7754 | Create generate_chapters.py | sandbox/generate_chapters.py | sandbox/generate_chapters.py | Python | 0.000009 | @@ -0,0 +1,367 @@
+@language python%0A%0AVOLUME = 'II'%0ATOTAL_CHAPTERS = 42%0AURL = %22http://www.feynmanlectures.caltech.edu/%7B0%7D_%7B1:02%7D.html%22%0A%0Acopied_position = p.copy()%0A%0Afor index in range(1, TOTAL_CHAPTERS+1):%0A new_node = copied_position.insertAsLastChild()%0A new_node.h = %22@chapter %7B0... | |
48115d48da43f7f4517d8f55edee95d6c9e7cc45 | Create saveGraphToFile.py | save-load/saveGraphToFile.py | save-load/saveGraphToFile.py | Python | 0.000001 | @@ -0,0 +1,1031 @@
+from py2neo import Graph, Node, Relationship%0Agraph = Graph()%0A%0A# Get username%0Ausr_name = input(%22Enter username: %22)%0Aprint (%22Username: %22 + usr_name)%0A# Get user_id%0Ausr_id = input(%22Enter user id: %22)%0Aprint (%22User id: %22 + usr_id)%0A%0Aprint(%22Nodes%22)%0AresultsAllNodes = g... | |
34fff4bf13fa2c4d481a06339981db08239138ae | add test case of petitlyrics | lyric_engine/tests/test_petitlyrics.py | lyric_engine/tests/test_petitlyrics.py | Python | 0.002379 | @@ -0,0 +1,1059 @@
+# coding: utf-8%0Aimport os%0Aimport sys%0Amodule_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'modules')%0Asys.path.append(module_dir)%0A%0Aimport unittest%0Afrom petitlyrics import PetitLyrics as Lyric%0A%0Aclass PetitLyricsTest(unittest.TestCase):%0A def test_url_01(se... | |
5436ba117b687eb3bd4e7afa69d5a67935056342 | remove deprecated code from FeedExporter | scrapy/contrib/feedexport.py | scrapy/contrib/feedexport.py | """
Feed Exports extension
See documentation in docs/topics/feed-exports.rst
"""
import sys, os, posixpath
from tempfile import TemporaryFile
from datetime import datetime
from six.moves.urllib.parse import urlparse
from ftplib import FTP
from zope.interface import Interface, implementer
from twisted.internet import... | Python | 0.000001 | @@ -4316,392 +4316,8 @@
r):%0A
- if len(get_func_args(cls)) %3C 1:%0A # FIXME: remove for scrapy 0.17%0A import warnings%0A from scrapy.exceptions import ScrapyDeprecationWarning%0A warnings.warn(%22%25s must receive a settings object as first constructor argument.%22... |
16fd4ba06b6da8ec33a83a8cfe2e38a130fb47b3 | Add a module for common plotting routines that will be used. | plot.py | plot.py | Python | 0 | @@ -0,0 +1,778 @@
+#!/usr/bin/env python%0A%22%22%22%0A plot.py%0A %0A State Estimation and Analysis for PYthon%0A%0A Module with plotting utilities%0A%0A Written by Brian Powell on 10/18/13%0A Copyright (c)2013 University of Hawaii under the BSD-License.%0A%22%22%22%0Afrom __future__ import print_function%0A%0Ai... | |
cbbc6d943ebc4f7e1efa84f2c0b5d976de21101d | Add "imported from" source using a hardcoded list of items | scripts/claimit.py | scripts/claimit.py | # -*- coding: utf-8 -*-
"""
Copyright (C) 2013 Legoktm
Copyright (C) 2013 Pywikipediabot team
Distributed under the MIT License
Usage:
python claimit.py [pagegenerators] P1 Q2 P123 Q456
You can use any typical pagegenerator to provide with a list of pages
Then list the property-->target pairs to add.
"""
import py... | Python | 0.000051 | @@ -401,16 +401,1242 @@
tory()%0A%0A
+source_values = %7B'en': pywikibot.ItemPage(repo, 'Q328'),%0A 'sv': pywikibot.ItemPage(repo, 'Q169514'),%0A 'de': pywikibot.ItemPage(repo, 'Q48183'),%0A 'it': pywikibot.ItemPage(repo, 'Q11920'),%0A 'no': pywikibot.Ite... |
94d40dfcf574d61df7def99a43d5b9fa0c75e244 | Add py solution for 406. Queue Reconstruction by Height | py/queue-reconstruction-by-height.py | py/queue-reconstruction-by-height.py | Python | 0.000749 | @@ -0,0 +1,1139 @@
+from collections import defaultdict%0Aclass Solution(object):%0A def insert(self, now, p, front):%0A lsize = 0 if now.left is None else now.left.val%5B1%5D%0A if front %3C= lsize:%0A if now.left is None:%0A now.left = TreeNode((p, 1))%0A else:%0A... | |
8fb97711dd84512a8a654de3dca2bee24689a2a7 | add a test for pytestmark | pytest_tornado/test/test_fixtures.py | pytest_tornado/test/test_fixtures.py | Python | 0.000008 | @@ -0,0 +1,577 @@
+import pytest%0Afrom tornado import gen%0A%0A_used_fixture = False%0A%0A%0A@gen.coroutine%0Adef dummy(io_loop):%0A yield gen.Task(io_loop.add_callback)%0A raise gen.Return(True)%0A%0A%0A@pytest.fixture(scope='module')%0Adef preparations():%0A global _used_fixture%0A _used_fixture = True%0... | |
76ce9117ed92a743734cd5ba7e209617a7664ad1 | Add partial benchmarking file for gala | benchmarks/bench_gala.py | benchmarks/bench_gala.py | Python | 0 | @@ -0,0 +1,1556 @@
+import os%0A%0Afrom gala import imio, features, agglo, classify%0A%0A%0Arundir = os.path.dirname(__file__)%0Add = os.path.abspath(os.path.join(rundir, '../tests/example-data'))%0A%0A%0Aem3d = features.default.paper_em()%0A%0A%0Adef setup_trdata():%0A wstr = imio.read_h5_stack(os.path.join(dd, 'tr... | |
875015d263e5942cebf223ea5c85f8fe35d9f561 | Version of gen that doesn't use itertools. | gen2.py | gen2.py | Python | 0 | @@ -0,0 +1,1648 @@
+'''%0ASeveral functions for generating subets of sigma star (in list form). Namely:%0Asigma_k, sigma_0k, sigma_1k, each of which takes an alphabet and a value for k.%0AUnlike gen.py, gen2.py does not import itertools.py.%0A'''%0A%0Adef sigma_k(alphabet, k):%0A '''returns words in sigma-k'''%0A ... | |
180faadb24bf3b4d153f1c46c4883bdcc0b987ff | add a manifest (.cvmfspublished) abstraction class | python/cvmfs/manifest.py | python/cvmfs/manifest.py | Python | 0.000001 | @@ -0,0 +1,2603 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated by Ren%C3%A9 Meusel%0AThis file is part of the CernVM File System auxiliary tools.%0A%22%22%22%0A%0Aimport datetime%0A%0Aclass UnknownManifestField:%0A def __init__(self, key_char):%0A self.key_char = key_char%0A%0A d... | |
e044dceeb4f6dd91a1e29228cde7906a114f36ba | add ping-listener.py | src/ping-listener.py | src/ping-listener.py | Python | 0 | @@ -0,0 +1,696 @@
+#!/usr/bin/python%0A%0A# This tool is for educational use only!%0A%0A# Description: Listen on a networkinterface for incomming pings (ICMP packets)%0A# and display this pings on the console%0A%0A# Requirements: scapy + root privileges%0A%0Aimport sys%0Afrom scapy.all import *%0Afrom pprint import *%0... | |
942b7c519a07a84c7f26077b78c23c60174e1141 | Add VCF precalculator | scripts/precalc.py | scripts/precalc.py | Python | 0.000001 | @@ -0,0 +1,1799 @@
+# -*- coding: utf-8 -*-%0A'''%0A%09Earth Engine precalculator for CLASlite%0A%09Requires Python 2.6+%0A%09%0A%09Public Domain where allowed, otherwise:%0A%09Copyright 2010 Michael Geary - http://mg.to/%0A%09Use under MIT, GPL, or any Open Source license:%0A%09http://www.opensource.org/licenses/%0A''... | |
8b9a8f6443c1a5e184ececa4ec03baabca0973de | Add support for Pocket | services/pocket.py | services/pocket.py | Python | 0 | @@ -0,0 +1,1725 @@
+from werkzeug.urls import url_decode%0Aimport requests%0Aimport foauth.providers%0A%0A%0Aclass Pocket(foauth.providers.OAuth2):%0A # General info about the provider%0A provider_url = 'http://getpocket.com/'%0A docs_url = 'http://getpocket.com/developer/docs/overview'%0A category = 'News'... | |
8244d71a41032e41bd79741ec649fa78c6317efa | add mixins for tweaking smartmin behavior more easily | smartmin/mixins.py | smartmin/mixins.py | Python | 0 | @@ -0,0 +1,260 @@
+%0A# simple mixins that keep you from writing so much code%0Aclass PassRequestToFormMixin(object):%0A def get_form_kwargs(self):%0A kwargs = super(PassRequestToFormMixin, self).get_form_kwargs()%0A kwargs%5B'request'%5D = self.request%0A return kwargs%0A
| |
32dd2099f97add61cb31df7af796876a95695bb1 | Add a sample permission plugin for illustrating the check on realm resources, related to #6211. | sample-plugins/public_wiki_policy.py | sample-plugins/public_wiki_policy.py | Python | 0.000003 | @@ -0,0 +1,2047 @@
+from fnmatch import fnmatchcase%0A%0Afrom trac.config import Option%0Afrom trac.core import *%0Afrom trac.perm import IPermissionPolicy%0A%0Aclass PublicWikiPolicy(Component):%0A %22%22%22Sample permission policy plugin illustrating how to check %0A permission on realms.%0A%0A Don't forget ... | |
1c39eb113be409ff304a675ef8a85e96a97b1d87 | Add files via upload | basicTwitter.py | basicTwitter.py | Python | 0 | @@ -0,0 +1,1887 @@
+'''%0ARIT SPEX: Twitter posting basic.%0A%0ABasic python script for posting to twitter.%0A%0APre-Req:%0A Python3%0A Tweepy library twitter%0A%0AContributors:%0A Evan Putnam%0A Henry Yaeger%0A John LeBrun%0A Helen O'Connell%0A'''%0A%0A%0Aimport tweepy%0A%0A%0A#Tweet a picutre%0Adef... | |
eb170653e64c5a874a773dc37c99dccb4dd42608 | Add tools.color module (#41, #36)) | xentica/tools/color.py | xentica/tools/color.py | Python | 0 | @@ -0,0 +1,786 @@
+%22%22%22A collection of color conversion helpers.%22%22%22%0A%0A%0Adef hsv2rgb(hue, sat, val):%0A %22%22%22%0A Convert HSV color to RGB format.%0A%0A :param hue: Hue value %5B0, 1%5D%0A :param sat: Saturation value %5B0, 1%5D%0A :param val: Brightness value %5B0, 1%5D%0A%0A :return... | |
1d5f1576a5f92c1917fa29c457e4b7ad055f41ca | Add info for mono@5.4.0.167 (#5405) | var/spack/repos/builtin/packages/mono/package.py | var/spack/repos/builtin/packages/mono/package.py | ###############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-6... | Python | 0 | @@ -2217,16 +2217,77 @@
ild'))%0A%0A
+ version('5.4.0.167', '103c7a737632046a9e9a0b039d752ee1')%0A
vers
|
d03edd6670c130925fa8b947ebde03f2026602c3 | remove redundant verbose prints | dj/scripts/mk_public.py | dj/scripts/mk_public.py | #!/usr/bin/python
# mk_public.py - flip state on hosts from private to public
# private = not listed, can be seen if you know the url
# the presenters have been emaild the URL,
# they are encouraged to advertise it.
# public = advertised, it is ready for the world to view.
# It will be tweeted at @NextD... | Python | 0.956212 | @@ -1694,62 +1694,8 @@
p):%0A
- if self.options.verbose: print ep.id, ep.name%0A
|
197fb6ec004c0bf47ec7e2fd25b75564a3ecf6c4 | Add tests for logging of rest requests | test/audit_logs/test_audit_log.py | test/audit_logs/test_audit_log.py | Python | 0 | @@ -0,0 +1,1758 @@
+import datetime%0Aimport pytest%0Afrom girder import auditLogger%0A%0A%0A@pytest.fixture%0Adef recordModel():%0A from girder.plugins.audit_logs import Record%0A yield Record()%0A%0A%0A@pytest.fixture%0Adef resetLog():%0A yield auditLogger%0A%0A for handler in auditLogger.handlers:%0A ... | |
9e96a7ff9ad715f58d07341bd571e63ef233ffdb | Create fizzbuzz.py | job_interview_algs/fizzbuzz.py | job_interview_algs/fizzbuzz.py | Python | 0.00001 | @@ -0,0 +1,481 @@
+#!/usr/bin/env python%0A# -*- coding: UTF-8 -*-%0A%0A'''%0ACreated on 24 02 2016%0A@author: vlad%0A'''%0A%0A%0Adef multiple_of_3(number):%0A return number %25 3 == 0%0A%0Adef multiple_of_5(number):%0A return number %25 5 == 0%0A %0Afor i in range(1, 100):%0A if not multiple_of_3(i) and no... | |
8089750d5dccadb0603068eefec869df4f8360cc | Add fizzbuzz.py in strings folder | strings/fizzbuzz.py | strings/fizzbuzz.py | Python | 0.000001 | @@ -0,0 +1,1393 @@
+%22%22%22%0AWtite a function that returns an array containing the numbers from 1 to N, %0Awhere N is the parametered value. N will never be less than 1.%0A%0AReplace certain values however if any of the following conditions are met:%0A%0AIf the value is a multiple of 3: use the value 'Fizz' instead%... | |
9ea3c14983c7b2e32132f1ffe6bbbe7b4d19000c | Add Flyweight.py | Python/Flyweight/Flyweight.py | Python/Flyweight/Flyweight.py | Python | 0.000005 | @@ -0,0 +1,763 @@
+#! /usr/bin/python%0A# -*- coding: utf-8 -*-%0A'''%0AFlyweight Pattern%0AAuthor: Kei Nakata%0AData: Oct.14.2014%0A'''%0A%0Aclass FlyweightFactory(object):%0A def __init__(self):%0A self.instances = dict()%0A%0A def getInstance(self, a, b):%0A if (a, b) not in self.instances:%0A ... | |
868a771e0ba049edd55ddf38db852c4d34824297 | Add pod env tests | tests/test_spawner/test_pod_environment.py | tests/test_spawner/test_pod_environment.py | Python | 0 | @@ -0,0 +1,1140 @@
+from unittest import TestCase%0A%0Afrom scheduler.spawners.templates.pod_environment import (%0A get_affinity,%0A get_node_selector,%0A get_tolerations%0A)%0A%0A%0Aclass TestPodEnvironment(TestCase):%0A def test_pod_affinity(self):%0A assert get_affinity(None, None) is None%0A ... | |
9ea17a6d3eb5f9af246be964651f5bef522f2d95 | Map out the TrustChain data structure | src/trustchain.py | src/trustchain.py | Python | 0.999389 | @@ -0,0 +1,1915 @@
+class TrustChain:%0A %22%22%22%0A Node maintains one TrustChain object and interacts with it either in in the reactor process or some other process.%0A If it's the latter, there needs to be some communication mechanism.%0A%0A type System = Map%3CNode, Chain%3E;%0A%0A // height (sequen... | |
1c1e933fa9c6af1aa9d73f276ac7b79c2b86bdc3 | add svn-clean-external-file.py | scripts/svn-clean-external-file.py | scripts/svn-clean-external-file.py | Python | 0.000002 | @@ -0,0 +1,685 @@
+# written by Thomas Watnedal%0A# http://stackoverflow.com/questions/239340/automatically-remove-subversion-unversioned-files%0A%0Aimport os%0Aimport re%0A%0Adef removeall(path):%0A if not os.path.isdir(path):%0A os.remove(path)%0A return%0A files=os.listdir(path)%0A for x in fi... | |
3ef1e39d476a8b3e41ff0b06dcd6f700c083682d | Add an ABC for all sub classes of `DataController` | data_controller/abc.py | data_controller/abc.py | Python | 0.000003 | @@ -0,0 +1,3129 @@
+from typing import Dict, Optional%0A%0Afrom data_controller.enums import Medium, Site%0Afrom utils.helpers import await_func%0A%0A%0Aclass DataController:%0A %22%22%22%0A An ABC for all classes that deals with database read write.%0A %22%22%22%0A __slots__ = ()%0A%0A def get_identifie... | |
2ce67897ade1ce8ae8b0fd00671fe61f4164a2bc | Add missing migration | oidc_apis/migrations/0002_add_multiselect_field_ad_groups_option.py | oidc_apis/migrations/0002_add_multiselect_field_ad_groups_option.py | Python | 0.0002 | @@ -0,0 +1,771 @@
+# Generated by Django 2.0.9 on 2018-10-15 08:08%0A%0Afrom django.db import migrations%0Aimport multiselectfield.db.fields%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('oidc_apis', '0001_initial'),%0A %5D%0A%0A operations = %5B%0A migrations.AlterF... | |
785a5767ee3482fddee37327b4bf3edeed94ff46 | Add shootout attempt item definition | db/shootout_attempt.py | db/shootout_attempt.py | Python | 0 | @@ -0,0 +1,1885 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport uuid%0A%0Afrom db.common import Base%0Afrom db.specific_event import SpecificEvent%0Afrom db.player import Player%0Afrom db.team import Team%0A%0A%0Aclass ShootoutAttempt(Base, SpecificEvent):%0A __tablename__ = 'shootout_attempts'%0A ... | |
1dcf698a286dcdf0f2c5a70d3e9bb2b32d046604 | add TestBEvents, currently skipped | tests/unit/Events/test_BEvents.py | tests/unit/Events/test_BEvents.py | Python | 0 | @@ -0,0 +1,1617 @@
+from AlphaTwirl.Events import BEvents as Events%0Afrom AlphaTwirl.Events import Branch%0Aimport unittest%0Aimport ROOT%0A%0A##____________________________________________________________________________%7C%7C%0AinputPath = '/Users/sakuma/work/cms/c150130_RA1_data/c150130_01_PHYS14/20150331_SingleMu/... | |
adf65027521124ea89e9c6c5ee2baf7366b2da46 | Add example settings file for makam extractors | compmusic/extractors/makam/settings.example.py | compmusic/extractors/makam/settings.example.py | Python | 0 | @@ -0,0 +1,29 @@
+token = %22%22 # Dunya API Token%0A
| |
9722bc3fc0a3cf8c95e91571b4b085e07e5a124c | Create 6kyu_message_from_aliens.py | Solutions/6kyu/6kyu_message_from_aliens.py | Solutions/6kyu/6kyu_message_from_aliens.py | Python | 0.000027 | @@ -0,0 +1,626 @@
+import re%0Afrom collections import Counter%0A%0Ad=%7B%0A'%7C-%7C':'h',%0A'%5B-':'e',%0A'()':'o',%0A'3%5D':'b',%0A'_%7C':'l',%0A'%7C':'i',%0A'%5E%7C':'p',%0A'/%60':'y',%0A')(':'o',%0A'?/':'r',%0A'%5C/':'a',%0A'%7C%5C%7C':'n',%0A'%3C/':'k',%0A'~%7C~':'t',%0A'=/':'f',%0A')%7C':'d',%0A'%7C_%7C':'u',%0A'... | |
125c75ea246c2d95f0addbb31b2d82dde588f21d | Add a unit test for KaggleKernelCredentials. | tests/test_kaggle_kernel_credentials.py | tests/test_kaggle_kernel_credentials.py | Python | 0 | @@ -0,0 +1,293 @@
+import unittest%0A%0Afrom kaggle_secrets import GcpTarget%0Afrom kaggle_gcp import KaggleKernelCredentials%0A%0Aclass TestKaggleKernelCredentials(unittest.TestCase):%0A%0A def test_default_target(self):%0A creds = KaggleKernelCredentials()%0A self.assertEqual(GcpTarget.BIGQUERY, cred... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.