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 |
|---|---|---|---|---|---|---|---|
e10f2b85775412dd60f11deea6e7a7f8b84edfbe | Add name for entry view URL | buysafe/urls.py | buysafe/urls.py | from django.conf.urls import patterns
urlpatterns = patterns(
'buysafe.views',
(r'^entry/(?P<order_id>\d+)/$', 'entry'),
(r'^start/$', 'start'),
(r'^success/(?P<payment_type>[01])/$', 'success'),
(r'^fail/(?P<payment_type>[01])/$', 'fail'),
(r'^check/(?P<payment_type>[01])/$', 'check')
)
| Python | 0 | @@ -30,16 +30,21 @@
patterns
+, url
%0A%0A%0Aurlpa
@@ -83,24 +83,27 @@
views',%0A
+url
(r'%5Eentry/(?
@@ -129,16 +129,36 @@
'entry'
+, name='buysafe_pay'
),%0A (
|
94ee0506364be2ed58e793c4d237bb6c0da7f2d2 | fix error on 0D label array | cudarray/numpy_backend/nnet/special.py | cudarray/numpy_backend/nnet/special.py | import numpy as np
def softmax(X):
e = np.exp(X - np.amax(X, axis=1, keepdims=True))
return e/np.sum(e, axis=1, keepdims=True)
def categorical_cross_entropy(y_pred, y_true, eps=1e-15):
# Assumes one-hot encoding.
y_pred = np.clip(y_pred, eps, 1 - eps)
# XXX: do we need to normalize?
y_pred /... | Python | 0.000002 | @@ -762,16 +762,82 @@
fill(0)%0A
+ if labels.size == 1:%0A out%5B0, labels%5D = 1%0A else:%0A
for
@@ -859,16 +859,20 @@
asses):%0A
+
|
a8fdfcd09da79d9304b482eabb92d97b4a0a6f9e | include case type in test | corehq/apps/case_search/tests/test_case_search_endpoint.py | corehq/apps/case_search/tests/test_case_search_endpoint.py | import uuid
from django.test import TestCase
import mock
from casexml.apps.case.mock import CaseBlock, IndexAttrs
from corehq.apps.app_manager.models import (
CaseSearch,
CaseSearchProperty,
DetailColumn,
)
from corehq.apps.app_manager.tests.app_factory import AppFactory
from corehq.apps.case_search.con... | Python | 0.000002 | @@ -2682,16 +2682,39 @@
omain, %7B
+'case_type': 'person',
'family'
|
9fb8d047e57442f778c1769668676f1070234876 | rename var to avoid shadowing | corehq/apps/case_search/xpath_functions/value_functions.py | corehq/apps/case_search/xpath_functions/value_functions.py | import datetime
from django.utils.dateparse import parse_date
from django.utils.translation import gettext as _
import pytz
from dateutil.relativedelta import relativedelta
from eulxml.xpath.ast import serialize
from dimagi.utils.parsing import ISO_DATE_FORMAT
from corehq.apps.case_search.exceptions import XPathFun... | Python | 0 | @@ -2323,24 +2323,30 @@
xt)%0A date
+_value
= _value_to
@@ -3373,16 +3373,22 @@
t = date
+_value
+ relat
|
f59bca0fc8df0a151c4f82e67f2b81db3ac368a6 | fix test LoadtestUserTest.test_no_factor_set | corehq/ex-submodules/casexml/apps/phone/restore_caching.py | corehq/ex-submodules/casexml/apps/phone/restore_caching.py | import hashlib
import logging
from casexml.apps.phone.const import RESTORE_CACHE_KEY_PREFIX, ASYNC_RESTORE_CACHE_KEY_PREFIX
from corehq.toggles import ENABLE_LOADTEST_USERS
from corehq.util.quickcache import quickcache
from dimagi.utils.couch.cache.cache_core import get_redis_default_cache
logger = logging.getLogger(_... | Python | 0.000005 | @@ -1154,16 +1154,28 @@
(domain)
+ and user_id
:%0A
|
9c2bd01e305ae841a8db350daf1f012508f2b46d | Fix TelegramNotifier logging formatting string. | gefion/notifiers/telegram.py | gefion/notifiers/telegram.py | # -*- coding: utf-8 -*-
"""Contains TelegramNotifier."""
import logging
from datetime import datetime
from telegram import Bot, ParseMode
from telegram.error import TelegramError
from gefion.notifiers import Notifier
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class TelegramNotifier(Notifi... | Python | 0 | @@ -2505,17 +2505,17 @@
o chat %25
-d
+s
.', self
|
d827c8efd57c10750c33072920fd59ccb5dda9fe | Fix related lookup error in admin. | chmvh_website/resources/admin.py | chmvh_website/resources/admin.py | from django.contrib import admin
from resources import models
class CategoryAdmin(admin.ModelAdmin):
fieldsets = (
(None, {
'fields': ('title', 'important')
}),
)
list_display = ('title', 'important')
search_fields = ('title',)
class ResourceAdmin(admin.ModelAdmin):
... | Python | 0.000126 | @@ -602,24 +602,31 @@
', 'category
+__title
', 'descript
|
f37da5dffce3869c01fe4bd4243083bda36ceb61 | Update sphinxcontrib/wavedrom_render_image.py | sphinxcontrib/wavedrom_render_image.py | sphinxcontrib/wavedrom_render_image.py | '''Supporting file dedicated to the generation of wavedrom images using the official wavedrom-cli executable '''
import os
import subprocess
import shlex
from uuid import uuid4
import cairosvg
from wavedrom import render
from sphinx.errors import SphinxError
import errno
# This exception was not always available..
try... | Python | 0 | @@ -4980,21 +4980,19 @@
as
-backup option
+alternative
and
|
f9403998bbece4f4c316d35d9c9b729eb9a21af2 | Add __all__ to webview | webview/__init__.py | webview/__init__.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
pywebview is a lightweight cross-platform wrapper around a webview component that allows to display HTML content in its
own dedicated window. Works on Windows, OS X and Linux and compatible with Python 2 and 3.
(C) 2014-2019 Roman Sirokov and contributors
Licensed under B... | Python | 0.000974 | @@ -794,16 +794,352 @@
urces%0A%0A%0A
+__all__ = (%0A # Stuff that's here%0A 'start', 'create_window',%0A # From wsgi%0A 'Routing', 'StaticFiles', 'StaticResources',%0A # From event%0A 'Event',%0A # from util%0A '_token', 'base_uri', 'parse_file_type', 'escape_string', 'make_unicode',%0A 'es... |
e302014cd1d914cd2227c9898dae991640c8d748 | Update wsgi.py settings | weddingsite/wsgi.py | weddingsite/wsgi.py | """
WSGI config for weddingsite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "weddingsite.settings")
from djan... | Python | 0 | @@ -245,21 +245,10 @@
iron
-.setdefault(%22
+%5B'
DJAN
@@ -269,12 +269,14 @@
DULE
-%22, %22
+'%5D = '
wedd
@@ -295,11 +295,9 @@
ings
-%22)%0A
+'
%0Afro
@@ -394,34 +394,45 @@
ise%0A%0A#os.environ
-%5B'
+.setdefault(%22
DJANGO_SETTINGS_
@@ -429,38 +429,36 @@
_SETTINGS_MODULE
-'%5D = '
+%22, %22
weddingsite.sett... |
217450da8b0715b102b0a9fcad9aae714f15b920 | version bump for 0.84.5. | oneflow/__init__.py | oneflow/__init__.py |
VERSION = '0.84.4'
| Python | 0 | @@ -10,12 +10,12 @@
= '0.84.
-4
+5
'%0A%0A
|
722e3d81bde9c86d7aab87982329054ecc5922e2 | version bump for 0.25.17.19. | oneflow/__init__.py | oneflow/__init__.py |
VERSION = '0.25.17.18'
| Python | 0 | @@ -18,8 +18,8 @@
17.1
-8
+9
'%0A%0A
|
e750a8da841a0c2392a63b5e73f864e23cf60a9f | Fix GUI bug in pipe viewer | Code/GUI/PipeViewer.py | Code/GUI/PipeViewer.py |
from panda3d.core import Texture, Vec3
from direct.gui.DirectScrolledFrame import DirectScrolledFrame
from direct.gui.DirectFrame import DirectFrame
from ..Util.Generic import rgb_from_string
from DraggableWindow import DraggableWindow
from BetterOnscreenText import BetterOnscreenText
from BetterOnscreenImage import... | Python | 0 | @@ -2005,17 +2005,18 @@
eight =
-9
+10
0%0A%0A
@@ -4216,17 +4216,17 @@
x=0, y=5
-5
+0
+ pipe_
|
b745b5e1a843195f2f067602381be038744a9390 | Bump version to 1.0.0 | werobot/__init__.py | werobot/__init__.py | __version__ = '0.7.0'
__author__ = 'whtsky'
__license__ = 'MIT'
__all__ = ["WeRoBot"]
try:
from werobot.robot import WeRoBot
except ImportError:
pass
| Python | 0 | @@ -12,11 +12,11 @@
= '
-0.7
+1.0
.0'%0A
|
37fddf1f2cda1ceda2ab788a31e7b59396f5ac1a | pw_email 2 | whatachore/tasks.py | whatachore/tasks.py | import datetime
import requests
from celery import Celery
from celery.decorators import periodic_task
from celery.task.schedules import crontab
from celery.utils.log import get_task_logger
from django.conf import settings
from django.contrib.auth.tokens import default_token_generator
from django.core.mail import send_... | Python | 0.999626 | @@ -3745,16 +3745,32 @@
ser.pk))
+.decode(%22utf-8%22)
+ '/' +
|
c4c8ca08f162686da0396fd6d9427eb5efcc6168 | Improve v7 conversion cli command | whip_neustar/cli.py | whip_neustar/cli.py | """
Command line interface module.
"""
import gzip
import logging
import sys
import aaargh
logger = logging.getLogger(__name__)
JSON_LIBS = ('ujson', 'simplejson', 'json')
for lib in JSON_LIBS:
try:
json = __import__(lib)
except ImportError:
pass
else:
break
from . import reade... | Python | 0.000001 | @@ -978,16 +978,46 @@
ype=file
+, nargs='?', default=sys.stdin
)%0A@app.c
@@ -1287,16 +1287,123 @@
name%22)%0A
+ if not '.dat' in data_fp.name:%0A raise RuntimeError(%22Cannot deduce reference file name%22)%0A
|
b81976a4ac1e7019b2eec207d7e4337556fe515d | use getattre | custom/bihar/calculations/homevisit.py | custom/bihar/calculations/homevisit.py | from datetime import timedelta
import logging
from custom.bihar import getters
from custom.bihar.calculations.types import DoneDueCalculator, TotalCalculator
from custom.bihar.calculations.utils.calculations import get_forms
from custom.bihar.calculations.utils.filters import is_pregnant_mother,\
get_add, get_edd, ... | Python | 0.000001 | @@ -879,24 +879,42 @@
return
-case.edd
+getattr(case, 'edd', None)
and low
|
96a49c5239b051a5ffd4371e360a74398b6532b5 | update openstack.py helper sample | extras/openstack.py | extras/openstack.py | from kvirt.config import Kconfig
cluster = 'testk'
network = "default"
api_ip = "11.0.0.253"
cidr = "11.0.0.0/24"
config = Kconfig()
config.k.delete_network_port("%s-vip" % cluster)
config.k.create_network(name=network, cidr=cidr, overrides={'port_security_enabled': True})
config.k.create_network_port("%s-vip" % clus... | Python | 0.000001 | @@ -72,25 +72,25 @@
%0Aapi_ip = %221
-1
+2
.0.0.253%22%0Aci
@@ -96,17 +96,17 @@
idr = %221
-1
+2
.0.0.0/2
@@ -149,35 +149,43 @@
te_network_port(
-%22%25s
+f%22%7Bcluster%7D
-vip%22 %25 cluster)
@@ -310,11 +310,19 @@
ort(
-%22%25s
+f%22%7Bcluster%7D
-vip
|
cdc2eeb17bcd553e79ee6985fc3bad7889ef5647 | add kwargs and make exceptions noisy by default | extruct/__init__.py | extruct/__init__.py | import logging
from lxml.html import fromstring
from extruct.jsonld import JsonLdExtractor
from extruct.rdfa import RDFaExtractor
from extruct.w3cmicrodata import MicrodataExtractor
from extruct.opengraph import OpenGraphExtractor
from extruct.microformat import MicroformatExtractor
from extruct.xmldom import XmlDomHTM... | Python | 0 | @@ -4,24 +4,40 @@
ort logging%0A
+import argparse%0A
from lxml.ht
@@ -390,16 +390,106 @@
extract(
+args=None):%0A parser = argparse.ArgumentParser()%0A arg = parser.add_argument%0A arg('
htmlstri
@@ -494,123 +494,670 @@
ring
+'
,
-url='http://www.example.com/', encoding=%22UTF-8%22,%0A syntax... |
86ea5819fed43086f347f0601f9372fa40742493 | remove unnecessary imports | bot.py | bot.py | """Discord bot for Discord."""
from collections import OrderedDict
import datetime
import requests
import asyncio
import logging
import json
import sys
import os
from discord.ext import commands
import discord
# Files and Paths
app_path = os.path.split(os.path.abspath(sys.argv[0]))[0]
data_path = os.path.join(app_pa... | Python | 0.000079 | @@ -29,44 +29,8 @@
%22%22%0A%0A
-from collections import OrderedDict%0A
impo
@@ -45,24 +45,8 @@
ime%0A
-import requests%0A
impo
@@ -75,20 +75,8 @@
ing%0A
-import json%0A
impo
|
e942b7291cce0919cbde8ff5cd43e51daa706a88 | Update sgd alias. | optax/_src/alias.py | optax/_src/alias.py | # Lint as: python3
# Copyright 2019 DeepMind Technologies Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | Python | 0 | @@ -771,16 +771,26 @@
rt Union
+, Optional
%0A%0Aimport
@@ -4537,26 +4537,38 @@
mentum:
+Optional%5B
float
+%5D
=
-0.
+None
,%0A
@@ -4624,30 +4624,8 @@
on:%0A
- if momentum %3E 0.:%0A
re
@@ -4642,34 +4642,33 @@
ne.chain(%0A
-
+(
transform.trace(
@@ -4701,25 +4701,24 @@
esterov)
-,
%0A ... |
a5e87e7cf2a607c33f1fa669c42d9f13a4cffd97 | use a meaningful uri for prediction service | service/__init__.py | service/__init__.py | # -*- coding: utf-8 -*-
from flask import Flask, current_app, request, jsonify
import io
import base64
import logging
import numpy as np
import cv2
from service import model
def create_app(config, debug=False, testing=False, config_overrides=None):
app = Flask(__name__)
app.config.from_object(config)
if ... | Python | 0 | @@ -847,16 +847,106 @@
ute('/',
+ methods=%5B'GET'%5D)%0A def root():%0A return 'Hello!', 200%0A%0A @app.route('/predict',
methods
|
da8e10d7e4e5c7be72d64a4af5c34a7a0f5a9440 | Add more pics and add more words to the word list. | ch09/hangman.py | ch09/hangman.py | # hangman.py
import random
HANGMANPICS = ['''
+---+
| |
|
|
|
|
=========''', '''
+---+
| |
O |
|
|
|
=========''', '''
+---+
| |
O |
| |
|
|
=========''', '''
+---+
| |
O |
/| |
|
|
=========''', '''
+... | Python | 0 | @@ -484,32 +484,166 @@
/ %5C %7C%0A %7C%0A
+=========''', '''%0A%0A +---+%0A %7C %7C%0A %5BO %7C%0A /%7C%5C %7C%0A / %5C %7C%0A %7C%0A=========''', '''%0A%0A +---+%0A %7C %7C%0A %5BO%5D %7C%0A /%7C%5C %7C%0A / %5C %7C%0A %7C%0A
========='''%5D%0A%0Aw
@@ -1079,16 +1079,331 @@
at zebra
... |
1587d6935ea472d512bb956a8aa8218d4cfd5242 | remove country lookup, using db trigger instead | gfsad/views/api/locations.py | gfsad/views/api/locations.py | from gfsad import api
from gfsad.models import Location
from processors import api_roles, add_user_to_posted_data, remove_relations, debug_post
from records import save_record_state_to_history
from gfsad.tasks.records import get_ndvi, build_static_records
from gfsad.utils.countries import find_country
def process_rec... | Python | 0 | @@ -253,55 +253,8 @@
rds%0A
-from gfsad.utils.countries import find_country%0A
%0A%0Ade
|
cb9b6fcb5b6cf6ad286758a7ceef789d6265ceae | Update service.py | services/service.py | services/service.py | from models.service import ServiceModel
import tornado.gen
class ServiceService():
m_service = ServiceModel()
def __init__(self):
pass
def insert_service(self,service,callback=None):
model = yield tornado.gen.Task(m_service.insert,service)
callback(model)
def... | Python | 0.000001 | @@ -151,24 +151,50 @@
pass%0A
+ %0A @tornado.gen.engine
%0A def ins
@@ -265,32 +265,37 @@
ornado.gen.Task(
+self.
m_service.insert
@@ -1245,28 +1245,29 @@
callback(result)
+%0A
|
ee3bc1971c826ace1b61e82d4b02315aa26055be | Send the version of the client to the grader | osim/http/client.py | osim/http/client.py | # ADAPTED FROM https://github.com/openai/gym-http-api
import requests
import six.moves.urllib.parse as urlparse
import json
import os
import osim
import pkg_resources
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class Client(object):
"""
Gym client to interface with gym_ht... | Python | 0 | @@ -131,20 +131,8 @@
os%0A
-import osim%0A
impo
@@ -1975,27 +1975,8 @@
n %7D%0A
- print data%0A
|
26ccb7620af2d883e9c584608cf3270e1561627c | Bump version for release | fastapi/__init__.py | fastapi/__init__.py | """FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
__version__ = "0.1.8"
from .applications import FastAPI
from .routing import APIRouter
from .params import Body, Path, Query, Header, Cookie, Form, File, Security, Depends
| Python | 0 | @@ -110,9 +110,9 @@
0.1.
-8
+9
%22%0A%0Af
|
7c2e679d0422c77c7ed792e538cf13c7205a6c7a | Fix and clean up cap mark | bot.py | bot.py | import discord, time, asyncio, json, sys
from discord.ext import commands
from get_data import *
description = '''
A bot for the redditors clan.
Returns information from the google spreadsheet.
'''
ERROR_CHANNEL: '' #Send errors to this channel
TOKEN = ''
UPDATE = 60 #Clan list update frequency in seconds... | Python | 0 | @@ -2271,47 +2271,16 @@
ap_m
-essage = ':negative_squared_cross_mark:
+ark = '%F0%9F%91%8E
'%0A
@@ -2310,16 +2310,32 @@
annie%5B3%5D
+.lower() = 'yes'
:%0A
@@ -2361,37 +2361,16 @@
ap_m
-essage = ':white_check_mark:
+ark = '%F0%9F%91%8D
'%0A%0A
@@ -2407,17 +2407,20 @@
ld(name=
-'
+f'%5Cn
Capped t
@@ -2... |
b36efdea03527480402fdf0ca9d95290da8f7fec | create outputfiles (such as logs, console outputs) into separate folder | configuration.py | configuration.py | import os
import configparser
from rtcFunctions import ComponentBaseLineEntry
import shell
import shouter
def readconfig():
config = configparser.ConfigParser()
config.read("config.ini")
generalsection = config['General']
user = generalsection['User']
password = generalsection['Password']
wor... | Python | 0.000001 | @@ -2260,102 +2260,300 @@
wd()
-%0A self.streamuuids = %5B%5D%0A%0A def getlogpath(self, filename):%0A return %22%25s%5C%25s%22 %25 (
+ + os.sep + %22Logs%22%0A self.hasCreatedLogFolder = os.path.exists(self.logFolder)%0A self.streamuuids = %5B%5D%0A%0A def getlogpath(self, filename):... |
f81a68e330b9ee7f9cdfc1aaf5a1ab3ed3096503 | Improve type hint formatting for matrix sin command | Discord/cogs/matrix.py | Discord/cogs/matrix.py |
from discord.ext import commands
import ast
import numpy
import scipy
from utilities import checks
def setup(bot):
bot.add_cog(Matrix())
class Matrix(commands.Cog):
# TODO: move to converters file
class Matrix(commands.Converter):
async def convert(self, ctx, argument):
return ast.literal_eval(argument)
... | Python | 0 | @@ -3699,33 +3699,32 @@
, ctx, *, matrix
-
: Matrix):%0A%09%09'''
|
c37f8defa0db3bd58045a22adf9b4e7030d2a2a7 | Fix sign up with an Twitter account. | gittip/elsewhere/__init__.py | gittip/elsewhere/__init__.py | """This subpackage contains functionality for working with accounts elsewhere.
"""
from __future__ import print_function, unicode_literals
from collections import OrderedDict
from aspen.utils import typecheck
from aspen import json
from psycopg2 import IntegrityError
import gittip
from gittip.exceptions import Proble... | Python | 0.000001 | @@ -2674,16 +2674,22 @@
unicode
+, long
), user_
|
c84daa82aa3846445390c1bdf37db150671a4256 | Improve build_database step | dbaas/workflow/steps/build_database.py | dbaas/workflow/steps/build_database.py | # -*- coding: utf-8 -*-
import logging
from base import BaseStep
from logical.models import Database
import datetime
LOG = logging.getLogger(__name__)
class BuildDatabase(BaseStep):
def __unicode__(self):
return "Creating logical database..."
def do(self, workflow_dict):
try:
... | Python | 0.000003 | @@ -1337,73 +1337,291 @@
-return False%0A%0A LOG.info(%22Destroying the database....%22)
+if 'databaseinfra' in workflow_dict:%0A LOG.info(%22Loading database into workflow_dict...%22)%0A workflow_dict%5B'database'%5D = Database.objects.filter(databaseinfra=workflo... |
bde91d20aa09c33ba2855894b3d1474b526a1fc4 | Move SyntaxError handling into cli_main | chevron/main.py | chevron/main.py | #!/usr/bin/python
import json
#
# Python 2 and 3, module and script compatability
# If you know a better way please tell me :(
#
try:
from .renderer import render
except (ValueError, SystemError):
from renderer import render
def main(template, data={}, **kwargs):
with open(template, 'r') as template_fi... | Python | 0 | @@ -575,25 +575,8 @@
gs)%0A
- try:%0A
@@ -605,149 +605,8 @@
gs)%0A
- except SyntaxError as e:%0A print('Chevron: syntax error')%0A print(' ' + '%5Cn '.join(e.args%5B0%5D.split('%5Cn')))%0A
%0A%0Ade
@@ -2292,17 +2292,27 @@
-result =
+try:%0A print(
ma... |
83e161e043145a9d24a300351c0438997e2c404c | Update image.py | shap/plots/image.py | shap/plots/image.py | import numpy as np
import warnings
try:
import matplotlib.pyplot as pl
except ImportError:
warnings.warn("matplotlib could not be loaded!")
pass
from . import colors
def image_plot(shap_values, x, labels=None, show=True, width=20, aspect=0.2, hspace=0.2, labelpad=None):
""" Plots SHAP values for image ... | Python | 0.000001 | @@ -2589,17 +2589,17 @@
v.shape%5B
-0
+1
%5D, sv.sh
@@ -2602,17 +2602,17 @@
v.shape%5B
-1
+0
%5D, -1))%0A
|
82b0df6e917fd49bb214b30cf689a1dcfdc6fec7 | fix flake8 error | content/forms.py | content/forms.py | from . import models
from crispy_forms import layout
from django import forms
from django.core import urlresolvers
from entities import models as entities
from features.gestalten import models as gestalten
from features.groups import models as groups
from utils import forms as utils_forms
class BaseContent(utils_form... | Python | 0 | @@ -4829,16 +4829,66 @@
tosize',
+%0A
'data-a
|
3bde1cac6163d90287d2bef2d0ca551c8d544488 | add more multi qbit test programs | src/python/pyqgl2/test/multi.py | src/python/pyqgl2/test/multi.py | from qgl2.qgl1 import QubitFactory, Id, X, MEAS
from qgl2.qgl2 import qgl2decl, sequence, concur, seq
from qgl2.basic_sequences.qgl2_plumbing import init
@qgl2decl
def multiQbitTest() -> sequence:
q1 = QubitFactory('q1')
q2 = QubitFactory('q2')
with concur:
with seq:
init(q1)
... | Python | 0 | @@ -40,16 +40,19 @@
X, MEAS
+, Y
%0Afrom qg
@@ -743,12 +743,598 @@
MEAS(q2)%0A
+%0A@qgl2decl%0Adef anotherMulti() -%3E sequence:%0A q1 = QubitFactory('q1')%0A q2 = QubitFactory('q2')%0A with concur:%0A for q in %5Bq1, q2%5D:%0A init(q)%0A Id(q)%0A X(q)%0A ... |
3c7d8313066af8b07226555bc0d87cb56f397eb6 | Let's make it 0.9.0. | wsproto/__init__.py | wsproto/__init__.py | # -*- coding: utf-8 -*-
"""
wsproto
~~~
A WebSocket implementation.
"""
__version__ = "1.0.0dev0"
| Python | 0.999617 | @@ -86,15 +86,11 @@
= %22
-1.0.0dev
+0.9.
0%22%0A
|
8a5db519f7aa810d4009ada20de46fb982da0ec8 | Fix description in __init__.py | wtforms/__init__.py | wtforms/__init__.py | """
wtforms
~~~~~~~
What The Forms is a framework-agnostic way of generating HTML forms, handling
form submissions, and validating it.
Check out our trac wiki at http://dev.simplecodes.com/projects/wtforms
:copyright: 2007-2008 by James Crasta, Thomas Johansson.
:license: MIT, see... | Python | 0.999998 | @@ -35,16 +35,9 @@
W
-hat The
+T
Form
@@ -47,182 +47,304 @@
s a
-framework-agnostic way of g
+HTTP/HTML forms handling library, written in Python.%0A %0A It handles definition, validation and r
en
+d
er
-at
ing
-HTML forms, handling%0A form submissions, and validating it.%0A%0A Check out our tra... |
556ec17923dbe9b037011af8bd13e6e89b8df80b | fix test for python 3 | FukuML/PLA/__init__.py | FukuML/PLA/__init__.py | #encoding=utf8
import os
import numpy as np
__version__ = '0.0.1'
__all__ = ['Machine Learning', 'Perceptron Learning Algorithm', 'PLA']
status = 'empty'
train_X = []
train_Y = []
W = []
data_num = 0
data_demension = 0
tune_times = 0
def load_train_data():
'''
Load train data
Please check dataset/pla_... | Python | 0.000105 | @@ -1294,33 +1294,33 @@
):%0A print
-
+(
%22Please load tra
@@ -1326,32 +1326,33 @@
ain data first.%22
+)
%0A return
@@ -1784,17 +1784,17 @@
print
-
+(
%22Please
@@ -1827,16 +1827,17 @@
first.%22
+)
%0A
|
563806037e49652e4c4a9602e38b72edb3d1d9f1 | add missing self.s | Functions/URLFollow.py | Functions/URLFollow.py | from IRCMessage import IRCMessage
from IRCResponse import IRCResponse, ResponseType
from Function import Function
import WebUtils
import re
import HTMLParser
import json
class Instantiate(Function):
Help = 'automatic function that follows urls and grabs information about the resultant webpage'
... | Python | 0.00163 | @@ -3465,32 +3465,37 @@
title =
+self.
GetTitle(webPage
@@ -4310,16 +4310,21 @@
title =
+self.
GetTitle
|
294f17c5c58b864ede65f2f842b792da85bb5c85 | Bump version | shenfun/__init__.py | shenfun/__init__.py | """
This is the **shenfun** package
What is **shenfun**?
================================
``Shenfun`` is a high performance computing platform for solving partial
differential equations (PDEs) by the spectral Galerkin method. The user
interface to shenfun is very similar to
`FEniCS <https://fenicsproject.org>`_, but ... | Python | 0 | @@ -1194,9 +1194,9 @@
2.0.
-3
+4
'%0A__
|
6f324c34e8390d267b20fa5a8ca3b8b13eda2415 | Remove accelerate. | simhash/__init__.py | simhash/__init__.py | #Created by Liang Sun in 2013
import re
import hashlib
import logging
import collections
class Simhash(object):
def __init__(self, value, f=64, reg=ur'[\w\u4e00-\u9fff]+', hashfunc=None):
'''
`f` is the dimensions of fingerprints
`reg` is meaningful only when `value` is basestring and desc... | Python | 0.000001 | @@ -837,408 +837,8 @@
6)%0A%0A
- _d = %7B%7D%0A t = %5B'','',''%5D%0A def _dfs(n):%0A if n == -1:%0A x = ''.join(t)%0A _d%5Bx%5D = _hashfunc(x)%0A for j in 'abcdefghijklmnopqrstuvwxyz':%0A t%5Bn%5D =... |
3d1ebd5999f967a2813d880ce47be8db5680e1db | enable selective dynamics when writing POSCAR files | sisl/io/vasp/car.py | sisl/io/vasp/car.py | import numpy as np
# Import sile objects
from .sile import SileVASP
from ..sile import *
# Import the geometry object
from sisl.messages import warn
from sisl import Geometry, PeriodicTable, Atom, SuperCell
__all__ = ['carSileVASP']
class carSileVASP(SileVASP):
""" *CAR VASP files for defining geomtries
T... | Python | 0 | @@ -1852,16 +1852,60 @@
at(*d))%0A
+ self._write('Selective dynamics%5Cn')%0A
@@ -1960,24 +1960,30 @@
9f%7D' * 3 + '
+ F F F
%5Cn'%0A
|
fb1d818dd1cf8056b30cae079211df6c1cffdbe0 | delete param | cat.py | cat.py | from .base import ElasticsearchCommand
DEFAULT_PARAMS = dict(v=1)
class CatClientCommand(ElasticsearchCommand):
show_result_on_window = True
syntax = 'Packages/Text/Plain text.tmLanguage'
result_window_title = ""
def request_cat_api(self, method_name, *args, **kwargs):
method = getattr(self.... | Python | 0.000002 | @@ -3038,21 +3038,8 @@
self
-, fields=None
):%0A
|
dd5751c353391df0f8b112b946e4a928e85cae5e | test git commit | xgds_video/tests.py | xgds_video/tests.py | # __BEGIN_LICENSE__
# Copyright (C) 2008-2010 United States Government as represented by
# the Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# __END_LICENSE__
from django.test import TestCase
class xgds_videoTest(TestCase):
"""
Tests for xgds_video
"""
def... | Python | 0.000001 | @@ -373,9 +373,23 @@
ook
-4
+5 in xgds_video
%22%0A
|
fb3c48ffc6769f00fda70cf9fdba0da479ff9a4f | make readthedocs happy | xlwings/__init__.py | xlwings/__init__.py | from __future__ import absolute_import
import sys
__version__ = '0.2.0'
# Python 2 vs 3
PY3 = sys.version_info[0] == 3
# Platform specific imports
if sys.platform.startswith('win'):
import xlwings._xlwindows as xlplatform
if sys.platform.startswith('darwin'):
import xlwings._xlmac as xlplatform
# API
from ... | Python | 0.000001 | @@ -226,45 +226,12 @@
orm%0A
-%0Aif sys.platform.startswith('darwin')
+else
:%0A
|
cb62e45442a85f409501e17a873c5f7190482dba | use correct callbacks | src/notifier/url.py | src/notifier/url.py | # -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------------
# url.py - wrapper for receiving urllib2.Request objects
# -----------------------------------------------------------------------------
# $Id$
#
# Usage:
# request = urllib2.Request('http://www.freevo.org/')
# ... | Python | 0.000189 | @@ -2671,20 +2671,24 @@
(signal.
-emit
+finished
)%0A
@@ -2745,21 +2745,8 @@
tion
-_handler.emit
)%0A
|
c842b0f93117f4fca8cc195ec73f844b281a0f19 | Update server.py | src/nudge/server.py | src/nudge/server.py | """
Handles commands received from a Nudge client
"""
import binascii
import pickle
from Crypto.Cipher import AES
from django.contrib.contenttypes.models import ContentType
from reversion.models import Version, VERSION_DELETE
try:
import simplejson as json
except ImportError:
import json
def valid_batch(batc... | Python | 0 | @@ -166,16 +166,52 @@
entType%0A
+from django.core import serializers%0A
from rev
@@ -256,16 +256,17 @@
DELETE%0A%0A
+%0A
try:%0A
|
53661db984233f38ab18f7df039c7a93a7382cdb | Revert "[common]: Add data.cache.audio settings entry" | xoinvader/common.py | xoinvader/common.py | """
Module for common shared objects.
"""
import json
from os.path import dirname
import xoinvader
from xoinvader.settings import Settings as Entry
from xoinvader.utils import Point
def get_json_config(path):
"""Return Settings object made from json."""
with open(path) as fd:
config = Entry(json.... | Python | 0 | @@ -1467,71 +1467,8 @@
one)
-,%0A data=dict(%0A cache=dict(%0A audio=dict()))
%0A)%0A%0A
|
324da23b97da9b513605610989ed8adb1ae80c4a | fix typo in config module | src/obpds/config.py | src/obpds/config.py | cfg = {}
cfg['plot.semilogy/yrange'] = 1e7
cfg['plot/tight_layout'] = False | Python | 0.000025 | @@ -15,9 +15,9 @@
plot
-.
+/
semi
|
f360215dcd8cbb782af445131ab3a876b9580908 | quit requests dep | ddg.py | ddg.py | import sys
import requests
import ipdb as pdb
def get_results(ddg):
results = []
for ret in ddg.get("RelatedTopics"):
if ret.has_key("Topics"):
for rett in ret.get("Topics"):
result_inf = {"description":rett["Text"], "url":rett["FirstURL"]}
else:
... | Python | 0 | @@ -11,24 +11,35 @@
%0Aimport
-requests
+urllib2%0Aimport json
%0Aimport
@@ -825,24 +825,25 @@
%22-s%22:%0A%0A
+#
params = ''%0A
@@ -840,16 +840,20 @@
rams = '
+hola
'%0A %0A
@@ -896,21 +896,22 @@
ms+=
-%22+%22+arg
+arg+%22+%22
%0A%0A
+#
pdb.
@@ -937,20 +937,23 @@
g =
-requests.get
+urllib2.ur... |
202a9b2ad72ffe4ab5981f9a4a886e0a36808eb6 | Add test for handling Infinity in json | tests/sentry/utils/json/tests.py | tests/sentry/utils/json/tests.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import datetime
import uuid
from sentry.utils import json
from sentry.testutils import TestCase
class JSONTest(TestCase):
def test_uuid(self):
res = uuid.uuid4()
self.assertEquals(json.dumps(res), '"%s"' % res.hex)
def test_da... | Python | 0 | @@ -947,16 +947,119 @@
1);%3C%5C/script%3E%22'%0A
+%0A def test_inf(self):%0A res = float('inf')%0A self.assertEquals(json.dumps(res), 'null')%0A
|
0d5ad2213240984d7375289778e77b1453ff7875 | make test for free_ram support a range since it's often flaky | tests/test_agent/test_service.py | tests/test_agent/test_service.py | # No shebang line, this module is meant to be imported
#
# Copyright 2014 Oliver Palmer
#
# 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
#
# U... | Python | 0 | @@ -1867,52 +1867,8 @@
%22%5D,%0A
- %22free_ram%22: config%5B%22free_ram%22%5D,%0A
@@ -1983,32 +1983,172 @@
gent()%0A s
+ystem_data = agent.system_data()%0A self.assertApproximates(%0A system_data.pop(%22free_ram%22), config%5B%22free_ram%22%5D, 64)%0A s
elf.assertEqu... |
77da35970b056862ce866f7fab086c4cb4bb18de | add parent directory creation to subcmd01 tests | tests/test_subcmd_01_download.py | tests/test_subcmd_01_download.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) The James Hutton Institute 2016-2019
# (c) University of Strathclyde 2019
# Author: Leighton Pritchard
#
# Contact:
# leighton.pritchard@strath.ac.uk
#
# Leighton Pritchard,
# Strathclyde Institute for Pharmacy and Biomedical Sciences,
# Cathedral Street,
# Glasgow,
... | Python | 0 | @@ -88,16 +88,20 @@
19%0A# (c)
+ The
Univers
@@ -119,16 +119,21 @@
thcl
-y
+u
de 2019
+-2020
%0A# A
@@ -257,19 +257,18 @@
ute
+o
f
-or
Pharmac
y an
@@ -263,17 +263,23 @@
Pharmac
-y
+eutical
and Bio
@@ -294,19 +294,54 @@
Sciences
-,
%0A#
+ The University of Strathclyde%0A# 161
Cathedr
@@ -349,17 +349... |
4b63f9bb41ecf418e2279d8d2cc0f82d90f655ec | Drop Py2 and six on tests/unit/utils/test_timeout.py | tests/unit/utils/test_timeout.py | tests/unit/utils/test_timeout.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import logging
import time
from salt.utils.timeout import wait_for
from tests.support.helpers import slowTest
from tests.support.unit import TestCase
log = logging.getLogger(__name__)
def return_something_after(seconds... | Python | 0 | @@ -1,102 +1,4 @@
-# -*- coding: utf-8 -*-%0Afrom __future__ import absolute_import, print_function, unicode_literals%0A%0A
impo
|
968c4e30ec71d2c51996868788a1b92f9f175bff | resolve not defined bug | tests/unit_test/test_datapack.py | tests/unit_test/test_datapack.py | from matchzoo.datapack import DataPack, load_datapack
import pytest
import shutil
import pandas as pd
@pytest.fixture
def data_pack():
relation = [['qid0', 'did0', 1], ['qid1', 'did1', 0]]
left = [['qid0', [1, 2]], ['qid1', [2, 3]]]
right = [['did0', [2, 3, 4]], ['did1', [3, 4, 5]]]
ctx = {'vocab_siz... | Python | 0.000001 | @@ -1672,24 +1672,25 @@
assert data
+_
pack.context
|
5ba68eb29f09d369a5a404792c90bb0ab1faa8fe | Modify purge method. | src/sat.py | src/sat.py | from logConstructs import *
class SAT_solver:
@staticmethod
def up(formula):
"""Return None if there is contradiction and dictionary otherwise."""
#filter cluses which contains one element
fformula = filter(lambda x: len(x.clause) == 1, formula)
result = {}
#if there ... | Python | 0 | @@ -878,19 +878,83 @@
-#return all
+@staticmethod%0A def purge(formula):%0A %22%22%22Return None if there is no
ele
@@ -959,23 +959,16 @@
lements
-values
which ca
@@ -975,48 +975,231 @@
n be
- purged%0A def filterElements(element):
+%22%22%22%0A %22%22%22purged or dictionary otherwise.%... |
a6caa061b4f25b22e9cbbcf35d214f7fb1bb6e51 | Print files that are checked | ide.py | ide.py | # NOTE: pass -d to this to print debugging info when the server crashes.
from flask import Flask, render_template, url_for, request
from subprocess import Popen, PIPE, check_call
import sys, os, string, glob
app = Flask(__name__)
def compileO():
r = check_call(['gcc', 'o.c', '-DIDE', '-o', 'o-ide', '-lm'])
if... | Python | 0 | @@ -530,25 +530,38 @@
eck
-if C was compiled
+files that start with 'o-ide*'
%0A
@@ -569,15 +569,16 @@
-if len(
+files =
glob
@@ -592,16 +592,91 @@
o-ide*%22)
+%0A print(files)%0A #Check if C was compiled%0A if len(files
) %3C 1:%0A
|
dee38b7f7537913faea69d286682001a3b4b879a | Change reddit limit | streams.py | streams.py | import bs4
import html
import requests
STREAMS_URL = 'http://www.reddit.com/r/nbastreams.json?limit=20'
# STREAMS_URL = 'https://api.myjson.com/bins/40flf'
def main(teams):
submission = get_submission(request(STREAMS_URL), teams)
if submission is not None:
comments_url = 'http://reddit.com' + submiss... | Python | 0.000003 | @@ -98,9 +98,9 @@
mit=
-2
+3
0'%0A#
|
abbdb859f9dc972c9de1c1b65165dd443120eed7 | return course id in LO API | src/edurepo/repo/api.py | src/edurepo/repo/api.py | __author__ = 'trawick'
from tastypie import fields
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
from repo.models import Course, CourseCategory, ICan, LearningObjective, GlossaryItem, MultipleChoiceItem, ReferenceText, TrueFalseItem
from core.utils import CORSResource
class CourseCategoryReso... | Python | 0 | @@ -1028,32 +1028,144 @@
', full=False)%0A%0A
+ def dehydrate(self, bundle):%0A bundle.data%5B'course_id'%5D = bundle.obj.course.id%0A return bundle%0A%0A
class Meta:%0A
|
fb1dce1881336d2f7ef8c19faa38064f9769c045 | Add try catch for N/A values | cinema/movie.py | cinema/movie.py | # -*- coding: utf-8 -*-
from datetime import datetime
# import json
import re
import requests
import requests_cache
from requests import ConnectionError
class MovieNotFound(Exception):
pass
class Movie(object):
__api_url = 'http://www.omdbapi.com'
__headers = {'user-agent': 'cinema/0.0.8'}
def __i... | Python | 0.000013 | @@ -5812,16 +5812,33 @@
mdbID'%5D%0A
+ try:%0A
@@ -5879,24 +5879,85 @@
dbRating'%5D)%0A
+ except ValueError:%0A self._imdb_rating = 0%0A
try:
@@ -6200,24 +6200,41 @@
o_meter = 0%0A
+ try:%0A
self
@@ -6301,16 +6301,75 @@
.date()%0A
+ except V... |
100ed05fe390588a9da646de86af90e6491b623b | bump version | sixpack/__init__.py | sixpack/__init__.py | __version__ = '0.1.4'
| Python | 0 | @@ -14,9 +14,9 @@
'0.
-1.4
+2.0
'%0A
|
ad118f0f1b011b1d15f598ae03b84c1b76e5c9d4 | Update scale_image.py | tools/scale_image/scale_image.py | tools/scale_image/scale_image.py | import argparse
import sys
import skimage.io
import skimage.transform
import scipy.misc
import warnings
import os
from PIL import Image
def scale_image(input_file, output_file, scale, order=1):
with warnings.catch_warnings():
warnings.simplefilter("ignore")
Image.MAX_IMAGE_PIXELS = 50000*50000
... | Python | 0.000002 | @@ -597,36 +597,8 @@
,')%0A
- scale.reverse()%0A
@@ -1527,8 +1527,9 @@
s.order)
+%0A
|
d854db4f257e1011ffd8cb99339a8df0e1e5fdc7 | save point before lifting | totalimpactwebapp/metric_snap.py | totalimpactwebapp/metric_snap.py | import configs
import logging
logger = logging.getLogger("tiwebapp.metric_snap")
""" *****************************************
* Factory
***************************************** """
def make(metricName, product):
relevant_config = configs.get()[metricName]
def make_metrics(product_dict):
metrics = prod... | Python | 0 | @@ -208,16 +208,21 @@
product
+_dict
):%0A r
@@ -265,16 +265,160 @@
cName%5D%0A%0A
+ # get the metric_snap dict from the product%0A metric_snap_dict = product_dict%5B%22metrics%22%5D%5B%22foo%22%5D%0A return MetricSnap(metric_snap_dict)%0A%0A
%0A%0A%0Adef m
@@ -3255,45 +3255,115 @@
lf,
-config):%0A ... |
69f85de77612ac8ed620831e1d043981395e9301 | Add pip install | zaifbot/__init__.py | zaifbot/__init__.py | import os, sys, subprocess
from zaifbot.errors import ZaifBotError
__version__ = '0.0.5'
class ZaifBot:
_process = []
def add_running_process(self, auto_trade_process):
self._process.append(auto_trade_process)
def start(self):
running_processes = []
for process in self._proces... | Python | 0.000001 | @@ -923,16 +923,70 @@
b_path)%0A
+ subprocess.call(%5B'pip', 'install', 'TA-Lib'%5D)%0A
@@ -1090,16 +1090,70 @@
-lib%22%5D)%0A
+ subprocess.call(%5B'pip', 'install', 'TA-Lib'%5D)%0A
|
0c732a4a4740fb8a4005e23e8d26415f5a9d22fd | Send ZMQ control message. | zenchimes/server.py | zenchimes/server.py | #!/usr/bin/env python
import atexit
from bottle import (route, run, template, static_file, get, post, put, request,
Bottle)
import json
import logging
import logging.config
import multiprocessing
import os
import signal
import sqlite3
import sys
from time import sleep
import zmq
from zenchimes.client import L... | Python | 0 | @@ -1990,16 +1990,42 @@
ndling.%0A
+ socket.send(%22CONFIG%22)%0A
retu
|
4e977f467fc8cccc547461e7b5ffed1e8d6f1833 | Use str.format() for date | filterss/helpers.py | filterss/helpers.py | # -*- coding: utf-8 -*-
import textwrap
import urllib
import urllib2
import re
import rfc822
from xml.dom.minidom import parse
def set_filter(value):
"""
Return filter as lower case string (for case-insensitive search) or
return None for blank/False values
"""
if value:
value = str(value)
... | Python | 0.000175 | @@ -1,13 +1,9 @@
#
- -*-
coding:
@@ -12,12 +12,8 @@
tf-8
- -*-
%0Aimp
@@ -3136,20 +3136,16 @@
y =
-str(
new_date
@@ -3147,17 +3147,16 @@
_date%5B0%5D
-)
%0A m =
@@ -3156,19 +3156,32 @@
m =
-str
+'%7B0:0%3E2%7D'.format
(new_dat
@@ -3194,19 +3194,32 @@
d =
-str
+'%7B0:0%3E2%7D'.format
(new_... |
df707de0bb8b08011cd7e875c4f7d096f6fe2bb6 | simplify cursutils initialization | src/giterm/cursutils.py | src/giterm/cursutils.py | # -*- coding: utf-8 -*-
import curses
import pdb
import sys
screen = None
initialized = False
def init(stdscr):
global screen
screen = stdscr
global initialized
initialized = True
def finalize(stdscr):
curses.nocbreak()
stdscr.keypad(0)
curses.echo()
curses.endwin()
def debug(std... | Python | 0.00004 | @@ -73,28 +73,8 @@
one%0A
-initialized = False%0A
%0A%0Ade
@@ -131,77 +131,212 @@
scr%0A
- global initialized%0A initialized = True%0A%0A%0Adef finalize(
+%0A%0Adef finalize(stdscr=None):%0A if not stdscr and not screen:%0A raise Exception('either call init() first or provide a valid window object')%... |
27fec389928c93ba0efe4ca1e4c5b34c3b73fa2c | Add a version base on djangocms version from where the code was cloned | snippet/__init__.py | snippet/__init__.py | """
"cms.plugins.snippet" (from djangocms) clone to extend it with some facilities
""" | Python | 0 | @@ -79,8 +79,33 @@
ties%0A%22%22%22
+%0A__version__ = '2.3.6.1'%0A
|
acb3257f80e19104366956ccb999d5a44d848982 | Remove warning for Django 1.8 about template settings. | djangoautoconf/base_setting_storage.py | djangoautoconf/base_setting_storage.py | import importlib
import logging
import sys
from sys import modules as sys_modules
import django
from ufs_tools.tuple_tools import remove_duplicated_keep_order
log = logging.getLogger(__name__)
# class SettingStorageInf(object):
# pass
class BaseSettingsHolder(object):
# MYSQL_DATABASE_NAME = "test"
# W... | Python | 0 | @@ -4841,13 +4841,608 @@
late_value)%0A
+ # del self.base_settings.TEMPLATE_CONTEXT_PROCESSORS%0A for template_attr in %5B%22TEMPLATE_STRING_IF_INVALID%22, %22TEMPLATE_DIRS%22, %22TEMPLATE_LOADERS%22,%0A %22TEMPLATE_DEBUG%22, attr%5D:%0A if hasattr(... |
2e4753dd9d8d377ca81f4c414b9da02ac1fa92bc | add working get_group_permissions() method to ModelBackend | djangotoolbox/contrib/auth/backends.py | djangotoolbox/contrib/auth/backends.py | try:
set
except NameError:
from sets import Set as set # Python 2.3 fallback
from django.db import connection
from djangotoolbox.contrib.auth.models import User, Permission
class ModelBackend(object):
"""
Authenticates against djangotoolbox.contrib.auth.models.User.
"""
supports_object_permis... | Python | 0.000001 | @@ -174,16 +174,82 @@
rmission
+, Group%0Afrom django.contrib.contenttypes.models import ContentType
%0A%0A%0Aclass
@@ -1023,159 +1023,604 @@
-perms = Permission.objects.filter(group__user=user_obj%0A ).values_list('content_type__app_label', 'codename'%0A ).order_by()
+# get all Gr... |
340dbf851bdea779818915df7553ba5c4a4d1b63 | switch pagination to limit/offset | patchew/settings.py | patchew/settings.py | #!/usr/bin/env python3
#
# Copyright 2016 Red Hat, Inc.
#
# Authors:
# Fam Zheng <famz@redhat.com>
#
# This work is licensed under the MIT License. Please see the LICENSE file or
# http://opensource.org/licenses/MIT.
"""
Django settings for patchew project.
Generated by 'django-admin startproject' using Django 1... | Python | 0 | @@ -2197,18 +2197,19 @@
ion.
-PageNumber
+LimitOffset
Pagi
|
7c2e67da2b26b6eebd6d11346215dbd962b3efe9 | Bump version number | flanker/__init__.py | flanker/__init__.py | __version__ = '0.9.7'
| Python | 0.000002 | @@ -16,7 +16,8 @@
0.9.
-7
+10
'%0A
|
5dc128b84d2c76fc9039c412b91c1a31dd4bfa9b | Prepare v3.0.5.dev | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | Python | 0.000003 | @@ -441,7 +441,11 @@
3.0.
-4
+5.dev
'%0A
|
1256c71a7c4908c32920b081c62075d3c9efbadf | Prepare v3.0.12.dev | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | Python | 0.000002 | @@ -438,11 +438,15 @@
= '3.0.1
-1
+2.dev
'%0A
|
4b9264c1652bcf98a58da0a0c3f56e129eb25cfe | Prepare v1.2.398.dev | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | Python | 0.000001 | @@ -443,7 +443,11 @@
2.39
-7
+8.dev
'%0A
|
de22e547c57be633cb32d51e93a6efe9c9e90293 | Remove buggy log message if prctl is missing | src/helper_threading.py | src/helper_threading.py | import threading
try:
import prctl
def set_thread_name(name): prctl.set_name(name)
def _thread_name_hack(self):
set_thread_name(self.name)
threading.Thread.__bootstrap_original__(self)
threading.Thread.__bootstrap_original__ = threading.Thread._Thread__bootstrap
threading.Thread._T... | Python | 0 | @@ -374,97 +374,8 @@
or:%0A
- log('WARN: prctl module is not installed. You will not be able to see thread names')%0A
|
23a8405bc2d478317dd6f54ce79832f47bdc3486 | Update boafiHoney.py | Honeypot/boafiHoney.py | Honeypot/boafiHoney.py | #!/usr/bin/python
##### BoafiHoney.py
### - Creates a dns black hole and starts apache server (to run a Captive Portal or any web site)
## - Dependencies : bind9,apache, (working hostspot.. dhcp & hostapd)
# - Forces every client to connect to our websites (for every http requests redirect to --> localhost)
# ... | Python | 0.000001 | @@ -3908,17 +3908,72 @@
ROUTING
-1
+-p tcp --dport 80 -j DNAT --to-destination %22+ipaddr+%22:80
%22) # Rem
@@ -4071,17 +4071,73 @@
ROUTING
-2
+-p tcp --dport 443 -j DNAT --to-destination %22+ipaddr+%22:80
%22)%0A
|
fe2b6000c3b93fb37883dab4010b7933aab1817e | Fix encoding issue in HtmlReport/generate.py | HtmlReport/generate.py | HtmlReport/generate.py | #!/usr/bin/env python3
import argparse
import os
import shutil
import cgi
import xml.etree.ElementTree as ET
def parse_args():
parser = argparse.ArgumentParser(description='Generate colobot-lint HTML report from XML report file')
parser.add_argument('--xml-report-file', required=True, help='colobot-lint report... | Python | 0.000004 | @@ -960,16 +960,34 @@
ame, 'w'
+, encoding='utf-8'
) as out
|
1b6eecc10e45aa0728ea48fd8b00419396765f1e | Complete main | IpfriExtractor/Main.py | IpfriExtractor/Main.py | '''
Created on 14/01/2014
@author: Dani
'''
import logging
from ConfigParser import ConfigParser
from es.weso.extractor.IpfriExtractor import IpfriExtractor
from es.weso.translator.ipfri_trasnlator import IpfriTranslator
def configure_log():
FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
logg... | Python | 0.000764 | @@ -1,11 +1,11 @@
-'''
+%22%22%22
%0ACreated
@@ -38,11 +38,453 @@
ani%0A
-'''
+%22%22%22%0A%0Aimport os%0Aimport sys%0A%0Asys.path.append(os.path.dirname(os.path.realpath(__file__)))%0Asys.path.append(os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir), 'CountryReconciler'))%0Asys.path.a... |
c73db72d2ec46423c36b89f3ca78483a8b726188 | Set kAECanInteract and kAECanSwitchLayer flags for the finder interactions. | Mac/Lib/findertools.py | Mac/Lib/findertools.py | """Utility routines depending on the finder."""
import Finder_7_0_Suite
import aetools
import MacOS
import sys
import macfs
SIGNATURE='MACS'
class Finder(aetools.TalkTo, Finder_7_0_Suite.Finder_7_0_Suite):
pass
_finder_talker = None
def _getfinder():
global _finder_talker
if not _finder_talker:
_finder_talke... | Python | 0 | @@ -66,16 +66,35 @@
0_Suite%0A
+import AppleEvents%0A
import a
@@ -354,16 +354,138 @@
NATURE)%0A
+%09_finder_talker.send_flags = ( _finder_talker.send_flags %7C %0A%09%09AppleEvents.kAECanInteract %7C AppleEvents.kAECanSwitchLayer)%0A
%09return
|
f1937ba3381468644c3b1b01d01a73eff0b91031 | Create v0.10 branch | pgmapcss/version.py | pgmapcss/version.py | __all__ = 'VERSION', 'VERSION_INFO'
#: (:class:`tuple`) The version tuple e.g. ``(0, 9, 2)``.
VERSION_INFO = (0, 9, 0)
#: (:class:`basestring`) The version string e.g. ``'0.9.2'``.
if len(VERSION_INFO) == 4:
VERSION = '%d.%d.%d-%s' % VERSION_INFO
elif type(VERSION_INFO[2]) == str:
VERSION = '%d.%d-%s' % VERSI... | Python | 0 | @@ -111,12 +111,17 @@
(0,
-9, 0
+10, 'dev'
)%0A%0A#
|
140ea03a727e6f4301820efec07e0deda16ca0b4 | Set version 1.12.9 | phono3py/version.py | phono3py/version.py | # Copyright (C) 2013 Atsushi Togo
# All rights reserved.
#
# This file is part of phonopy.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notic... | Python | 0.000001 | @@ -1599,7 +1599,7 @@
.12.
-8
+9
%22%0A
|
06b42fd6f2bd6276abcbf54eede6af6efb081ccf | Remove Fn::FindInMap from HOT | heat/engine/hot/functions.py | heat/engine/hot/functions.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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 applicabl... | Python | 0.000058 | @@ -6231,58 +6231,8 @@
n %7B%0A
- 'Fn::FindInMap': cfn_funcs.FindInMap,%0A
|
394ba974ebb7bf2f6400cf5bdd6550d667b7b7ef | add underscore | hoomd/update/remove_drift.py | hoomd/update/remove_drift.py | # Copyright (c) 2009-2021 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause
# License.
"""Implement RemoveDrift."""
import hoomd
from hoomd.operation import Updater
from hoomd.data.typeconverter import NDArrayValidator
from hoomd import _hoomd
imp... | Python | 0.99977 | @@ -1097,16 +1097,18 @@
thrm%7Bmin
+%5C_
image%7D(%5C
|
61ef80e2c5aab9ed58687ddcf43d53e3e669c827 | Fix issue in __init__.py | fntools/__init__.py | fntools/__init__.py | """
fntools: functional programming tools for data processing
=========================================================
"""
from .fntools import use_with, zip_with, unzip, concat, mapcat, dmap, rmap, replace,\
compose, groupby, reductions, split, assoc, dispatch, multimap,\
multistarmap, pipe, pipe_ea... | Python | 0.000002 | @@ -359,14 +359,34 @@
tes,
- pluck
+%0A pluck, pluck_each
, us
|
a829d13af49c019171482518b6eb352e76b5a460 | Add deployment settings | forkmon/settings.py | forkmon/settings.py | """
Django settings for forkmon project.
Generated by 'django-admin startproject' using Django 1.11.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os... | Python | 0.000001 | @@ -729,16 +729,55 @@
kud!em-'
+%0A#SECRET_KEY = os.environ%5B'SECRET_KEY'%5D
%0A%0A# SECU
@@ -919,16 +919,20 @@
',%0A '
+www.
btcforkm
@@ -3570,8 +3570,328 @@
'static'
+%0A%0A# Security stuff for deploy only%0A# SESSION_COOKIE_SECURE = True%0A# CSRF_COOKIE_SECURE = True%0A# SECURE_SSL_REDIRECT = True%0A# SECUR... |
4232c762888fe70a035693a8313cc0adb02e257b | update comparisons in BlackBody1D tests for new version of constants | astropy/modeling/tests/test_blackbody.py | astropy/modeling/tests/test_blackbody.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, unicode_literals, division,
print_function)
import pytest
import numpy as np
from ..blackbody import BlackBody1D
from ..fitting import LevMarLSQFitter
from ...tests.helper import assert_q... | Python | 0 | @@ -951,39 +951,39 @@
.micron), 47
-56726.111003904
+34464.498937388
* u.Jy)%0A
@@ -1040,23 +1040,23 @@
, 47
-56726.111003904
+34464.498937388
* u
@@ -1391,18 +1391,18 @@
0.74
-3996797581
+4774408546
* u
@@ -1473,17 +1473,17 @@
1837
-5
296
-44375
+857152
e-08
|
4b55855c4aae3abee9266a07294b0b7b32d3475a | Fix typo. | asyncqlio/backends/postgresql/asyncpg.py | asyncqlio/backends/postgresql/asyncpg.py | """
The :ref:`asyncpg` connector for PostgreSQL databases.
"""
import asyncio
import logging
import typing
import warnings
import asyncpg
from asyncpg import Record
from asyncpg.cursor import Cursor
from asyncpg.transaction import Transaction
from asyncqlio.backends.base import BaseConnector, BaseResultSet, BaseTrans... | Python | 0.001604 | @@ -3896,18 +3896,20 @@
s to exc
-us
+ecut
e with.%0A
|
2701a22db4243495080d53192033f1ef07f7625c | Add method to truncate long error messages. | i3pystatus/core/threading.py | i3pystatus/core/threading.py | import threading
import time
import sys
import traceback
from i3pystatus.core.util import partition
timer = time.perf_counter if hasattr(time, "perf_counter") else time.clock
class Thread(threading.Thread):
def __init__(self, target_interval, workloads=None, start_barrier=1):
super().__init__()
s... | Python | 0 | @@ -2170,17 +2170,88 @@
_name__,
-
+%0A self.format_error(str(
sys.exc_
@@ -2260,16 +2260,18 @@
fo()%5B1%5D)
+))
,%0A
@@ -2323,16 +2323,337 @@
%7D%0A%0A
+ def format_error(self, exception_message):%0A if hasattr(self.workload, 'max_error_len'):%... |
dccd8f16c7121be04bd9883fee0a731a963ce5f3 | remove unneeded pass statements | src/choo/apis/efa/queries/locations.py | src/choo/apis/efa/queries/locations.py | from .... import queries
from ....models import POI, Address, GeoPoint, Stop, Way
from ....types import WayType
from ..parsers.locations import OdvLocationList
class LocationQueryExecuter:
def _execute(self):
location = self._convert_unique_location()
if location:
return self._stopfind... | Python | 0.000043 | @@ -3263,25 +3263,16 @@
ation()%0A
- pass%0A
%0A%0Aclass
@@ -3539,17 +3539,8 @@
ation()%0A
- pass%0A
|
e1439bf9b449df6fc49b7d90bd33704ceb4c9c38 | Fix spelling error | drift/management/commands/runserver.py | drift/management/commands/runserver.py | """
Run all apps in this project as a console server.
"""
import subprocess
import sys
import logging
import os
import socket
from drift import webservers
from drift.utils import pretty
log = logging.getLogger(__name__)
def get_options(parser):
parser.add_argument("--server", '-s',
help="Server type to ... | Python | 0.999897 | @@ -3155,16 +3155,17 @@
g --loca
+l
servers%5C
|
f00ff91ec9521cec2ef75fc165180307b8bf8321 | test estructura temporal | banking/tests/test_credit_constructor.py | banking/tests/test_credit_constructor.py | '''
Created on 8/06/2017
@author: spectre
'''
from credit.constructor import *
import pytest
def test_my_function():
assert Prueba(2, 1).my_function() == 3
| Python | 0.000001 | @@ -102,83 +102,131 @@
%0D%0A%0D%0A
-%0D%0A%0D%0Adef test_my_function():%0D%0A assert Prueba(2, 1).my_function() == 3%0D%0A %0D%0A%0D%0A
+class TestEstructuraTemporal(object):%0D%0A %0D%0A def test_one(self):%0D%0A pass%0D%0A %0D%0A def test_two(self):%0D%0A pass
|
cce6504add793172a9319cbb5b8fd2d39f6cff02 | attach cfg | pines/daskworker.py | pines/daskworker.py |
from . import configure
import os
import logging, logging.handlers
_time_format = '%b %d %H:%M:%S'
_mess_format = '%(asctime)15s %(name)s %(levelname)s %(message)s'
_worker_local_dir = None
def new_worker(scheduler=None, name=None, cfg=None, gui_loop_callback=None, resources=None, **kwargs):
global ... | Python | 0.000001 | @@ -1795,16 +1795,32 @@
port%0D%0A%0D%0A
+%09w.cfg = cfg%0D%0A%0D%0A
%09_worker
|
92ec14fd32ba0c2609a8a64898036197fbb5fa70 | allow storage to overwrite files | pipeline/storage.py | pipeline/storage.py | import os
from datetime import datetime
from django.core.files.storage import FileSystemStorage, get_storage_class
from django.utils.functional import LazyObject
from pipeline.conf import settings
class PipelineStorage(FileSystemStorage):
def __init__(self, location=None, base_url=None, *args, **kwargs):
... | Python | 0.000001 | @@ -541,16 +541,137 @@
wargs)%0A%0A
+ def get_available_name(self, name):%0A if self.exists(name):%0A self.delete(name)%0A return name%0A%0A
def
|
a25920e3549933e4c6c158cc9490f3eaa883ec66 | Use the same child->parent "formula" used by heapq.py. | Lib/test/test_heapq.py | Lib/test/test_heapq.py | """Unittests for heapq."""
from test.test_support import verify, vereq, verbose, TestFailed
from heapq import heappush, heappop
import random
def check_invariant(heap):
# Check the heap invariant.
for pos, item in enumerate(heap):
parentpos = ((pos+1) >> 1) - 1
if parentpos >= 0:
... | Python | 0 | @@ -247,38 +247,37 @@
-parentpos = ((pos+1) %3E%3E 1) - 1
+if pos: # pos 0 has no parent
%0A
@@ -281,18 +281,19 @@
-if
+
parentp
@@ -299,13 +299,22 @@
pos
-%3E= 0:
+= (pos-1) %3E%3E 1
%0A
|
1a7a455e5851ee07f341ebf68210a9faf18e06ee | Add necessary setting | frosted/settings.py | frosted/settings.py | """frosted/settings.py.
Defines how the default settings for frosted should be loaded
(First from the default setting dictionary at the top of the file, then overridden by any settings
in ~/.frosted.conf if there are any)
Copyright (C) 2013 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to a... | Python | 0.000012 | @@ -1928,16 +1928,50 @@
erbose':
+ False,%0A 'run_doctests':
False%7D%0A
|
22937ae3ac01df89d0bf1018f62c7b9cbae76627 | change event registry to a set to make sure the same function is not called twice | panoply/events.py | panoply/events.py | class Emitter(object):
_events = None
def __init__(self, events={}):
self._events = events
def on(self, name, fn):
self._events.setdefault(name, []).append(fn)
return self
def fire(self, name, data):
for fn in self._events.get("*", []):
fn(name, data)
... | Python | 0.000001 | @@ -172,17 +172,19 @@
me,
+set(
%5B%5D)
+)
.a
-ppen
+d
d(fn
@@ -278,19 +278,24 @@
et(%22*%22,
+set(
%5B%5D)
+)
:%0A
@@ -357,19 +357,24 @@
t(name,
+set(
%5B%5D)
+)
:%0A
|
92324936c5967a18d86365258b435f487c440e77 | Handle pyglet 2 pixel size ratio | imgui/integrations/pyglet.py | imgui/integrations/pyglet.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from pyglet.window import key, mouse
import imgui
from . import compute_fb_scale
from .opengl import ProgrammablePipelineRenderer
class PygletMixin(object):
REVERSE_KEY_MAP = {
key.TAB: imgui.KEY_TAB,
key.LEFT: imgui.KEY_LEFT_ARROW,... | Python | 0 | @@ -3154,31 +3154,72 @@
-viewport_size =
+self.io.display_size = window_size%0A%0A if hasattr(
window
-.
+, '
get_
@@ -3231,19 +3231,19 @@
ort_size
-()%0A
+'):
%0A
@@ -3247,43 +3247,59 @@
-self.io.display_size = window_size%0A
+ viewport_size = window.get_viewport_size()%0A
@... |
a7c5de1951b8369f9fcd4b408b16160bb176b42c | remove path and binning columns from metadata some PEP8 | planet4/metadata.py | planet4/metadata.py | """Provides tools to create the required metadata for the analysis of P4 data.
"""
from pathlib import Path
import numpy as np
import pandas as pd
import pvl
from osgeo import gdal
from hirise_tools import downloads, labels, products
from . import io
REGIONS = ['Inca', 'Ithaca', 'Giza', 'Manhattan2', 'Starburst', '... | Python | 0 | @@ -773,17 +773,19 @@
os.size)
-/
+ /
band.siz
@@ -1741,24 +1741,16 @@
etadata%0A
-
%0A
@@ -2072,17 +2072,16 @@
created
-
%0A
@@ -2226,47 +2226,8 @@
sid,
- path=labelpath, binning=label.binning,
%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.