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 |
|---|---|---|---|---|---|---|---|
4d47d14e2f630652c36765abf5907d6800a8012d | Revert "Revert "Initial python to find public APIs in Hadoop and compare them to outp…"" (#73) (cherry picked from commit a24236206b35744835781d42ff1dededbc685721) | bigtop-tests/spec-tests/runtime/src/test/python/find-public-apis.py | bigtop-tests/spec-tests/runtime/src/test/python/find-public-apis.py | Python | 0 | @@ -0,0 +1,2606 @@
+#!/usr/bin/python%0A%0A'''%0ALicensed to the Apache Software Foundation (ASF) under one%0Aor more contributor license agreements. See the NOTICE file%0Adistributed with this work for additional information%0Aregarding copyright ownership. The ASF licenses this file%0Ato you under the Apache Licens... | |
e63d18f9ef70e7a42344cf13322676efa2226fa2 | Create largest_rectangle_in_histogram.py | largest_rectangle_in_histogram.py | largest_rectangle_in_histogram.py | Python | 0.001693 | @@ -0,0 +1,1345 @@
+%22%22%22%0Ahttps://www.youtube.com/watch?v=VNbkzsnllsU%0A%22%22%22%0A%0A%0Adef largest_rectangle_in_histogram(histogram):%0A %22Return area of largest rectangle under histogram.%22%0A assert all(height %3E= 0 for height in histogram)%0A%0A # Use stacks to keep track of how long a rectangle... | |
f2854aff3dde6439d990f8fd7d69e70dd4664b93 | Add tags app admin | opps/core/tags/admin.py | opps/core/tags/admin.py | Python | 0.000001 | @@ -0,0 +1,368 @@
+# -*- encoding: utf-8 -*-%0Afrom django.contrib import admin%0A%0Afrom .models import Tag%0A%0A%0Aclass TagAdmin(admin.ModelAdmin):%0A list_display = ('name', 'date_insert')%0A search_fields = ('name',)%0A prepopulated_fields = %7B%22slug%22: %5B%22name%22%5D%7D%0A%0A fieldsets = %5B(None... | |
c3d37914777ee9e2356bfa691361351423b0615a | make a nova server instance return it's host's hostname | heat/network_aware_resources.py | heat/network_aware_resources.py | Python | 0.000015 | @@ -0,0 +1,600 @@
+from heat.engine.resources.openstack.nova.server import Server as NovaServer%0A%0Afrom oslo_log import log as logging%0Aimport traceback%0A%0ALOG = logging.getLogger(__name__)%0A%0A%0Aclass NetworkAwareServer(NovaServer):%0A OS_EXT_HOST_KEY = 'OS-EXT-SRV-ATTR:host'%0A%0A def get_attribute(self,... | |
8dd9578cb70e4a628e0abef1da613f32f864a343 | version bump | taca/__init__.py | taca/__init__.py | """ Main TACA module
"""
__version__ = '0.6.11.0'
| Python | 0.000001 | @@ -39,13 +39,13 @@
= '0.6.1
-1
+2
.0'%0A
|
425363751244d5ff75e61126fd1481094c941129 | Create luhn.py for pypi package | luhn/luhn.py | luhn/luhn.py | Python | 0 | @@ -0,0 +1,3044 @@
+#!/usr/bin/env python3%0A%0A# Python 3.4 Implementation of the Luhn Algorithm%0A# Checks to see if 14, 15 or 16 digit account number is Luhn Compliant. %0A# See https://en.wikipedia.org/wiki/Luhn_algorithm for formula details. %0A# This file is suitable for unittest testing%0A# CardNumber is an ac... | |
be271f41103efdc26aadbc2cf3e39446bf2a05bc | Define Application class. | taxe/__init__.py | taxe/__init__.py | Python | 0 | @@ -0,0 +1,620 @@
+# -*- coding: utf-8 -*-%0A%0Afrom functools import wraps%0Afrom werkzeug.wrappers import Request, Response%0A%0Aclass Application(object):%0A%0A def route(self, url):%0A def deco(function):%0A @wraps(function)%0A def _(*args, **kwargs):%0A print self, ur... | |
d0c7dfad3e7769b6f89828733414a4a68677696a | Create UnorderedList.py | Python/GenPythonProblems/UnorderedList.py | Python/GenPythonProblems/UnorderedList.py | Python | 0 | @@ -0,0 +1,1959 @@
+## http://interactivepython.org/runestone/static/pythonds/BasicDS/ImplementinganUnorderedListLinkedLists.html%0Aclass Node:%0A def __init__(self,initdata):%0A self.data = initdata%0A self.next = None%0A%0A def getData(self):%0A return self.data%0A%0A def getNext(self):%... | |
6ac4db0b9bfc638d708fd7341b0f3e1437ce8f97 | add dir cmmbbo to hold code for docker scheduler | cmbbo/main.py | cmbbo/main.py | Python | 0 | @@ -0,0 +1,15 @@
+#coding: utf-8%0A
| |
4f06672cb18673941f625987b51b9fabe57ea8ac | find kth smallest | Python/search/find_kthsmallest.py | Python/search/find_kthsmallest.py | Python | 0.999975 | @@ -0,0 +1,399 @@
+'''%0AFind the kth smallest element in an unsorted array%0A'''%0Aimport heapq%0Adef kth_smallest(arr, k):%0A%0A # O(n) complexity%0A heapq.heapify(arr)%0A%0A # k*log(n)%0A for _ in range(k-1):%0A # log(n)%0A heapq.heappop(arr)%0A return heapq.heappop(arr)%0A%0A%0Aassert k... | |
4ab45fc2dee8676566467706c0a433315c8fe3c8 | Add test | skbio/util/tests/test_testing.py | skbio/util/tests/test_testing.py | Python | 0 | @@ -0,0 +1,675 @@
+# ----------------------------------------------------------------------------%0A# Copyright (c) 2013--, scikit-bio development team.%0A#%0A# Distributed under the terms of the Modified BSD License.%0A#%0A# The full license is in the file COPYING.txt, distributed with this software.%0A# -------------... | |
ce3a5186c8522cb0e8a2f3aa5e843846bb7f4e27 | Remove whitespace from the beginning and the end of the string | techgig_strip.py | techgig_strip.py | Python | 0.999807 | @@ -0,0 +1,57 @@
+def main():%0A a=raw_input()%0A print a.strip()%0Amain()%0A
| |
ac85219bec0eea5619ebec802e74382399b0f87c | Add a VERY simple redis returner | salt/returners/redis.py | salt/returners/redis.py | Python | 0.00003 | @@ -0,0 +1,573 @@
+'''%0AReturn data to a redis server%0AThis is a VERY simple example for pushing data to a redis server and is not%0Anessisarily intended as a usable interface.%0A'''%0A%0Aimport redis%0A%0A__opts__ = %7B%0A 'redis.host': 'mcp',%0A 'redis.port': 6379,%0A 'redis.db': '0... | |
dfdaac63df7e4d8b381215fafd1f88c2af4781f2 | Update __openerp__.py | sale_product_variants_types/__openerp__.py | sale_product_variants_types/__openerp__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the... | Python | 0.000024 | @@ -1377,16 +1377,19 @@
bute is
+of
range ty
|
96bbf25be25482a7edfd92ec9b956b0bbeab39c4 | Add a basic summary query implementation | src/traffic/__init__.py | src/traffic/__init__.py | Python | 0.003632 | @@ -0,0 +1,1834 @@
+from datetime import datetime%0Aimport zmq%0A%0Afrom messages import common_pb2, replies_pb2, requests_pb2%0A%0A%0Aclass Connection(object):%0A def __init__(self, uri, context=None):%0A self._uri = uri%0A if context is None:%0A context = zmq.Context()%0A self._cont... | |
4060a7d2c9ec0b6701d36184fe3e2bad71744730 | Fix --verbose bug | vint/__init__.py | vint/__init__.py | import sys
from argparse import ArgumentParser
import pkg_resources
import logging
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.l... | Python | 0.000002 | @@ -1643,24 +1643,71 @@
'cmdargs'%5D%0A%0A
+ is_verbose = cmdargs.get('verbose', False)%0A
log_leve
@@ -1731,28 +1731,18 @@
if
-'
+is_
verbose
-' in cmdargs
els
|
cdee6a6a568576a2afbf72014c3cc0eb6b5d2afe | Make sure feed and exec info doesn't get added to webui log records that are created while a feed is executing. | flexget/logger.py | flexget/logger.py | import logging
import logging.handlers
import re
class FlexGetLogger(logging.Logger):
"""Custom logger that adds feed and execution info to log records."""
execution = ''
feed = ''
def makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None):
extra = {'fee... | Python | 0.000002 | @@ -45,16 +45,34 @@
ort re%0D%0A
+import threading%0D%0A
%0D%0A%0D%0Aclas
@@ -188,37 +188,33 @@
-execution = ''%0D%0A feed = ''
+local = threading.local()
%0D%0A%0D%0A
@@ -331,16 +331,24 @@
'feed':
+getattr(
FlexGetL
@@ -353,20 +353,34 @@
tLogger.
-feed
+local, 'feed', '')
,%0D%0A
@@ -404,16 +404,... |
e9f88f1c43189fe429730c488f4514bf78edea4e | Add python -m mistune cli | mistune/__main__.py | mistune/__main__.py | Python | 0.000003 | @@ -0,0 +1,2338 @@
+import sys%0Aimport argparse%0Afrom . import (%0A create_markdown,%0A __version__ as version%0A)%0A%0A%0Adef _md(args):%0A if args.plugin:%0A plugins = args.plugin%0A else:%0A # default plugins%0A plugins = %5B'strikethrough', 'footnotes', 'table', 'speedup'%5D%0A ... | |
4af4d5d293d057bd12454200e7a1a72679c218a5 | Create zipatoconnection.py | src/zipatoconnection.py | src/zipatoconnection.py | Python | 0.000004 | @@ -0,0 +1,492 @@
+import requests%0A%0Aclass ZipatoConnection(Settings):%0A%0A __init__(self, serial):%0A %22%22%22%0A Initializes a ZipatoConnection.%0A %0A :param str serial: Zipato Box serial.%0A %0A %22%22%22%0A self.serial = serial%0A %0A def set_sensor_status(sel... | |
d0e2daf892de6b35ba90926f446c70ec3079f468 | Update version. | __init__.py | __init__.py | # -*- coding: utf-8 -*-
"""Kernel of Pyslvs.
This kernel can work without GUI.
Modules:
+ Solver:
+ parser
+ tinycadlib
+ Sketch Solve solver
+ triangulation
+ Number synthesis:
+ number
+ Structure Synthesis:
+ atlas
+ Dimensional synthesis:
+ planarlinkage
+ rga
+ firefly
... | Python | 0 | @@ -539,22 +539,18 @@
19,
-3
+4
, 0, '
-release
+dev
')%0A_
|
3e345bc4a17cf53c40ef51cd2ae1732744be7e60 | Add custom form for editing and updating of decks | cardbox/deck_forms.py | cardbox/deck_forms.py | Python | 0 | @@ -0,0 +1,442 @@
+from django.forms import ModelForm%0Afrom django.forms.widgets import Textarea, TextInput%0Afrom deck_model import Deck%0A%0Aclass DeckForm(ModelForm):%0A %22%22%22The basic form for updating or editing decks%22%22%22%0A%0A class Meta:%0A model = Deck%0A fields = ('title', 'descri... | |
95d93518d664c9d8b095061bc854907c29f05623 | Add dummy keygen | tests/__init__.py | tests/__init__.py | Python | 0.000001 | @@ -0,0 +1,1941 @@
+from cryptography.hazmat.backends import default_backend%0Afrom cryptography.hazmat.primitives.asymmetric import rsa, padding%0Afrom cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, PublicFormat, BestAvailableEncryption%0Aimport os%0A%0Af4 = 65537%0A%0Aos.environ%5B'EQ_PU... | |
fa8b40b8ebc088f087ff76c36068fea67dae0824 | Add management command for updating genome coordinate names using Ensembl-INSDC mapping | rnacentral/portal/management/commands/update_coordinate_names.py | rnacentral/portal/management/commands/update_coordinate_names.py | Python | 0 | @@ -0,0 +1,1259 @@
+%22%22%22%0ACopyright %5B2009-2017%5D EMBL-European Bioinformatics Institute%0ALicensed under the Apache License, Version 2.0 (the %22License%22);%0Ayou may not use this file except in compliance with the License.%0AYou may obtain a copy of the License at%0A http://www.apache.org/licenses/LICENS... | |
6418807dbba9fb946ffeb05aee525c51c2e71f75 | Fix fixture, add doc string | tests/fixtures.py | tests/fixtures.py | Python | 0 | @@ -0,0 +1,344 @@
+%22%22%22Defines fixtures that can be used to streamline tests and / or define dependencies%22%22%22%0Afrom random import randint%0A%0Aimport pytest%0A%0Aimport hug%0A%0A%0A@pytest.fixture%0Adef hug_api():%0A %22%22%22Defines a dependency for and then includes a uniquely identified hug API for a s... | |
47c1dfd602281c56973de0d8afe64b923eb29592 | Add unit tests for env module. | test/test_env.py | test/test_env.py | Python | 0 | @@ -0,0 +1,735 @@
+from _ebcf_alexa import env%0Afrom unittest.mock import patch, call%0Aimport pytest%0A%0A%0A@pytest.yield_fixture%0Adef mock_now():%0A with patch.object(env, 'now') as now:%0A yield now%0A%0A%0A@patch('datetime.datetime')%0Adef test_now_is_utc(fake_datetime):%0A assert env.now()%0A as... | |
c727cee4dc579f5fe09b54877118a681a2597c47 | add tests for log module | test/test_log.py | test/test_log.py | Python | 0.000001 | @@ -0,0 +1,473 @@
+%22%22%22Test for custom logging functions.%22%22%22%0A%0Aimport logging%0A%0Afrom mapchete.log import user_process_logger, driver_logger%0A%0A%0Adef test_user_process_logger():%0A logger = user_process_logger(__name__)%0A assert isinstance(logger, logging.Logger)%0A assert logger.name == %2... | |
fc9e9b4b9bdee1bd1f6b112c90772702cf60ad2d | Add a unittest-based test suite for scenarios | test_converge.py | test_converge.py | Python | 0.999868 | @@ -0,0 +1,1697 @@
+#!/usr/bin/env python%0A%0Aimport functools%0Aimport logging%0Aimport unittest%0A%0Aimport converge%0Aimport converge.processes%0A%0Afrom converge.framework import datastore%0Afrom converge.framework import scenario%0A%0A%0Adef with_scenarios(TestCase):%0A loader = unittest.defaultTestLoader%0A%0... | |
6bd2371c1e48d7886e3515b7f2f95d0f7dbdf6c7 | Remove this one noisy debug statement. | fedmsg/utils.py | fedmsg/utils.py | # This file is part of fedmsg.
# Copyright (C) 2012 Red Hat, Inc.
#
# fedmsg is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#... | Python | 0.000001 | @@ -969,45 +969,8 @@
t%0A%0A%0A
-_log = logging.getLogger('fedmsg')%0A%0A%0A
def
@@ -3098,75 +3098,8 @@
tr:%0A
- _log.debug(%22Setting %25r %25r%22 %25 (const, config%5Bkey%5D))%0A
|
f65c6f3939c50326eea14bd0dadc77b7c9364dd2 | Add a module to deal with credentials | gssapi/creds.py | gssapi/creds.py | Python | 0 | @@ -0,0 +1,748 @@
+from __future__ import absolute_import%0A%0Afrom ctypes import cast, byref, c_char_p, c_void_p, string_at%0A%0Afrom .gssapi_h import (%0A GSS_C_NO_CREDENTIAL, GSS_C_NO_NAME, GSS_C_INDEFINITE, GSS_C_NO_OID_SET, GSS_C_BOTH,%0A GSS_S_COMPLETE,%0A OM_uint32, gss_cred_id_t,%0A gss_init_sec_con... | |
c88b95bd28b1ece65fc4631f73e95dac5b48f038 | Add new py-fixtures package (#14026) | var/spack/repos/builtin/packages/py-fixtures/package.py | var/spack/repos/builtin/packages/py-fixtures/package.py | Python | 0 | @@ -0,0 +1,604 @@
+# Copyright 2013-2019 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 PyFixtures(PythonPackage):%0A %22%22%22Fixtures, reusabl... | |
9692c1494e52238fdbc388ef5aba4ae551b46a88 | Create ohmycoins.py | ohmycoins.py | ohmycoins.py | Python | 0.000003 | @@ -0,0 +1,1161 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0Aimport requests%0Afrom bs4 import BeautifulSoup%0A%0A%0A#Put your Ether addresses here in the list%0Aaddresses = %5B%5D%0A%0A%0A#Etherscan%0Adef get_ether(address):%0A url = 'https://etherscan.io/address/' + address%0A r = requests.get(url)... | |
2ad504a1a40e08aea3105642821190f9b928fab7 | create tags package | tags/__init__.py | tags/__init__.py | Python | 0.000001 | @@ -0,0 +1,30 @@
+VERSION = (0, 1, 0, 'dev', 1)%0A
| |
a317e86e0faab308421588f649f6dd7ba65cd03b | Add rscommon/pickle_.py | rscommon/pickle_.py | rscommon/pickle_.py | Python | 0.000001 | @@ -0,0 +1,1022 @@
+##########################################%0D%0A# File: pickle_.py #%0D%0A# Copyright Richard Stebbing 2014. #%0D%0A# Distributed under the MIT License. #%0D%0A# (See accompany file LICENSE or copy at #%0D%0A# http://opensource.org/licenses/MIT) #%0D%0A############... | |
2a832e8a9a0881200756db5aa99650745c0ecc16 | rename to | tools/packing.py | tools/packing.py | #!/usr/bin/env python
import os
import shutil
import subprocess
from contextlib import contextmanager
@contextmanager
def pushd(path):
currentDir = os.getcwd()
os.chdir(path)
yield
os.chdir(currentDir)
def printInfo(message):
print os.path.basename(__file__) + ' >> ' + message
def installDependencies():
... | Python | 0.999995 | @@ -715,22 +715,21 @@
zipping
-deploy
+build
directo
@@ -773,22 +773,21 @@
'zip', '
-deploy
+build
')%0A pri
@@ -864,22 +864,21 @@
kedirs('
-deploy
+build
')%0A sou
@@ -966,14 +966,13 @@
), '
-deploy
+build
')%0A%0A
|
8e8c14446a0089ee7fa57cfd5520c7d6d6e2711e | Add Python user customization file. | usercustomize.py | usercustomize.py | Python | 0 | @@ -0,0 +1,450 @@
+%22%22%22 Customize Python Interpreter.%0A%0ALink your user customizing file to this file.%0A%0AFor more info see: https://docs.python.org/3/library/site.html%0A%0A%22Default value is ~/.local/lib/pythonX.Y/site-packages for UNIX and%0Anon-framework Mac OS X builds, ~/Library/Python/X.Y/lib/python/si... | |
ab2fdecf3fb34b999c3943d6445fca148763c025 | add debug info | jip/util.py | jip/util.py | #! /usr/bin/env jython
# Copyright (C) 2011 Sun Ning<classicning@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to... | Python | 0.000001 | @@ -2355,24 +2355,27 @@
b2.HTTPError
+, e
:%0A
@@ -2400,16 +2400,22 @@
ception(
+url, e
)%0A
@@ -2439,16 +2439,19 @@
URLError
+, e
:%0A
@@ -2480,16 +2480,22 @@
ception(
+url, e
)%0A%0Adef d
|
13be4749aef2415ab84ffbd090c5b24d8ed98af5 | Add test case of BloArticle class | tests/TestBloArticle.py | tests/TestBloArticle.py | Python | 0 | @@ -0,0 +1,640 @@
+import unittest%0Afrom blo.BloArticle import BloArticle%0A%0A%0Aclass TestBloArticle(unittest.TestCase):%0A def setUp(self):%0A self.blo_article = BloArticle()%0A%0A def test_failed_load_from_file(self):%0A file_path = %22%22%0A with self.assertRaises(FileNotFoundError):%0A... | |
4442fabf9292efa44a82f420e2d3e807d7d15b04 | Add more tests to cli | tests/test_cli.py | tests/test_cli.py | Python | 0 | @@ -0,0 +1,2175 @@
+from click.testing import CliRunner%0Afrom tinydb import TinyDB, where%0Afrom tinydb.storages import MemoryStorage%0Aimport pytest%0Atry:%0A import mock%0Aexcept ImportError:%0A from unittest import mock%0A%0Afrom passpie import cli%0A%0A%0A@pytest.fixture%0Adef mock_db(mocker):%0A credenti... | |
b2e10a344a940ae2cce9656c435c7a6f4919a53b | add cli invoke tests | tests/test_cli.py | tests/test_cli.py | Python | 0.000001 | @@ -0,0 +1,274 @@
+%0Aimport pytest%0Afrom click.testing import CliRunner%0A%0Aimport bgpfu.cli%0A%0A%0Adef test_cli_invoke():%0A runner = CliRunner()%0A res = runner.invoke(bgpfu.cli.cli, %5B'as_set'%5D)%0A res = runner.invoke(bgpfu.cli.cli, %5B'prefixlist'%5D)%0A res = runner.invoke(bgpfu.cli.cli, %5B'raw... | |
943b12735f891c87ff62796195e562a7522d3486 | Improve search algorithm for GAE SDK in depot_tools integration tests. | tests/local_rietveld.py | tests/local_rietveld.py | #!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Setups a local Rietveld instance to test against a live server for
integration tests.
It makes sure Google AppEngine SDK is fou... | Python | 0.000002 | @@ -1278,43 +1278,158 @@
- self.base_dir = os.path.realpath(
+# TODO(maruel): This should be in /tmp but that would mean having to fetch%0A # everytime. This test is already annoyingly slow.%0A self.rietveld =
os.p
@@ -1453,20 +1453,26 @@
e_dir, '
-..')
+_rietveld'
)%0A se
@@ -1478,43 +1478,233 @@
... |
a753b26dc3564515a3368c3bd6ecbbf8bb8dc589 | Add TODO | tests/test_migration.py | tests/test_migration.py | import unittest
from nose.tools import * # PEP8 asserts
from modularodm import StoredObject, fields, exceptions
from tests.base import ModularOdmTestCase
class TestMigration(ModularOdmTestCase):
def define_objects(self):
# Use a single storage object for both schema versions
self._storage = sel... | Python | 0.000002 | @@ -3059,32 +3059,105 @@
es_error(self):%0A
+ # TODO: This test raises a warning for setting a non-field value%0A
class V3
|
c659f31cfb3eadd66838036ea285070f564fdced | Add rendering test | tests/test_rendering.py | tests/test_rendering.py | Python | 0.000001 | @@ -0,0 +1,580 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import absolute_import, unicode_literals%0Aimport pytest%0A%0Afrom PIL.Image import Image%0Afrom psd_tools.user_api.psd_image import PSDImage, merge_layers%0Afrom tests.utils import decode_psd, full_name%0A%0A%0ACLIP_FILES = %5B%0A ('clipping-mask.psd',),%... | |
436719050ada475d840004a49c693d08c3f92034 | Add a widget for line editors. | greatbigcrane/project/widgets.py | greatbigcrane/project/widgets.py | Python | 0 | @@ -0,0 +1,622 @@
+from django.forms.widgets import Textarea%0Afrom django.utils.safestring import mark_safe%0A%0Aclass LineEditorWidget(Textarea):%0A class Media:%0A js = ('js/jquery-1.4.2.min.js' ,'js/jquery.lineeditor.js')%0A%0A def render(self, name, value, attrs=None):%0A if isinstance(value,li... | |
52d03e19bd61dcba56d1d7fc3944afcc6d9b6a8d | make nautilus use backspace for back | .local/share/nautilus-python/extensions/BackspaceBack.py | .local/share/nautilus-python/extensions/BackspaceBack.py | Python | 0.00001 | @@ -0,0 +1,605 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A#%0A# by Ricardo Lenz, 2016-jun%0A# riclc@hotmail.com%0A#%0A%0Aimport os, gi%0Agi.require_version('Nautilus', '3.0')%0Afrom gi.repository import GObject, Nautilus, Gtk, Gio, GLib%0A%0Adef ok():%0A app = Gtk.Application.get_default()%0A app.set_a... | |
e778f67101a9ba8e38e249263d49738d3239f557 | test select prefix cursor | test_p_cursor.py | test_p_cursor.py | Python | 0.000001 | @@ -0,0 +1,1370 @@
+%0Aimport sys%0A%0Asys.path.append('./build/lib.linux-x86_64-2.7/')%0A%0Afrom voidptr import VoidPtr as vp%0Aimport spapi as sp%0A%0Aenv = vp(%22env%22)%0Actl = vp(%22ctl%22)%0Adb = vp(%22db%22)%0Ao = vp(%22o%22)%0At = vp(%22t%22)%0A%0Aprint %22env%22, sp.env(env)%0Aprint %22env,ctl%22, sp.ctl(env,... | |
2a1777a74d6f2cba61485f281f0c048cbbdca727 | Add valgrind tests file. | test_valgrind.py | test_valgrind.py | Python | 0 | @@ -0,0 +1,990 @@
+%0Afrom __future__ import print_function%0A%0Aimport shutil%0Aimport os%0A%0Afrom model_test_helper import ModelTestHelper%0A%0Atests = %7B'om_360x300-valgrind' : ('om'),%0A 'cm_360x300-valgrind' : ('cm')%7D%0A%0Aclass TestValgrind(ModelTestHelper):%0A %22%22%22%0A Run the model in valg... | |
f9273e7b905bdc94f3e161b17225a11120810b26 | handle core serice by self-defined-class | google_service.py | google_service.py | Python | 0 | @@ -0,0 +1,1742 @@
+import httplib2%0Aimport os%0A%0Aimport oauth2client%0Afrom apiclient import discovery%0Afrom oauth2client import client, tools%0A%0Atry:%0A import argparse%0A flags = argparse.ArgumentParser(parents=%5Btools.argparser%5D).parse_args()%0Aexcept ImportError:%0A flags = None%0A%0A%0Aclass Goo... | |
556530f4933b1323ef8e4414c324a0aa2d0b81bd | Add the example bundles. | tests/example.py | tests/example.py | Python | 0 | @@ -0,0 +1,2111 @@
+# This file is part of the Juju GUI, which lets users view and manage Juju%0A# environments within a graphical interface (https://launchpad.net/juju-gui).%0A# Copyright (C) 2013 Canonical Ltd.%0A#%0A# This program is free software: you can redistribute it and/or modify it under%0A# the terms of the ... | |
1dec974693222864537b20b31ac33656bea92912 | add LogFactory | py3utils/_log.py | py3utils/_log.py | Python | 0.000001 | @@ -0,0 +1,551 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A#%0A# date: 2018/4/15%0A# author: he.zhiming%0A#%0A%0Afrom __future__ import unicode_literals, absolute_import%0A%0Aimport logging%0Aimport logging.config%0Afrom logging import handlers%0A%0A%0Aclass LogFactory:%0A _LOG_CONFIG_DICT = %7... | |
6f9d02510ad861bf8ae5ad8f1ae335a4e565756d | Add initial unit tests for io module | tests/test_io.py | tests/test_io.py | Python | 0 | @@ -0,0 +1,670 @@
+from unittest.mock import MagicMock, patch%0A%0Aimport pytest%0A%0Afrom isort import io%0A%0A%0Aclass TestFile:%0A def test_read(self, tmpdir):%0A test_file_content = %22%22%22# -*- encoding: ascii -*-%0A%0Aimport %E2%98%BA%0A%22%22%22%0A test_file = tmpdir.join(%22file.py%22)%0A ... | |
b48c5c0beb07039bdd0cef3bd0973d29e5b8254d | Fix Entry. | sugar/graphics/entry.py | sugar/graphics/entry.py | # Copyright (C) 2007, One Laptop Per Child
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is ... | Python | 0 | @@ -2507,16 +2507,20 @@
e_entry(
+self
):%0A
|
d94260f0be472d2c163e9ae57aacc25a8e9f2519 | Package contrib | t5x/contrib/__init__.py | t5x/contrib/__init__.py | Python | 0 | @@ -0,0 +1,648 @@
+# Copyright 2022 The T5X Authors.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required... | |
0f32a1e193a0064e5d5313cdc205d15cea71f1e7 | Test for a long hippo scrolling view. | tests/graphics/hipposcalability.py | tests/graphics/hipposcalability.py | Python | 0 | @@ -0,0 +1,925 @@
+import hippo%0Aimport gtk%0Aimport gobject%0A%0Afrom sugar.graphics.icon import CanvasIcon%0Afrom sugar.graphics.roundbox import CanvasRoundBox%0A%0Aimport common%0A%0Atest = common.Test()%0A%0Acanvas = hippo.Canvas()%0Atest.pack_start(canvas)%0Acanvas.show()%0A%0Ascrollbars = hippo.CanvasScrollbars(... | |
f0204e3061b110028fde5312fdb7b613e361b16e | Create output.py | trendpy/output.py | trendpy/output.py | Python | 0.000295 | @@ -0,0 +1,1148 @@
+# -*- coding: utf-8 -*-%0A%0A# output.py%0A%0A# MIT License%0A%0A# Copyright (c) 2017 Rene Jean Corneille%0A%0A# Permission is hereby granted, free of charge, to any person obtaining a copy%0A# of this software and associated documentation files (the %22Software%22), to deal%0A# in the Software with... | |
277b12fdd5af885466fd3ff6f8ccfd47555fbabe | Fix `RedisQuotaTest.test_uses_defined_quotas`. | tests/sentry/quotas/redis/tests.py | tests/sentry/quotas/redis/tests.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import mock
from redis.client import (
Script,
StrictRedis,
)
from exam import fixture, patcher
from sentry.quotas.redis import (
IS_RATE_LIMITED_SCRIPT,
RedisQuota,
)
from sentry.testutils import TestCase
def test_is_rate_limited_scri... | Python | 0 | @@ -2295,12 +2295,20 @@
ect.
-team
+organization
), 3
|
a78fe01101de6143885f2559a519024a86d97315 | Add new command dev_guess_downloader. | allmychanges/management/commands/dev_guess_downloader.py | allmychanges/management/commands/dev_guess_downloader.py | Python | 0 | @@ -0,0 +1,383 @@
+# coding: utf-8%0Afrom django.core.management.base import BaseCommand%0Afrom twiggy_goodies.django import LogMixin%0A%0Afrom allmychanges.downloader import guess_downloader%0A%0A%0Aclass Command(LogMixin, BaseCommand):%0A help = u%22%22%22Command to test how downloader guesser workds for given url... | |
c5dbebe13e2c1c7018a1701e3c8e37ae29f9a387 | add solution for Reverse Integer | src/reverseInteger.py | src/reverseInteger.py | Python | 0.000018 | @@ -0,0 +1,412 @@
+class Solution:%0A # @return an integer%0A%0A def reverse(self, x):%0A int_max = 2147483647%0A limit = int_max/10%0A if x %3E 0:%0A sig = 1%0A elif x %3C 0:%0A sig = -1%0A x = -x%0A else:%0A return x%0A y = 0%... | |
6f3ae8a9e8a400b8882cf57fa0753c1c44b85c2a | Create pdf_all.py | pdf_all.py | pdf_all.py | Python | 0 | @@ -0,0 +1,740 @@
+#!/usr/bin/env python%0A# encoding:UTF-8%0A%22%22%22%0AThis script runs a file through all of the PDF tools%0A%22%22%22%0A%0Aimport sys%0A%0Aimport pdf_js%0Aimport pdf_links%0Aimport pdf_strings%0Aimport pdf_openaction%0A%0A%0Adef run_all(fpath):%0A print %22*%22*20 + %22PDF OpenAction%22 + %22*%... | |
288a59cfeade739260a1f76cf632d735677022be | Add the start of some test for the scoring stuff. | src/test_scores_db.py | src/test_scores_db.py | Python | 0.999996 | @@ -0,0 +1,397 @@
+import scores_db%0Aimport mock%0Aimport redis_client%0Aimport control%0Afrom twisted.internet import defer%0A%0Adef test_set_scores():%0A fake_connection = mock.Mock()%0A fake_connection.set = mock.Mock()%0A with mock.patch('redis_client.connection', fake_connection):%0A scores_db.sco... | |
a0e4ba8dbdd14f51d17d2fb1c4e0829894d7cd10 | Add utility file for playbook | src/utils/playbook.py | src/utils/playbook.py | Python | 0.000001 | @@ -0,0 +1,327 @@
+from django.conf import settings%0Afrom ansible.models import Playbook%0Aimport os%0A%0A%0Adef content_loader(pk, slug):%0A playbook = Playbook.query_set.get(pk=pk)%0A playbook_dir = playbook.directory%0A # TODO: for now assume without validation%0A playbook_file = os.path.join(playbook_d... | |
41bed7865c9002086f5599059700ed8599c8c7ef | Copy of existing (manual) https debug tool | Sketches/MPS/ProxyHTTP/https.py | Sketches/MPS/ProxyHTTP/https.py | Python | 0 | @@ -0,0 +1,2207 @@
+#!/usr/bin/python%0A# -*- coding: utf-8 -*-%0A%0A# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)%0A#%0A# (1) Kamaelia Contributors are listed in the AUTHORS file and at%0A# http://www.kamaelia.org/AUTHORS - please extend this file,%0A# not this notice.%0A#%0A# ... | |
4fd051fd6d048e64f574097a3ca314111087ee45 | Fix up conv models to match current master. | theanets/convolution.py | theanets/convolution.py | # -*- coding: utf-8 -*-
'''This module contains convolution network structures.'''
from . import feedforward
class Regressor(feedforward.Regressor):
'''A regressor attempts to produce a target output.
A convolutional regression model takes the following inputs during training:
- ``x``: A three-dimensi... | Python | 0 | @@ -205,1030 +205,93 @@
put.
+'''
%0A%0A
-A convolutional regression model takes the following inputs during training:%0A%0A - %60%60x%60%60: A three-dimensional array of input data. Each element of axis 0 of%0A %60%60x%60%60 is expected to be one moment in time. Each element of axis 1 of%0A %60%60x%... |
1dc795fcf3e6c09a9a77fb008ee3b5fe5c7c3719 | fix bug 1035957 - correct received_at column | alembic/versions/391e42da94dd_bug_1035957_use_literal_now_for_.py | alembic/versions/391e42da94dd_bug_1035957_use_literal_now_for_.py | Python | 0 | @@ -0,0 +1,782 @@
+%22%22%22bug 1035957 - use literal NOW() for received_at, do not evaluate at migration time%0A%0A%0ARevision ID: 391e42da94dd%0ARevises: 495bf3fcdb63%0ACreate Date: 2014-07-08 10:55:04.115932%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '391e42da94dd'%0Adown_revision = '4... | |
05ce8407af2075ebcc002583b4224659d19dc9db | Add unit tests for spack help command (#6779) | lib/spack/spack/test/cmd/help.py | lib/spack/spack/test/cmd/help.py | Python | 0 | @@ -0,0 +1,2759 @@
+##############################################################################%0A# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
3590a162363ff62859eccf9f7f46c74f2c5cadc4 | Create PAKvsIND.py | PAKvsIND.py | PAKvsIND.py | Python | 0 | @@ -0,0 +1,2098 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Tue Jun 20 01:56:57 2017%0A%0A@author: Muhammad Salek Ali%0A%22%22%22%0A%0A# 1- Importing libraries for twitter and NLP%0A#--------------------------------------------%0Aimport numpy as np%0Aimport tweepy%0Afrom textblob import TextBlob%0A%0A%0A# 2- A... | |
3b82f7ada9e80eb581cf924dbf7b0490f864b264 | break at 500 | 012_highly_divisible_triangular_number.py | 012_highly_divisible_triangular_number.py | Python | 0.000005 | @@ -0,0 +1,581 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A#%0A# A Solution to %22Highly divisible triangular number%22 %E2%80%93 Project Euler Problem No. 12%0A# by Florian Buetow%0A#%0A# Sourcecode: https://github.com/fbcom/project-euler%0A# Problem statement: https://projecteuler.net/problem=12%0A#%0A%0Ai ... | |
f31dd0c7f23273207eab5e30a3ea42b5edf30f2b | work in progress, script to balance PTR records | mnm-balance-reversezones.py | mnm-balance-reversezones.py | Python | 0 | @@ -0,0 +1,2923 @@
+#!/usr/bin/env python3%0A# Copyright (C) 2013 Men & Mice%0A#%0A# Permission to use, copy, modify, and/or distribute this software for any%0A# purpose with or without fee is hereby granted, provided that the above%0A# copyright notice and this permission notice appear in all copies.%0A#%0A# THE SOFTW... | |
2187ae0b6303ae1745749b270c5c46937d8dde33 | Create mexican_wave.py | mexican_wave.py | mexican_wave.py | Python | 0.998674 | @@ -0,0 +1,255 @@
+#Kunal Gautam%0A#Codewars : @Kunalpod%0A#Problem name: Mexican Wave%0A#Problem level: 6 kyu%0A%0Adef wave(str):%0A li=%5B%5D%0A for i in range(len(str)):%0A x=list(str)%0A x%5Bi%5D=x%5Bi%5D.upper()%0A li.append(''.join(x))%0A return %5Bx for x in li if x!=str%5D%0A
| |
fdc40675eabaeee191fa3a047705b677d431f58c | Create a small form class to facilitate easy use of Djangos CSRF functionality | src/whitelist/util/apply_whitelist_form.py | src/whitelist/util/apply_whitelist_form.py | Python | 0 | @@ -0,0 +1,198 @@
+from django import forms%0A%0Aclass ApplyWhitelistForm(forms.Form):%0A %22%22%22A small placeholder form class to allow Django's form magic to take%0A hold of the %22apply whitelist%22 button.%0A %22%22%22%0A pass%0A
| |
252c0916e4db033c3aee81e232a64e649f6bc926 | add a command to trigger a bulk sync | crate_project/apps/crate/management/commands/trigger_bulk_sync.py | crate_project/apps/crate/management/commands/trigger_bulk_sync.py | Python | 0.000001 | @@ -0,0 +1,240 @@
+from django.core.management.base import BaseCommand%0A%0Afrom pypi.tasks import bulk_synchronize%0A%0A%0Aclass Command(BaseCommand):%0A%0A def handle(self, *args, **options):%0A bulk_synchronize.delay()%0A print %22Bulk Synchronize Triggered%22%0A
| |
457ba730a6541ab27ce8cbe06cbb6bfe246bba74 | Add a simple HTTP Basic Authentication decorator for the API | towel/api/decorators.py | towel/api/decorators.py | Python | 0 | @@ -0,0 +1,943 @@
+from functools import wraps%0Aimport httplib%0A%0Afrom django.contrib.auth import authenticate%0Afrom django.utils.cache import patch_vary_headers%0A%0A%0Adef http_basic_auth(func):%0A @wraps(func)%0A @vary_on_headers('Authorization')%0A def _decorator(request, *args, **kwargs):%0A if... | |
457937561f6a581edd495d7f9559f57b94108c24 | add really basic game implementation | haive/game.py | haive/game.py | Python | 0 | @@ -0,0 +1,1949 @@
+%0A# An interactive wrapper for the model%0A%0Afrom haive import model%0Afrom collections import namedtuple%0A%0Adef tuple_from_string(string):%0A return tuple(int(item) for item in string.split(','))%0A%0Ahuman = 'human'%0Aai = 'ai'%0Aplayer_types = (human, ai)%0A%0AMove = namedtuple('Move', ('t... | |
c8d441fbee372abc61867d594f0645d9d79a36f0 | add raw data parser script | parseRawData/parseRawXML.py | parseRawData/parseRawXML.py | Python | 0.000001 | @@ -0,0 +1,1402 @@
+#!/usr/bin/python%0A%0Aimport sys%0Aimport json%0A%0Afrom bs4 import BeautifulSoup%0A%0Aimport logging%0Alogging.basicConfig(format='%25(asctime)s - %25(name)s - %25(levelname)s - %25(message)s')%0Alogger = logging.getLogger(__name__)%0Alogger.setLevel(logging.DEBUG)%0A%0A%0A%0Adef extract_xml(mark... | |
e83dd0bfa4f601ed3c5ea9687d2781e83a2e6bf4 | Add logger | cpnest/logger.py | cpnest/logger.py | Python | 0.00002 | @@ -0,0 +1,1059 @@
+import logging%0A%0Adef start_logger(output=None, verbose=0):%0A %22%22%22%0A Start an instance of Logger for logging%0A%0A output : %60str%60%0A output directory (./)%0A%0A verbose: %60int%60%0A Verbosity, 0=CRITICAL, 1=WARNING, 2=INFO, 3=DEBUG%0A%0A fmt: %60str%60%0A ... | |
5fe88aa7d814bb630c29a7afcf511caba8c03ece | add placeholder | htdocs/c/c.py | htdocs/c/c.py | Python | 0 | @@ -0,0 +1,533 @@
+import os%0Aimport sys%0A%0Atilecachepath, wsgi_file = os.path.split(__file__)%0Asys.path.insert(0, %22/opt/iem/include/python/%22)%0Asys.path.insert(0, %22/opt/iem/include/python/TileCache/%22)%0A%0Afrom TileCache.Service import Service, wsgiHandler%0A%0Acfgfiles = os.path.join(tilecachepath, %22til... | |
4a1b7c7e1c6bd1df2d31e37a0cf97853faafb8e5 | Add BrowserScraper class | BrowserScraper.py | BrowserScraper.py | Python | 0 | @@ -0,0 +1,2523 @@
+import time%0Afrom selenium import webdriver%0Afrom selenium.common.exceptions import StaleElementReferenceException%0A%0A%0Aclass BrowserScraper():%0A def __init__(self, username, level, driver=None):%0A if driver is None:%0A self.driver = webdriver.Chrome('./chromedriver')%0A ... | |
c313a21274f4e77d0c4baad13c5c0f5781ac13ef | Create special-binary-string.py | Python/special-binary-string.py | Python/special-binary-string.py | Python | 0.999098 | @@ -0,0 +1,613 @@
+# Time: f(n) = kf(n/k) + n/k * klogk %3C= O(logn * nlogk) %3C= O(n%5E2)%0A# n is the length of S, k is the max number of special strings in each depth%0A# Space: O(n)%0A %0Aclass Solution(object):%0A def makeLargestSpecial(self, S):%0A %22%22%22%0A :type S: str%0A :... | |
63f3e2027948d98781bdd66a0341501facb4b46c | Add test file | image_test.py | image_test.py | Python | 0.000001 | @@ -0,0 +1,518 @@
+import unittest%0A%0Aclass TestStringMethods(unittest.TestCase):%0A%0A def test_upper(self):%0A self.assertEqual('foo'.upper(), 'FOO')%0A%0A def test_isupper(self):%0A self.assertTrue('FOO'.isupper())%0A self.assertFalse('Foo'.isupper())%0A%0A def test_split(self):%0A s = 'hell... | |
a4ca12fb7f3525206a9a921ab64e31bc145cc9d3 | Create __init__.py | __init__.py | __init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
102ad365089794d337820714ab281f99af0797b0 | update make_base_url | qiniu/auth_token.py | qiniu/auth_token.py | # -*- coding: utf-8 -*-
import json
import base64
import time
import rpc
import config
import urllib
import auth_digest
class PutPolicy(object):
scope = None # 可以是 bucketName 或者 bucketName:key
expires = 3600 # 默认是 3600 秒
callbackUrl = None
callbackBody = None
returnUrl = None
returnBody = N... | Python | 0.000001 | @@ -1646,39 +1646,32 @@
rn '
-'.join(%5B'http://',
+http://%25s/%25s' %25 (
domain,
- '/',
url
@@ -1684,11 +1684,10 @@
ote(key)
-%5D
)%0A
|
647e3b463d1b71ea1a3bd34d11e6a5855b4ea70d | Create __init__.py | __init__.py | __init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
988598d0385ce63d951b3cc0817392cf2271575c | change encoding to utf8 | __init__.py | __init__.py | Python | 0.999791 | @@ -0,0 +1,107 @@
+import sys %0A%0Aif not sys.getdefaultencoding()=='utf8':%0A reload(sys) %0A sys.setdefaultencoding('utf8') %0A
| |
51f91603952bc0063630425b582b874f2faea2dd | Change to 2x stddev | src/sentry/tasks/check_alerts.py | src/sentry/tasks/check_alerts.py | """
sentry.tasks.check_alerts
~~~~~~~~~~~~~~~~~~~~~~~~~
- Store a sorted set per project
- Each sorted set contains the number of events seen in the interval (1 minute)
- An additional set contains the number of unique events seen
- Every minute we iterate this sorted set (we can exploit the queue just like buffers ... | Python | 0.000015 | @@ -4028,16 +4028,20 @@
+ stddev
+ * 2
) / MINU
|
879032d31d8cf89df14489107015b7f29ace1490 | Solve designer door mat | python/designer-door-mat.py | python/designer-door-mat.py | Python | 0.999927 | @@ -0,0 +1,1708 @@
+# Size: 7 x 21%0A# ---------.%7C.---------%0A# ------.%7C..%7C..%7C.------%0A# ---.%7C..%7C..%7C..%7C..%7C.---%0A# -------WELCOME-------%0A# ---.%7C..%7C..%7C..%7C..%7C.---%0A# ------.%7C..%7C..%7C.------%0A# ---------.%7C.---------%0A%0A%0Aclass DoorMat:%0A%0A DASH = %22-%22%0A DOT = %22.%22%... | |
0b9926313831b8fd5c2e72cfc2559f7bdd1c2855 | Add class utils | nisl/_utils/class_helper.py | nisl/_utils/class_helper.py | Python | 0.000001 | @@ -0,0 +1,928 @@
+from sets import Set%0Aimport inspect%0A%0A%0Adef get_params(_class, _object, ignore=None):%0A%0A _ignore = Set(%5B'memory', 'memory_level', 'verbose', 'copy'%5D)%0A if ignore is not None:%0A _ignore.update(ignore)%0A%0A # params is a dictionary%0A params = _class.get_params(_objec... | |
f71d6b2fe05290ab976e3ba433185ec649a35c20 | Move get_context_from_function_and_args() to context.py | openstack/common/context.py | openstack/common/context.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... | Python | 0.000663 | @@ -899,16 +899,33 @@
e.%0A%22%22%22%0A%0A
+import itertools%0A
import u
@@ -2210,8 +2210,395 @@
context%0A
+%0A%0Adef get_context_from_function_and_args(function, args, kwargs):%0A %22%22%22Find an arg of type RequestContext and return it.%0A%0A This is useful in a couple of decorators where we don't%0A ... |
417e76de84f067a90fdcda93ee82d63cc7e56c7b | Add downloader.py | steamplog/downloader.py | steamplog/downloader.py | Python | 0 | @@ -0,0 +1,2095 @@
+from __future__ import print_function%0Aimport sys%0Aimport json%0Aimport urllib2%0A%0A%0Aclass Downloader(object):%0A '''Download data via Steam-API'''%0A def __init__(self, api_key):%0A self.API = api_key%0A%0A def download_stats(self, steam_id):%0A '''Download owned games f... | |
f9b8a92359e15883c5ee7b4dbc259001d59e379d | introduce bnip classes | BrainNetworksInPython/scripts/classes.py | BrainNetworksInPython/scripts/classes.py | Python | 0 | @@ -0,0 +1,3127 @@
+import numpy as np%0Aimport networkx as nx%0Aimport pandas as pd%0Aimport make_graphs as mkg%0Aimport graph_measures as gm%0A%0A%0Adef cascader(dict1, dict2, name):%0A return %7Bkey: value.update(%7Bname: dict2%5Bkey%5D%7D)%0A for key, value in dict1.items()%7D%0A%0A%0Aclass BrainNetwo... | |
cd9da9cf624a80acaebe92e075760ff8c2dbb7b1 | Add test_first_audit_catchup_during_ordering | plenum/test/audit_ledger/test_first_audit_catchup_during_ordering.py | plenum/test/audit_ledger/test_first_audit_catchup_during_ordering.py | Python | 0 | @@ -0,0 +1,2719 @@
+import pytest%0A%0Afrom plenum.test import waits%0Afrom plenum.common.constants import LEDGER_STATUS, DOMAIN_LEDGER_ID%0Afrom plenum.common.messages.node_messages import MessageReq, CatchupReq%0Afrom plenum.server.catchup.node_leecher_service import NodeLeecherService%0Afrom plenum.test.delayers imp... | |
af536ba048860001c2eea2ada1fb5861c9fdf578 | Fix migrations, historical models to not have any properties | django_auth_policy/migrations/0002_users_nullable.py | django_auth_policy/migrations/0002_users_nullable.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
from django.conf import settings
def fill_repr(apps, schema_editor):
LoginAttempt = apps.get_model("django_auth_policy", "LoginAttempt")
for item in LoginAttempt.objects.a... | Python | 0 | @@ -203,16 +203,96 @@
ditor):%0A
+ from django.contrib.auth import get_user_model%0A User = get_user_model()%0A%0A
Logi
@@ -384,36 +384,57 @@
Attempt.objects.
-all(
+filter(user__isnull=False
):%0A item.
@@ -437,32 +437,40 @@
tem.user_repr =
+getattr(
item.user.get_us
@@ -458,38 +458,45 @@
tr(i... |
cc300b1c0f6ccc4ca50b4f4d20f5f351af698cfc | Add files via upload | nthprime.py | nthprime.py | Python | 0 | @@ -0,0 +1,433 @@
+#encoding=utf8%0D%0A'''%0D%0AFind nth prime number%0D%0A'''%0D%0Afrom math import sqrt%0D%0Adef prime(maxn):%0D%0A n = 1%0D%0A while n %3C maxn:%0D%0A if is_prime(n):%0D%0A yield n%0D%0A n += 1%0D%0A %0D%0Adef is_prime(n):%0D%0A if n == 1:%0D%0A retu... | |
b1316b3db89fbee6e6c1ad807e2e36b8b4dd1874 | Add a script to fix garbled activities | Attic/act-fixup.py | Attic/act-fixup.py | Python | 0.000001 | @@ -0,0 +1,1109 @@
+from parliament.models import *%0Afrom django.db import transaction, reset_queries%0A%0Aif True:%0A with transaction.atomic():%0A print(%22Documents %25d%22 %25 Document.objects.count())%0A%0A for idx, doc in enumerate(Document.objects.all()):%0A if idx %25 1000 == 0:%0A ... | |
ad78abc4073cb26b192629aed9e9f8e3f5d9e94a | Test for GPI newline fix; for geneontology/go-site#1681 | tests/test_gpiwriter.py | tests/test_gpiwriter.py | Python | 0 | @@ -0,0 +1,963 @@
+import io%0A%0Afrom ontobio.io import entitywriter, gafgpibridge%0A%0A%0Adef test_header_newline():%0A gpi_obj = %7B%0A 'id': %22MGI:MGI:1918911%22,%0A 'label': %220610005C13Rik%22, # db_object_symbol,%0A 'full_name': %22RIKEN cDNA 0610005C13 gene%22, # db_object_name,%0A ... | |
4d8dbf66bdee710e5b53863a4852e80c42a2c7a2 | Add a sqlserver test | tests/test_sqlserver.py | tests/test_sqlserver.py | Python | 0.000105 | @@ -0,0 +1,2004 @@
+import unittest%0Aimport logging%0Afrom nose.plugins.attrib import attr%0A%0Afrom checks import gethostname%0Afrom tests.common import get_check%0A%0Alogging.basicConfig()%0A%0A%22%22%22%0ARun the following on your local SQL Server:%0A%0ACREATE LOGIN datadog WITH PASSWORD = '340$Uuxwp7Mcxo7Khy';%0AC... | |
b70b51d1c43a344a3c408f3da30c6477b311241e | Create __init__.py | acitool/jsondata/Mpod/__init__.py | acitool/jsondata/Mpod/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
9ec45d8b44a63bcd2652de30191b2bf0caf72ab8 | Add tests for backrefs | tests/aggregate/test_backrefs.py | tests/aggregate/test_backrefs.py | Python | 0 | @@ -0,0 +1,2151 @@
+import sqlalchemy as sa%0Afrom sqlalchemy_utils.aggregates import aggregated%0Afrom tests import TestCase%0A%0A%0Aclass TestAggregateValueGenerationForSimpleModelPaths(TestCase):%0A def create_models(self):%0A class Thread(self.Base):%0A __tablename__ = 'thread'%0A id... | |
72e2a92522702af998dc599e3370346e22097603 | Update threadedcomments/management/commands/migrate_threaded_comments.py | threadedcomments/management/commands/migrate_threaded_comments.py | threadedcomments/management/commands/migrate_threaded_comments.py | from django.core.management.base import NoArgsCommand
from django.contrib.sites.models import Site
from django.db import transaction, connection
from django.conf import settings
from threadedcomments.models import ThreadedComment
USER_SQL = """
SELECT
id,
content_type_id,
object_id,
parent_id,
use... | Python | 0.000002 | @@ -2910,18 +2910,18 @@
ve(skip_
-r
t
+r
ee_path=
|
8bf521bf26af93f13043ee6e0d70070d49f76f68 | Implement the cipher map problem. | Home/cipherMap.py | Home/cipherMap.py | Python | 0.00037 | @@ -0,0 +1,1222 @@
+import operator%0Adef checkio(arr):%0A index = convertMapToTuples(arr%5B0%5D)%0A cube = convertCubeToList(arr%5B1%5D)%0A output = ''%0A%0A dimension = len(arr%5B0%5D)%0A for i in range(0, 4):%0A index.sort(key=operator.itemgetter(0, 1))%0A for idx in index:%0A ... | |
586a8ca10f1f492f9976df95fbe1fa3d187a6006 | extend retries in wait for server to be ready (#4889) | Tests/scripts/wait_until_server_ready.py | Tests/scripts/wait_until_server_ready.py | """Wait for server to be ready for tests"""
import sys
import json
import ast
import argparse
from time import sleep
import datetime
import requests
import demisto_client.demisto_api
from typing import List, AnyStr
import urllib3.util
from Tests.test_utils import print_error, print_color, LOG_COLORS
# Disable insecu... | Python | 0 | @@ -365,17 +365,17 @@
TRIES =
-2
+3
0%0ASLEEP_
|
e583d977c7089f21841890b7eb50c824db153202 | Test for unicode characters in grammars. | tests/functional/test_unicode.py | tests/functional/test_unicode.py | Python | 0 | @@ -0,0 +1,478 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Aimport pytest%0Afrom textx.metamodel import metamodel_from_str%0A%0A%0Adef test_unicode_grammar_from_string():%0A %22%22%22%0A Test grammar with unicode char given in grammar string.%0A %22%22%22%0A%0A grammar = %22%22... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.