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
4fba284d8e66e02bc9b48622b019b125ea5944b0
Add test in SQLite_test.py
PyDbLite/test/SQLite_test.py
PyDbLite/test/SQLite_test.py
import os import sys sys.path.append(os.path.dirname(os.path.dirname(__file__))) import SQLite db = SQLite.Base("test",'test.sqlite') db.create(("name",'TEXT NOT NULL'), ("age","INTEGER"), ("size","REAL"),("birth","BLOB"), ("ctime","BLOB DEFAULT CURRENT_TIME"), ("ctimestamp","BLOB DEFAULT C...
Python
0.000006
@@ -968,16 +968,58 @@ db%5B20%5D%0D%0A +print len(db),'records'%0D%0Aprint len(db())%0D%0A raw_inpu
a63da3a289df519f3d45aaa771bb5b5228ec1bed
check that viewargs is initialized before using it in get_used_coverage
source/jormungandr/jormungandr/authentication.py
source/jormungandr/jormungandr/authentication.py
# encoding: utf-8 # Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # Hope you'll enjoy and contribute to this project, # powered by Canal TP (www.canaltp.fr). # Help us simplify mobilit...
Python
0
@@ -6920,24 +6920,46 @@ %22%22%22%0A if +request.view_args and 'region' in
9f4d54ff485f422e776b496692c059c9cbfb5dde
Fix Mtg
Functions/Mtg.py
Functions/Mtg.py
from IRCMessage import IRCMessage from IRCResponse import IRCResponse, ResponseType from Function import Function import WebUtils import re from bs4 import BeautifulSoup class Instantiate(Function): Help = 'mtg(f) <card name> - fetches details of the Magic: The Gathering card you specify from gatherer....
Python
0.000012
@@ -826,305 +826,310 @@ -if page.find('Card Name:') %3C= 0:%0D%0A return IRCResponse(ResponseType.Say, 'Multiple or no cards found: ' + searchTerm, message.ReplyTo)%0D%0A%0D%0A soup = BeautifulSoup(webPage.Page)%0D%0A%0D%0A name = soup.find('div', %7B'id' : 'ctl00_ctl00_ctl00_MainContent_...
8cf21ee2a432e9cbc1d93ae67f808c2c918c2a92
enforce UTF-8 on the envvar for now, i should take this from the system env and re-export but it'll work for now
karmabot.py
karmabot.py
import json import shlex import sys from twisted.internet import defer, endpoints from twisted.internet.protocol import Factory from twisted.internet.task import react, deferLater from twisted.protocols.basic import LineOnlyReceiver from twisted.python import log from twisted.words.protocols.irc import IRCClient impo...
Python
0
@@ -6081,16 +6081,45 @@ parser'%5D +, env=%7B'LANG': 'en_US.UTF-8'%7D )%0A ka
308924cd852f13212e0ca758c2eccc588af38b24
Fix ResourcesProxy::getPath
UM/Qt/Bindings/ResourcesProxy.py
UM/Qt/Bindings/ResourcesProxy.py
from PyQt5.QtCore import QObject, pyqtSlot, QUrl from UM.Resources import Resources class ResourcesProxy(QObject): ResourcesLocation = Resources.ResourcesLocation SettingsLocation = Resources.SettingsLocation PreferencesLocation = Resources.PreferencesLocation def __init__(self, parent = None): ...
Python
0.000001
@@ -41,16 +41,25 @@ ot, QUrl +, Q_ENUMS %0A%0Afrom U @@ -119,16 +119,40 @@ bject):%0A + class Location:%0A Reso @@ -191,24 +191,28 @@ cesLocation%0A + Settings @@ -253,16 +253,20 @@ ion%0A + + Preferen @@ -308,16 +308,88 @@ Location +%0A ThemesLocation = Resources.ThemesLocati...
c9f990ff4095b7fb361b2d59c0c5b2c9555643ff
Remove left over merge conflict text
csunplugged/tests/BaseTest.py
csunplugged/tests/BaseTest.py
"""Base test class with methods implemented for Django testing.""" from django.test import TestCase from django.contrib.auth.models import User from django.test.client import Client from django.utils.translation import activate <<<<<<< HEAD class BaseTest(SimpleTestCase): """Base test class with methods implemen...
Python
0
@@ -228,21 +228,8 @@ e%0A%0A%0A -%3C%3C%3C%3C%3C%3C%3C HEAD%0A clas
4c3ab0d3332f1df3812a35b3fc86ef2c552aa382
Allow putting kay project into subdirectories.
kay/main.py
kay/main.py
# -*- coding: utf-8 -*- """ Kay main handler script. :Copyright: (c) 2009 Accense Technology, Inc. All rights reserved. :license: BSD, see LICENSE for more details. """ import logging import os import sys import kay kay.setup() from kay.app import get_application from kay.utils.handlers import KayHandler from kay....
Python
0
@@ -202,16 +202,97 @@ rt sys%0A%0A +sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__))))%0A%0A import k
5b0068065487e2c460b897fa790611d88124af90
Add final 'sidx' reference for the last part of a file.
dash-indexer.py
dash-indexer.py
#!/usr/bin/env python3 import argparse from collections import defaultdict from itertools import count import os from ts import TSPacket from isobmff import SidxBox, SidxReference, StypBox def index_media_segment(media_file_name, template, force, verbose): random_access_points = defaultdict(list) if verbose: ...
Python
0
@@ -931,16 +931,38 @@ _offset) +%0A eof = byte_offset %0A%0A bo @@ -1045,16 +1045,49 @@ tems():%0A + byte_offsets.append(eof)%0A
bdc9839785e0922486cbf26474a3abce103ba3f9
Update CLI: use -c instead of -i option to check db ref. integrity
siga.py
siga.py
""" Generate semantically interoperable genome annotations from GFF[1] files according to the RDF[2] specification. References: [1] Generic Feature Format specification, http://www.sequenceontology.org/gff3.shtml [2] Resource Description Framework, https://www.w3.org/TR/rdf11-concepts/ Usage: siga.py -h | --help ...
Python
0.000773
@@ -348,17 +348,17 @@ ga.py %5B- -i +c V %5D %5B -d @@ -675,75 +675,8 @@ b%5D.%0A - -i Check the referential integrity of database(s).%0A -o @@ -778,16 +778,83 @@ turtle%5D +%0A -c Check the referential integrity of database(s). %0A%0A%22%22%22%0A%0Af @@ -3159,17 +3159,17 @@ arg...
3d56133237b8ca79eb6f96c5cd94dc8bb0f71476
Update __openerp__.py
partner_school/__openerp__.py
partner_school/__openerp__.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar) # All Rights Reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Pu...
Python
0.000024
@@ -1363,33 +1363,8 @@ .ar' -,%0A 'license': 'AGPL-3' %0A%7D%0A%0A
5cc3518b310ca2c2a06fa8ed5e4dabf1704ad8c0
Fix ASHRAE call
Web/scripts/CPWeb/SphinxTools.py
Web/scripts/CPWeb/SphinxTools.py
import CoolProp import os fluid_template = """.. _fluid_{fluid:s}: {fluid_stars:s} {fluid:s} {fluid_stars:s} References ========== {references:s} {aliases:s} Fluid Information ================= .. csv-table:: :header-rows: 1 :widths: 40, 60 :file: {fluid:s}-info.csv REFPROP Validation Data ==========...
Python
0.000005
@@ -2059,16 +2059,18 @@ %22ASHRAE +34 %22)%0A
b67cf524519b69880541b8973009249f57562b71
add -depend argument to fill in default values with dependencies.yaml when app build;
snap.py
snap.py
#!/usr/bin/python import argparse import yaml import sys import os from core.app import App from core.pipe import WorkflowParameter from core.pipe import Pipe def new_app(args): if args.name: app = App(args.name) app.new() else: subparsers_app_new.print_help() print >> sys.std...
Python
0
@@ -793,16 +793,45 @@ s.param, + dependence_file=args.depend, output= @@ -3600,32 +3600,137 @@ ot specified.%22)%0A + subparsers_app_build.add_argument('-depend', help = %22render defaults from dependencies.yaml file. %22)%0A subparsers_a
d4f17b473a7f960db11842886be76ffe33e94fa9
Version 1.3.1.
pausable_unittest/__init__.py
pausable_unittest/__init__.py
# coding: utf-8 # The MIT License (MIT) # Copyright (c) 2016-2017 Masamitsu MURASE # 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 limitati...
Python
0
@@ -1282,17 +1282,17 @@ = %221.3. -0 +1 %22%0D%0A%0D%0Adef
0fa3b4e894b66275b3c7c77d9a053fa596c08edb
Update batchflow/tests/torch_models_test.py
batchflow/tests/torch_models_test.py
batchflow/tests/torch_models_test.py
""" Test for creation and running torch models. """ # pylint: disable=import-error, no-name-in-module # pylint: disable=redefined-outer-name import pytest import numpy as np from batchflow import Pipeline, ImagesBatch, Dataset from batchflow import B, V, C from batchflow.models.torch import VGG7 MODELS = [VGG7] @pyt...
Python
0
@@ -1012,19 +1012,22 @@ ' +inputs/ labels -': %7B' +/ clas @@ -1035,17 +1035,16 @@ es': 10%7D -%7D ,%0A
d14e676436532a014fb1d91c709e1f0c97ad176a
update documentation
pdxapartmentfinder/crawler.py
pdxapartmentfinder/crawler.py
# -*- coding: utf-8 -*- """ Created on Thu Jan 7 10:59:34 2016 @author: Riley Rustad <rileyrustad@gmail.com> This Script is designed to scrape data from Multnomah County apartment ads from Craigslist. """ # ============================================================================= # Imports import numpy as np ...
Python
0
@@ -1015,163 +1015,12 @@ ther -%0A %0A Parameters%0A ----------%0A x : a dictionary%0A %0A y : a dictionary%0A %0A Returns%0A -------%0A The time a listing was posted.%0A '''%0A + @@ -1398,18 +1398,22 @@ rogress( +( it ++1) , len(pa @@ -2905,16 +2905,16 @@ close()%0A + Mas...
305da4001219a014360f4529a2cfa8428a53a9a0
convert language to locale
phonenumber_field/widgets.py
phonenumber_field/widgets.py
# -*- coding: utf-8 -*- from babel import Locale from phonenumbers.data import _COUNTRY_CODE_TO_REGION_CODE from django.utils import translation from django.forms import Select, TextInput from django.forms.widgets import MultiWidget from phonenumber_field.phonenumber import PhoneNumber class PhonePrefixSelect(Sel...
Python
0.999999
@@ -452,16 +452,38 @@ slation. +to_locale(translation. get_lang @@ -489,16 +489,17 @@ guage()) +) %0A
4173a544ce18dafe46be822921763e37d4a44a18
add cvc4
benchexec/tools/ultimateautomizer.py
benchexec/tools/ultimateautomizer.py
""" BenchExec is a framework for reliable benchmarking. This file is part of BenchExec. Copyright (C) 2015 Daniel Dietsch 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 ...
Python
0.000057
@@ -954,16 +954,41 @@ ation%22,%0A + %22cvc4%22%0A
3dd5e43ab04d992bb175bb36e6d0db49aec5e9f7
Fix yaml format of --symmetry output
phonopy/cui/show_symmetry.py
phonopy/cui/show_symmetry.py
# Copyright (C) 2011 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.99955
@@ -3653,18 +3653,20 @@ ersion: +' %25s +' %22 %25 phon @@ -3735,79 +3735,269 @@ -yaml.append(%22space_group_type: %22 + symmetry.get_international_table())%0A +spg_symbol, spg_number = symmetry.get_international_table().split()%0A spg_number = int(spg_number.replace('(', '').replace(')', ''))%0A ...
67c8ae9f27bce7ae07123c1039a4a3080e9f00ae
Replace deprecated django.core.cache.get_cache
django_extensions/jobs/daily/cache_cleanup.py
django_extensions/jobs/daily/cache_cleanup.py
# coding=utf-8 """ Daily cleanup job. Can be run as a cronjob to clean out old data from the database (only expired sessions at the moment). """ from contextlib import contextmanager import six from django_extensions.management.jobs import DailyJob class Job(DailyJob): help = "Cache (db) cleanup Job" def...
Python
0
@@ -889,25 +889,22 @@ import -get_ cache +s %0A @@ -1131,18 +1131,15 @@ e = -get_ cache -( +s%5B cach @@ -1144,17 +1144,17 @@ che_name -) +%5D %0A
8d47940ddf80d49102f72f78d485d884b14694ff
implement static rebalance test with index
perfrunner/tests/rebalance.py
perfrunner/tests/rebalance.py
import time from perfrunner.tests import PerfTest from multiprocessing import Event def with_delay(method): def wrapper(self, *args, **kwargs): time.sleep(self.rebalance_settings.start_after) method(self, *args, **kwargs) time.sleep(self.rebalance_settings.stop_after) self.shutdo...
Python
0
@@ -4,16 +4,50 @@ ort time +%0Afrom multiprocessing import Event %0A%0Afrom p @@ -82,41 +82,51 @@ est%0A -%0A from -multiprocessing import Even +perfrunner.tests.index import IndexTes t%0A%0A%0A @@ -1301,8 +1301,390 @@ debug()%0A +%0A%0Aclass StaticRebalanceWithIndexTest(RebalanceTest, IndexTest):%0A%0A def r...
a02fd405c1fd5a86a4a3fb2e374d0c23ea204834
use less stupid words in tests
hanzo/httptools/tests/parse_test.py
hanzo/httptools/tests/parse_test.py
import unittest2 from StringIO import StringIO from hanzo.httptools.messaging import RequestParser, ResponseParser get_request = "\r\n".join( [ "GET / HTTP/1.1", "Host: example.org", "", "", ]) get_response = "\r\n".join( [ "HTTP/1.1 200 OK", "Host: example.org", "Content-Length:5", ...
Python
0.000182
@@ -326,11 +326,11 @@ %22 -but +tes ts%22,
a72428ffa1bfe1a7d4f05876e77bc9332752144f
Clean up parse tests a little.
hanzo/httptools/tests/parse_test.py
hanzo/httptools/tests/parse_test.py
import unittest2 from StringIO import StringIO from hanzo.httptools.messaging import RequestMessage, ResponseMessage get_request = "\r\n".join( [ "GET / HTTP/1.1", "Host: example.org", "", "", ]) get_response = "\r\n".join( [ "HTTP/1.1 200 OK", "Host: example.org", "Content-Length: 5", ...
Python
0
@@ -114,16 +114,52 @@ ssage%0A%0A%0A +class Get(unittest2.TestCase):%0A%0A get_requ @@ -175,24 +175,32 @@ %5Cn%22.join( %5B%0A + %22GET / H @@ -201,32 +201,40 @@ ET / HTTP/1.1%22,%0A + %22Host: examp @@ -246,31 +246,63 @@ g%22,%0A -%22%22,%0A %22%22,%0A%5D)%0A + %22%22,%...
cebe264462553bca38be7938edfecd323a5413cc
add unit tests for bivariate k sample
permute/tests/test_ksample.py
permute/tests/test_ksample.py
from __future__ import (absolute_import, division, print_function, unicode_literals) from nose.plugins.attrib import attr from nose.tools import assert_raises, raises import numpy as np from numpy.random import RandomState from numpy.testing import assert_equal, assert_almost_equal, assert_arr...
Python
0
@@ -445,50 +445,191 @@ le, -one_way_anova)%0Aimport permute.data as data +%0A one_way_anova,%0A bivariate_k_sample,%0A two_way_anova)%0Aimport permute.data as data%0Afrom permute.utils import get_prng%0A %0A%0Ade @@ -734,16 +734,27 @@ y anova' +, rep...
e1c453c3a1c7e63c48e86bb4b60517d8c52bbe37
normalise kwarg in HOG unnecessary (should be set to default False, not None). Also changed the image numpy arrays to be logged and normalized between -1 and 1
pipeline/image_processing.py
pipeline/image_processing.py
import numpy as np import copy from sklearn.base import BaseEstimator def load_images(filenames): '''Expects filenames to be a list of .fits file locations''' from astropy.io.fits import getdata return [getdata(filename).copy()/np.max(getdata(filename).copy()) for filename in filenames] class MedianSmooth...
Python
0.000004
@@ -209,16 +209,23 @@ return %5B +np.log( getdata( @@ -233,22 +233,16 @@ ilename) -.copy( )/np.max @@ -242,16 +242,30 @@ /np.max( +np.abs(np.log( getdata( @@ -277,14 +277,9 @@ ame) -.copy( +) )) f @@ -919,27 +919,9 @@ , 3) -, normalise = False + ):%0A @@ -1057,43 +1057,8 @@ lock -%0A self.normalise ...
7c436d38890083cd833091971e40f0c977993570
Fix some re-raising of exceptions in system tests
tests/kafkatest/tests/client/client_compatibility_features_test.py
tests/kafkatest/tests/client/client_compatibility_features_test.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
Python
0.000004
@@ -1936,18 +1936,16 @@ raise - e %0A%0A%0Aclass @@ -4118,18 +4118,16 @@ raise - e %0A%0A @p
6970f5d0c4387b055f9bba032933ff28baf69725
Remove unnecessary desc arg
bqx/query.py
bqx/query.py
import textwrap import bqx.parts import bqx.abstract from copy import deepcopy Column = bqx.parts.Column Table = bqx.parts.Table Alias = bqx.abstract.Alias class Query: def __init__(self, udf=[], indent=True, auto_alias=False): self.partial = True self.applied_c = [] self.alias_name = Non...
Python
0.000207
@@ -2242,104 +2242,11 @@ row -, desc=False):%0A if desc:%0A s = 'ORDER BY %25s DESC' %25 str(row)%0A else:%0A +):%0A
0ab2da918cbf0e58cf850f6868f5b896ea5c3893
Make NickServIdentify play nice with service specific configs
heufybot/modules/util/nickservid.py
heufybot/modules/util/nickservid.py
from twisted.plugin import IPlugin from heufybot.moduleinterface import BotModule, IBotModule from zope.interface import implements import logging class NickServIdentify(BotModule): implements(IPlugin, IBotModule) name = "NickServIdentify" def hookBot(self, bot): self.bot = bot def actions(...
Python
0
@@ -547,34 +547,100 @@ self.bot.config + and %22nickserv_nick%22 not in self.bot.config%5B%22servers%22%5D%5BserverName%5D :%0A - nick @@ -873,33 +873,67 @@ self.bot.config -%5B +.serverItemWithDefault(serverName, %22nickserv_nick%22%5D @@ -931,17 +931,29 @@ rv_nick%22 -%5D +, %22NickServ%22) %0A ...
ff98832bb2e37ad6d4aeec3dc4d092cd2092d539
Implement memory debugger for departure
infomodules/departure/dvb.py
infomodules/departure/dvb.py
import ast from datetime import datetime, timedelta import socket import warnings import urllib.error import infomodules.utils class Departure(object): URL = "http://widgets.vvo-online.de/abfahrtsmonitor/Abfahrten.do?ort=Dresden&hst={}" MAX_AGE = timedelta(seconds=30) def __init__(self, stop_name, user_a...
Python
0.000005
@@ -333,16 +333,57 @@ ure/1.0%22 +,%0A debug_memory_use=False ):%0A @@ -528,16 +528,66 @@ p = None +%0A self._debug_memory_use = debug_memory_use %0A%0A de @@ -1731,37 +1731,199 @@ (self):%0A -try:%0A +if self._debug_memory_use:%0A print(%22DEPARTURE: before get%22...
c1ea1e71155bea6e0fa6fe4dcb67bec364ae79ec
remove stray print statements
legistar/people.py
legistar/people.py
from .base import LegistarScraper class LegistarPersonScraper(LegistarScraper): MEMBERLIST = None def councilMembers(self, follow_links=True) : for page in self.pages(self.MEMBERLIST) : table = page.xpath( "//table[@id='ctl00_ContentPlaceHolder1_gridPeople_ctl00']")[0] ...
Python
0.999997
@@ -463,45 +463,8 @@ ct:%0A - print(councilman) %0A @@ -781,46 +781,8 @@ iv)) -%0A print(councilman) %0A%0A
1e36875e57c489bc513340e1cf4098610c96e982
Stop using legacy Serializer
piwik/indico_piwik/reports.py
piwik/indico_piwik/reports.py
# This file is part of the Indico plugins. # Copyright (C) 2002 - 2021 CERN # # The Indico plugins are free software; you can redistribute # them and/or modify them under the terms of the MIT License; # see the LICENSE file for more details. from collections import defaultdict from datetime import timedelta from sqla...
Python
0
@@ -565,54 +565,8 @@ rver -%0Afrom indico.util.serializer import Serializer %0A%0Afr @@ -1026,20 +1026,8 @@ Base -(Serializer) :%0A @@ -1071,34 +1071,43 @@ ion%22%22%22%0A%0A -__public__ +serializable_fields = %5B%5D%0A de @@ -2059,27 +2059,24 @@ kwargs). -to_ serializ able()%0A%0A @@ -2059,35 +2059,...
70737f757c67446859b604425d28dca233b99769
fix xml order in terp
som_generationkwh/__terp__.py
som_generationkwh/__terp__.py
# -*- coding: utf-8 -*- { "name": "Generation kWh", "description": """Support for SomEnergia's Generation kWh in GisceERP""", "version": "2.0", "author": "GISCE-TI & Som Energia", "category": "Master", "depends": [ 'base', "poweremail", "poweremail_references", 'som_polissa_soci', 'som_i...
Python
0.000023
@@ -649,24 +649,122 @@ yment.xml%22,%0A + %22wizard/wizard_investment_creation.xml%22,%0A %22wizard/wizard_investment_cancel_or_resign.xml%22,%0A %22investm @@ -985,106 +985,8 @@ xml%22 -,%0A %22wizard/wizard_investment_creation.xml%22,%0A %22wizard/wizard_investment_cancel_or_resign.xml%22 %0A
35d14348ce419421bba2b043ea2818c185526301
Comment out fix_fee_product_index from migration
ratechecker/migrations/0002_remove_fee_loader.py
ratechecker/migrations/0002_remove_fee_loader.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.22 on 2019-10-31 16:33 from __future__ import unicode_literals from django.db import migrations, OperationalError, ProgrammingError def fix_fee_product_index(apps, schema_editor): table_name = 'cfpb.ratechecker_fee' index_name = 'idx_16977_product_id' try...
Python
0
@@ -230,88 +230,8 @@ r):%0A - table_name = 'cfpb.ratechecker_fee'%0A index_name = 'idx_16977_product_id'%0A @@ -804,32 +804,33 @@ ons = %5B%0A +# migrations.RunPy
d3b7c78bb2505603b7d827f388cf9b68de70f442
Añade filtros para busqueda de event
webapp/filters.py
webapp/filters.py
from django.db import models from django.db.models import Value as V from django.db.models import Q from django.db.models.functions import Concat from django.utils.translation import ugettext_lazy as _ import django_filters from core.models import Group class PersonFilter(django_filters.FilterSet): q = django_...
Python
0.000001
@@ -248,16 +248,23 @@ rt Group +, Event %0A%0A%0Aclass @@ -1348,28 +1348,328 @@ oup_name__icontains=value))%0A +%0A%0Aclass EventFilter(django_filters.FilterSet):%0A%0A q = django_filters.CharFilter(name='event_name', method='custom_filter')%0A%0A class Meta:%0A model = Event%0A fields = %5B%5D%0...
2a83e5eba8a92d7391fb914e335859a38dd19451
Add lint test and format generated code (#4114)
java-monitoring/google-cloud-monitoring/synth.py
java-monitoring/google-cloud-monitoring/synth.py
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
Python
0
@@ -696,80 +696,209 @@ gcp%0A -%0Agapic = gcp.GAPICGenerator()%0Acommon_templates = gcp.CommonTemplates()%0A%0A +import synthtool.languages.java as java%0A%0Agapic = gcp.GAPICGenerator()%0A%0Aservice = 'monitoring'%0Aversions = %5B'v3'%5D%0Aconfig_pattern = '/google/monitoring/artman_monitoring.yaml'%0A%0Afor version ...
371f16a2affdd5b699716f8c7089035480d34fa1
Version 1.6.0
pausable_unittest/__init__.py
pausable_unittest/__init__.py
# coding: utf-8 # Copyright 2016 Masamitsu MURASE # 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 use, copy, modify,...
Python
0
@@ -1300,11 +1300,11 @@ %221. -5.2 +6.0 %22%0D%0A%0D
87301217ca5d61596942f366014b13f13faf681d
Version bump.
pelican_flickrtag/__init__.py
pelican_flickrtag/__init__.py
__title__ = 'pelican-flickrtag' __version__ = '0.2.1' __author__ = 'Chris Streeter' __license__ = 'MIT' __copyright__ = 'Copyright 2013' from pelican_flickrtag.plugin import register
Python
0
@@ -46,11 +46,11 @@ '0. -2.1 +3.0 '%0A__
57ddc48b5b6fda5947335dd588794872ee8929c6
Fix kwarg
pinax/waitinglist/views.py
pinax/waitinglist/views.py
from django.http import HttpResponseRedirect, JsonResponse from django.template import RequestContext from django.template.loader import render_to_string from django.urls import reverse, reverse_lazy from django.views.decorators.http import require_POST from django.views.generic import CreateView, UpdateView from .for...
Python
0.000088
@@ -958,48 +958,29 @@ %7D, -context_instance=RequestContext( +request=self. request) )%0A @@ -967,33 +967,32 @@ st=self.request) -) %0A %7D%0A @@ -1144,48 +1144,29 @@ %7D, -context_instance=RequestContext( +request=self. request) )%0A @@ -1161,17 +1161,16 @@ request) -) %0A
286f10f6b0f253de6cb7f0faf15b8dffbb1bf741
add autotype on pargs.append
clime/command.py
clime/command.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from inspect import getdoc from .helper import getargspec, getoptmetas, autotype, smartadd class ScanError(Exception): pass class Command(object): deftype = staticmethod(autotype) metatypes = {'N': int, 'NUM': int} def __init__(self, func): args, v...
Python
0.000001
@@ -3760,22 +3760,34 @@ .append( + autotype( piece) + ) %0A%0A
e6895d38fdb568b986f24b811d86d268d5750f7a
Add log message. Cleanup.
photo_rename/copy_metadata.py
photo_rename/copy_metadata.py
import argparse import logging import os import re import stat import sys import pyexiv2 import photo_rename from photo_rename import FileMetadata, Harvester from photo_rename.utils import CustomArgumentParser logger = logging.getLogger(__name__) def process_all_files(src_directory, dst_directory, simon_sez=None): ...
Python
0
@@ -878,16 +878,17 @@ filemap +s = harve @@ -905,16 +905,30 @@ maps%22%5D%0A%0A + count = 0%0A for @@ -944,16 +944,17 @@ emap +s .get():%0A @@ -945,24 +945,43 @@ maps.get():%0A + count += 1%0A src_ @@ -1426,16 +1426,101 @@ st_fn))%0A + if count == 0:%0A logger.warn(%22N...
e7ba9daca35c2498eaf10d0391942ff63feb6310
Revert "Added email toggles to SessionDetailsView"
corehq/apps/hqwebapp/session_details_endpoint/views.py
corehq/apps/hqwebapp/session_details_endpoint/views.py
import json from django.http import Http404, HttpResponse, HttpResponseBadRequest, JsonResponse from django.utils.decorators import method_decorator from django.views import View from django.views.decorators.csrf import csrf_exempt from corehq import toggles from corehq.apps.domain.auth import formplayer_auth from co...
Python
0
@@ -656,23 +656,48 @@ led_for_ -request +user, toggles_enabled_for_domain %0A%0A%0A@meth @@ -2696,23 +2696,63 @@ for_ -request(request +user(user.username) %7C toggles_enabled_for_domain(domain )%0A
23c8e6ac58880e6f4ff7577d8306f4cec7942da0
Use a connection pool.
cloudly/cache.py
cloudly/cache.py
"""This module provide access to redis and memcache servers with some sugar coating. """ import os import json import memcache import redis as pyredis from cloudly.aws import ec2 from cloudly.memoized import Memoized import cloudly.logger as logger log = logger.init(__name__) @Memoized def get_redis_connection():...
Python
0
@@ -104,16 +104,46 @@ ort json +%0Afrom urlparse import urlparse %0A%0Aimport @@ -337,24 +337,44 @@ _connection( +max_connections=None ):%0A %22%22%22 G @@ -1099,82 +1099,463 @@ l))%0A +%0A -return pyredis.from_url(redis_url)%0A%0A%0Aredis = get_redis_connection()%0A%0A%0A +# Create connection pool and in...
af0f663caf1f60abd0a322d505bd061d3e03a495
Add Text render document to printer
base_report_to_printer/models/ir_actions_report.py
base_report_to_printer/models/ir_actions_report.py
# Copyright (c) 2007 Ferran Pegueroles <ferran@pegueroles.com> # Copyright (c) 2009 Albert Cervera i Areny <albert@nan-tic.com> # Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) # Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) # Copyright (C) 2013-2014 Camptocamp (<http://www.campto...
Python
0
@@ -6048,8 +6048,670 @@ _format%0A +%0A def _render_qweb_text(self, docids, data=None):%0A %22%22%22Generate a TEXT file and returns it.%0A%0A If the action configured on the report is server, it prints the%0A generated document as well.%0A %22%22%22%0A document, doc_format = supe...
98c30fc87b326466a76b574696056f154e4b4139
add example for sensory stimulus
examples/sample_data/config_20160412_134708_N1.py
examples/sample_data/config_20160412_134708_N1.py
import imp import os import numpy as np import multi_tracker_analysis as mta class Config(object): def __init__(self, path, identifiercode=''): if '.py' in path: self.path = os.path.dirname(path) else: self.path = path self.identifiercode = identifiercode ...
Python
0.000135
@@ -71,16 +71,258 @@ as mta%0A%0A +def load_sensory_stimulus_on():%0A # write some code that reads a file and reformats stimulus on/off times to have the form of a list of epoch timestamps e.g. %5B%5Bt1,t2%5D,%5Bt3,4%5D%5D%0A return %5B%5B1444888597, 1444888599%5D, %5B1444888602, 1444888603%5D%5D%0A%0A class Co...
43e1914d9c74ddd9ab366596c85e3c8e4b83ce92
Change negating.
bio_hansel/quality_check/qc_utils.py
bio_hansel/quality_check/qc_utils.py
from typing import Tuple from bio_hansel.subtype import Subtype from pandas import DataFrame ''' [get_conflicting_tiles] Input: Subtype, DataFrame Output: List Desc: The purpose of this method is to find positive and negative tiles for the same refposition in the dataframe. The method will return a list with the confl...
Python
0
@@ -690,32 +690,33 @@ eg_tiles = dfst%5B +~ dfst%5B'is_pos_til @@ -718,25 +718,16 @@ s_tile'%5D - == False %5D%0A @@ -1434,32 +1434,33 @@ eg_tiles = dfst%5B +~ dfst%5B'is_pos_til @@ -1466,17 +1466,8 @@ le'%5D - == False %5D.sh
e0c311e04be19bd42f9e830200b975f6b7135434
Fix a lint issue
pinax/announcements/models.py
pinax/announcements/models.py
from django.conf import settings from django.db import models from django.core.urlresolvers import reverse from django.utils import timezone from django.utils.translation import ugettext_lazy as _ class Announcement(models.Model): """ A single announcement. """ DISMISSAL_NO = 1 DISMISSAL_SESSION = ...
Python
0.000136
@@ -191,16 +191,17 @@ y as _%0A%0A +%0A class An
4b68fad9d427a05c74289e5fca57fa7659288016
fix UnboundLocalError
plstackapi/core/api/slices.py
plstackapi/core/api/slices.py
import re from plstackapi.openstack.client import OpenStackClient from plstackapi.openstack.driver import OpenStackDriver from plstackapi.core.api.auth import auth_check from plstackapi.core.models import Site def validate_name(name): # N.B.: Responsibility of the caller to ensure that login_base # portio...
Python
0.000002
@@ -1356,26 +1356,22 @@ : %25s%22 %25 -login_base +fields %0A ret
4f9b5700ae6247c282ff4bcc40ec0f2cf3a2ff35
Bump version to 1.18.0
platformio_api/__init__.py
platformio_api/__init__.py
# Copyright 2014-present Ivan Kravets <me@ikravets.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
Python
0
@@ -683,12 +683,12 @@ 1, 1 -7, 6 +8, 0 )%0A__
31ede9839bd158e3d51d1796ea61e08546a37e8c
Make skeletons back into array of ints; fix to other zoom
examples/paper_figures/make_online_figures.py
examples/paper_figures/make_online_figures.py
''' Creates figures of the skeletons used in the analysis (convolved+regridded), and those on the original data. ''' from astropy.io import fits from scipy.ndimage import zoom import matplotlib.pyplot as p p.ion() def overlap_skeletons(image, big_skel, norm_skel, aplpy_plot=True, save_figure=...
Python
0
@@ -112,16 +112,35 @@ a.%0A'''%0A%0A +import numpy as np%0A from ast @@ -670,16 +670,49 @@ er=True) +%0A image%5Bnp.isnan(image)%5D = 0.0 %0A%0A no @@ -761,16 +761,17 @@ _skel = +( norm_ske @@ -771,24 +771,37 @@ orm_skel %3E 0 +).astype(int) %0A%0A big_sk @@ -870,16 +870,17 @@ _skel = +( big_skel @...
c26519e28163cafca5586f7a5af64ad1d489822a
add pickingMask
collisionUtil.py
collisionUtil.py
""" Example Use: def processMap(mapNodePath) col=getCollision(mapNodePath) holder=NodePath("CollisionAndMeshHolder") mapNodePath.reparentTo(holder) col.reparentTo(holder) flattenStrong(mapNodePath) return holder def collisionFilter(n): return not n.hasNetTag("noCollision") def getCol...
Python
0.000001
@@ -663,11 +663,34 @@ k32( -0b1 +1)%0ApickingMask=BitMask32(2 )%0A%0A#
0bfcca4d11722c92d1fa9fe8da30a9a118d7f8ea
Fix bounty constructor; add verification; NO PING
common/bounty.py
common/bounty.py
import os, pickle from common.safeprint import safeprint bountyList = [] class Bounty: ip = "" btc = "" reward = 0 data = [] def __init__(ipAddress, btcAddress, rewardAmount): ip = ipAddress btc = btcAddress reward = rewardAmount def __init__(ipAddress, btcAddress, rewardAmount, dataList...
Python
0.000009
@@ -10,16 +10,20 @@ , pickle +, re %0Afrom co @@ -142,32 +142,38 @@ %0A def __init__( +self, ipAddress, btcAd @@ -191,23 +191,41 @@ rdAmount +, dataList=%5B%5D ):%0A +self. ip = ipA @@ -227,32 +227,37 @@ = ipAddress%0A +self. btc = btcAddress @@ -253,32 +253,37 @@ btcAddress%0A +self. reward =...
d6bfe637dad3ddddf980127646cecc4d3e6b7db3
use pfctl for IP check (#4320)
src/opnsense/scripts/filter/find_table_references.py
src/opnsense/scripts/filter/find_table_references.py
#!/usr/local/bin/python3 """ Copyright (c) 2018-2019 Deciso B.V. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright no...
Python
0
@@ -2075,61 +2075,41 @@ # -Fetch IP ranges in this table and check if they match +Test given address against tables %0A @@ -2210,17 +2210,26 @@ '-T -', 'show' +test', sys.argv%5B1%5D %5D, c @@ -2279,37 +2279,32 @@ -for line -in += sp.std -out +err .strip() .spl @@ -2299,34 +2299,17 @@ .strip() ...
924f5b5467d3ee395fa957e992ea716ce5c3a835
Add support of facts gathering WWNs on Solaris 10 and Solaris 11 OS (#52091)
lib/ansible/module_utils/facts/network/fc_wwn.py
lib/ansible/module_utils/facts/network/fc_wwn.py
# Fibre Channel WWN initiator related facts collection for ansible. # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your o...
Python
0.000001
@@ -1544,16 +1544,710 @@ ()%5B2:%5D)%0A + elif sys.platform.startswith('sunos'):%0A %22%22%22%0A on solaris 10 or solaris 11 should use %60fcinfo hba-port%60%0A on solaris 9, %60prtconf -pv%60%0A %22%22%22%0A cmd = module.get_bin_path('fcinfo')%0A ...
382f9b099927d1f5bf8d55f45b4aa0e50dba8790
Fix initializing err in _get_err_from_resp_json
lib/ansible/modules/extras/cloud/lxd/__init__.py
lib/ansible/modules/extras/cloud/lxd/__init__.py
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2016, Hiroaki Nakamura <hnakamur@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the...
Python
0.003372
@@ -4868,32 +4868,51 @@ son(resp_json):%0A + err = None%0A metadata
437c5dc5c15cf902d59d907459c4d50f1a4b19da
Add all_d optimization to taskDifficulty in showDetails
app/soc/modules/gci/views/models/student_ranking.py
app/soc/modules/gci/views/models/student_ranking.py
#!/usr/bin/env python2.5 # # Copyright 2010 the Melange authors. # # 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 applic...
Python
0
@@ -983,16 +983,74 @@ k_logic%0A +from soc.modules.gci.models import task as gci_task_model%0A from soc @@ -3103,16 +3103,79 @@ tudent%0A%0A + all_d = gci_task_model.TaskDifficultyTag.all().fetch(100)%0A%0A list @@ -3449,16 +3449,21 @@ ficulty( +all_d ).value%0A
65ac4143dbf2f69f74b86c071f40f640c33873b3
prepare for entry to SQL - not SQL itself
condor/fields.py
condor/fields.py
from django.db import models from django.core.serializers.json import DjangoJSONEncoder from django.utils import simplejson as json # Brad Jasper's JSONField https://github.com/bradjasper/django-jsonfield class JSONField(models.TextField): """JSONField is a generic textfield that serializes/unserializes JSON objec...
Python
0
@@ -914,27 +914,24 @@ def get_ -db_ prep_value(s
d1a7a56c1480d9d17a8ddef359787bba2d05aed8
fix encoding
plugins/translate/__init__.py
plugins/translate/__init__.py
import plugins import urllib import urllib2 import lxml.html def translate(connection, channel, nick, cmd, args): if not args: return headers = { 'User-Agent' : 'Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1' } data = { 'sl' : 'auto', 'tl' : 'en', 'hl' : 'en', 'ie' : 'UTF-...
Python
0.274682
@@ -323,20 +323,37 @@ , 'q' : +plugins.to_utf8( args +) %7D%0A r
f3e7f2691165077c3b80209f4916242ad7dc07e6
remove unused import
src/lib/mechanic/ui/tabs/install.py
src/lib/mechanic/ui/tabs/install.py
from vanilla import * from mojo.extensions import ExtensionBundle from mechanic.extension import Extension from mechanic.registry import Registry from mechanic.ui import progress from mechanic.ui.tabs.base import BaseTab from mechanic.ui.lists.installation import InstallationList class InstallTab(BaseTab): title...
Python
0.000001
@@ -18,52 +18,8 @@ rt * -%0Afrom mojo.extensions import ExtensionBundle %0A%0Afr
c3acd20f71a568ecc9a4d3e1c8425b7b188e5523
Comment show_gui() in example1.py
pony/examples/web/example1.py
pony/examples/web/example1.py
# -*- coding: cp1251 -*- from pony.main import * use_autoreload() @http def page1(): return 'Hello, world!' @http(type='text/html') def page2(): return """ <h1>This is HTML page</h1> <p>Click <a href="/">here</a> for return """ @http def page3(): ...
Python
0.000001
@@ -3734,16 +3734,18 @@ rver()%0D%0A +# show_gui
f21bb9d1b1d08fab8a127dc839b688338df30576
Fix auto-encoder
experiments/auto_encoders/rnn_auto_encoder.py
experiments/auto_encoders/rnn_auto_encoder.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #!/usr/bin/env python # -*- coding: utf-8 -*- from deepy.networks import AutoEncoder from deepy.layers import RNN, Dense from deepy.trainers import SGDTrainer, LearningRateAnnealer from util import get_data, VECTOR_SIZE, SEQUENCE_LENGTH HIDDEN_SIZE = 50 model_path = o...
Python
0.999469
@@ -87,16 +87,25 @@ -8 -*-%0A%0A +import os %0Afrom de
04e57587f14878acd5ea4815a4219de881314a98
add dry_run and listing of keys for s3 buckets
src/main/python/monocyte/handler.py
src/main/python/monocyte/handler.py
from __future__ import print_function import boto import boto.ec2 from boto.exception import S3ResponseError, EC2ResponseError US_STANDARD_REGION = "us-east-1" def make_registrar(): registry = set() def registrar(cls): registry.add(cls) # print("registering aws service %s" % cls.SERVICE_NA...
Python
0
@@ -2401,16 +2401,40 @@ E = %22s3%22 +%0A NR_KEYS_TO_SHOW = 4 %0A%0A de @@ -2449,16 +2449,30 @@ __(self, + dry_run=True, *ignore @@ -2483,20 +2483,38 @@ -pass +self.dry_run = dry_run %0A%0A de @@ -3446,28 +3446,597 @@ lf, -instance):%0A pass +resource):%0A if self.dry_run:%0A ...
64d98bb88b5b7d2c98cfdd22d74761a80003e769
bump version
weplot/version.py
weplot/version.py
__version__ = '0.0.8'
Python
0
@@ -16,7 +16,7 @@ 0.0. -8 +9 '%0A
6098d62b822731fee18670167e382e0c17720c29
set g.user/is_manager/... from login signal, not in before_request. Cleanup on logout
abilian/services/auth/service.py
abilian/services/auth/service.py
# coding=utf-8 """ """ from __future__ import absolute_import import logging from datetime import datetime, timedelta from flask import current_app, g, request, url_for, _request_ctx_stack from flask.ext.login import current_user from flask.ext.babel import lazy_gettext as _l from abilian.services import Service from...
Python
0
@@ -203,32 +203,36 @@ xt.login import +(%0A current_user%0Afro @@ -227,16 +227,52 @@ ent_user +, user_logged_in, user_logged_out%0A) %0Afrom fl @@ -1548,16 +1548,138 @@ equest)%0A + user_logged_in.connect(self.user_logged_in, sender=app)%0A user_logged_out.connect(self.user_logged_out, sender=app)%0A ...
51c7728b6304f678e0eb6460470e0f5cc95b816f
Use print() function in both Python 2 and Python 3 (#52)
ai-jam-js/maybe_download_mags.py
ai-jam-js/maybe_download_mags.py
import os import urllib # This script downloads these .mag files if not already present. mag_files = [ 'http://download.magenta.tensorflow.org/models/attention_rnn.mag', 'http://download.magenta.tensorflow.org/models/performance.mag', 'http://download.magenta.tensorflow.org/models/pianoroll_rnn_nade.mag', ...
Python
0
@@ -1,27 +1,170 @@ -import os%0Aimport urllib +from __future__ import absolute_import%0Afrom __future__ import division%0Afrom __future__ import print_function%0A%0Aimport os%0Afrom six.moves.urllib.request import URLopener %0A%0A# @@ -639,17 +639,17 @@ print - +( 'File %25s @@ -676,16 +676,17 @@ mag_file +) ...
ecb93394c1cab4870b14113c73907cca974a2a24
Handle Python 3 Aho-Corasick semantics
aleph/analyze/corasick_entity.py
aleph/analyze/corasick_entity.py
import logging from normality import normalize from ahocorasick import Automaton from aleph import settings from aleph.model import Entity from aleph.analyze.analyzer import EntityAnalyzer from aleph.model import DocumentTag log = logging.getLogger(__name__) class AhoCorasickEntityAnalyzer(EntityAnalyzer): ORIG...
Python
0.000067
@@ -988,13 +988,16 @@ ue, -ascii +latinize =Tru @@ -1225,24 +1225,8 @@ text -.encode('utf-8') %0A%0A
1db4d00640432e5ce3acc9580127527c49a30d64
Clear base_api cache in tests.
aleph/tests/test_sessions_api.py
aleph/tests/test_sessions_api.py
import jwt from aleph.core import db, settings from aleph.model import Collection from aleph.logic.collections import update_collection from aleph.tests.util import TestCase from aleph.tests.factories.models import RoleFactory class SessionsApiTestCase(TestCase): def setUp(self): super(SessionsApiTestCa...
Python
0
@@ -122,32 +122,82 @@ date_collection%0A +from aleph.views.base_api import _metadata_locale%0A from aleph.tests @@ -1004,32 +1004,71 @@ _enabled(self):%0A + _metadata_locale.cache_clear()%0A res = se @@ -1316,32 +1316,71 @@ rd_login(self):%0A + _metadata_locale.cache_clear()%0A setti...
597a7ad29aed71d54a10682949632c3343926eee
fix snapshot bug
pyecharts/render/snapshot.py
pyecharts/render/snapshot.py
import base64 import codecs import logging import os from io import BytesIO from ..types import Any logger = logging.getLogger(__name__) PNG_FORMAT = "png" JPG_FORMAT = "jpeg" GIF_FORMAT = "gif" PDF_FORMAT = "pdf" SVG_FORMAT = "svg" EPS_FORMAT = "eps" B64_FORMAT = "base64" def make_snapshot( engine: Any, f...
Python
0.000001
@@ -567,16 +567,26 @@ napshot( +html_path= file_nam @@ -584,24 +584,34 @@ =file_name, +file_type= file_type, d
7fdb8e8dc64759fa5cbd5c3fc1c6efa101e7bcf7
Return tuple instead of generator.
pyldap/libldap/structures.py
pyldap/libldap/structures.py
from ctypes import * from .tools import iterate_array, is_iterable class BerElement(Structure): _fields_ = [] class LDAP(Structure): _fields_ = [] class LDAPMessage(Structure): _fields_ = [] class Timeval(Structure): _fields_ = [] class BerVal(Structure): _fields_ = [('bv_len', c_ulong), ...
Python
0
@@ -3860,38 +3860,45 @@ rs:%0A -yield +return tuple( iterate_array(se @@ -3911,16 +3911,17 @@ d_attrs) +) %0A%0A @p
2d2614470e7f95d0df34b03ccd2d918832eef4c7
fix flake8
pyscalambda/formula_nodes.py
pyscalambda/formula_nodes.py
from pyscalambda.formula import Formula from pyscalambda.utility import convert_operand class MethodCall(Formula): def __init__(self, value, method, args, kwargs): super(MethodCall, self).__init__() self.value = value self.method = method self.args = args self.kwargs = kwar...
Python
0
@@ -2357,17 +2357,16 @@ e, cond, - false%5D%0A @@ -3223,30 +3223,28 @@ ld 'None'%0A yield ')'%0A -%0A%0A
4c43119cd5d231e7cfe120d3b1e0881dc1048c42
edit library(miller-rabin)
python-library/math/prime.py
python-library/math/prime.py
class Prime: """ make prime numbers lists complexity: O(n^(1/2)) used in AOJ0202 """ def __init__(self, n): self.is_prime = [True for _ in range(n+1)] self.primeList = [] self.is_prime[0] = self.is_prime[1] = False for i in range(2, int(pow(n, 0.5))+1): ...
Python
0
@@ -1166,21 +1166,24 @@ e %3E= n: -break +continue %0A
94f88b7b00ace47a19644fdc23108fdd950c1e97
Add comment about source and license of _rewrite_shebangs.py
installers/windows/nsis/dist/_rewrite_shebangs.py
installers/windows/nsis/dist/_rewrite_shebangs.py
"""This is run during installation to rewrite the shebang (#! headers) of script files. """ import glob import os.path import sys if sys.version_info[0] >= 3: # What do we do if the path contains characters outside the system code page?! b_python_exe = sys.executable.encode(sys.getfilesystemencoding()) else: ...
Python
0
@@ -1,8 +1,297 @@ +# Original source:%0A# https://github.com/takluyver/pynsist/blob/80392f24d664b08eb7f0b7e45a408575e55810fc/nsist/_rewrite_shebangs.py%0A# Copyright (c) 2014-2017 Thomas Kluyver under MIT license:%0A# https://github.com/takluyver/pynsist/blob/e01d6f08eb71bc5aa2d294f5369a736e59becd09/LICENSE%0A %2...
9dd019c12899045faebd49bc06026c8512609c9e
Remove assert line from import
statictemplate/management/commands/statictemplate.py
statictemplate/management/commands/statictemplate.py
# -*- coding: utf-8 -*- from contextlib import contextmanager from django.conf import settings try: from django.conf.urls.defaults import patterns, url, include assert all((patterns, url, include)) except ImportError: from django.conf.urls import patterns, url, include # pragma: no cover from django.core.m...
Python
0.000001
@@ -162,49 +162,8 @@ ude%0A - assert all((patterns, url, include))%0A exce
a2f1bfc4a61b52042bf947ba75b444f6efa7a724
Remove duplicate negative test of flavor_id
tempest/api/compute/flavors/test_flavors_negative.py
tempest/api/compute/flavors/test_flavors_negative.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 OpenStack Foundation # 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.apach...
Python
0.000176
@@ -728,52 +728,8 @@ ase%0A -from tempest.common.utils import data_utils%0A from @@ -755,16 +755,16 @@ eptions%0A + from tem @@ -1011,338 +1011,8 @@ nt%0A%0A - # Generating a nonexistent flavor id%0A resp, flavors = cls.client.list_flavors()%0A flavor_ids = %5Bflavor%5B'id'%5D for flavor in fl...
d39776a8ace21cb1ab7985ccc7c571459b5e9af5
use bulk create with transmissions
rapidsms/router/db/router.py
rapidsms/router/db/router.py
from django.db.models import Q from rapidsms.router.blocking import BlockingRouter from rapidsms.router.db.tasks import receive, send_transmissions class DatabaseRouter(BlockingRouter): def queue_message(self, direction, connections, text, fields=None): """Create Message and Transmission objects for mes...
Python
0
@@ -376,16 +376,30 @@ Message +, Transmission %0A @@ -399,19 +399,19 @@ -msg +dbm = Messa @@ -472,49 +472,26 @@ -# TODO: update to use bulk insert ORM api +transmissions = %5B%5D %0A @@ -538,20 +538,16 @@ -msg. transmis @@ -556,48 +556,177 @@ ons. -create(connection=connectio...
ed6bc736aa46d43f9f47ae58cef2da4bc8b5d606
update twilio response
rasa/core/channels/twilio.py
rasa/core/channels/twilio.py
# -*- coding: utf-8 -*- import logging from sanic import Blueprint, response from sanic.request import Request from twilio.base.exceptions import TwilioRestException from twilio.rest import Client from typing import Dict, Text, Any from rasa.core.channels.channel import InputChannel from rasa.core.channels.channel imp...
Python
0.000001
@@ -4217,24 +4217,8 @@ onse -.text(%22success%22) %0A%0A
ed710ab75875a972fe092ad2082af73cfd11fbd4
Implement unit tests for Poisson node
bayespy/inference/vmp/nodes/tests/test_poisson.py
bayespy/inference/vmp/nodes/tests/test_poisson.py
###################################################################### # Copyright (C) 2014 Jaakko Luttinen # # This file is licensed under Version 3.0 of the GNU General Public # License. See LICENSE for a text of the license. ###################################################################### ####################...
Python
0
@@ -1495,390 +1495,1810 @@ ons%0A -%0A # Check that plates are correct%0A %0A # Invalid rate%0A%0A # Inconsistent plates%0A%0A # Explicit plates too small%0A%0A pass%0A%0A %0A def test_moments(self):%0A %22%22%22%0A Test the moments of Poisson nodes.%0A ...
391222617ef661fb703fa8b8a48726431f92c74f
Remove unused debugging.
apps/python/PartyLaps/ACTable.py
apps/python/PartyLaps/ACTable.py
""" A table drawing utility for Assetto Corsa. """ class ACTable(object): def __init__(self, ac, window): self.ac = ac self.window = window self.setTablePadding(0, 0) self.setCellSpacing(0, 0) self.cells = {} def draw(self): """ Initialise the data s...
Python
0
@@ -2885,158 +2885,8 @@ %22%22%22%0A - #self.ac.log(%22 %22.join(map(str, %5Btype(iX), type(iY), type(self.fontSize), type(self.spacing)%5D)))%0A #self.ac.log(repr(self.columnWidths))%0A
be02bae14a9fb217eb4ab61c4942d9bb5ccc5e01
Clarify docstring
astropy/units/format/__init__.py
astropy/units/format/__init__.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ A collection of different unit formats. """ from __future__ import absolute_import, division, print_function, unicode_literals from .base import Base from .generic import Generic from .console import Console from .fits import Fits from .latex import L...
Python
0.000226
@@ -620,24 +620,36 @@ se%60 instance + or subclass %0A The @@ -692,16 +692,36 @@ nstance +or subclass%0A itself.%0A
6333cb52ec6527f5163e3fc4dd567264eb1e2ecc
fix requests post
scheduled_bots/disease_ontology/pull_requester.py
scheduled_bots/disease_ontology/pull_requester.py
""" Given a table of changes (gotten from mesh_changes.py, create the change in the working owl file (doid-edit.owl), using owltools, then create a new branch and commit it to github. Then create a pull request with a comment containing the metadata. """ import pandas as pd import requests from requests.auth import HT...
Python
0
@@ -3008,12 +3008,12 @@ rl, -json +data =dat @@ -3871,25 +3871,8 @@ )):%0A - #idx = 2%0A @@ -4514,41 +4514,4 @@ id)%0A -%0A if idx%3E5:%0A break%0A
cbf0307dce466e719ab388dae50c29d5e72f60e2
throw exception if docker_project_name not set
xos/synchronizers/onboarding/steps/sync_xos.py
xos/synchronizers/onboarding/steps/sync_xos.py
import os import sys import base64 from django.db.models import F, Q from xos.config import Config from synchronizers.base.syncstep import SyncStep, DeferredException from core.models import XOS from xos.logger import Logger, logging from synchronizers.base.ansible import run_template # xosbuilder will be in steps/.. ...
Python
0.000006
@@ -787,16 +787,123 @@ %25 xos)%0A%0A + if not xos.docker_project_name:%0A raise Exception(%22xos.docker_project_name is not set%22)%0A%0A
d47ccc9ff1e28c60df1e242376af60d884b92edb
Update check_tic_tac_toe.py
09-revisao/practice_python/check_tic_tac_toe.py
09-revisao/practice_python/check_tic_tac_toe.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Exercise 25: Check Tic Tac Toe This exercise is Part 2 of 4 of the Tic Tac Toe exercise series. The other exercises are: Part 1, Part 3, and Part 4. As you may have guessed, we are trying to build up to a full tic-tac-toe board. However, this is significantly more tha...
Python
0.000003
@@ -1724,904 +1724,29 @@ -player = 1%0A%0A if positions%5B0%5D == positions%5B1%5D == positions%5B2%5D == player:%0A return %22Player %25i Wins!%22 %25 player%0A elif positions%5B3%5D == positions%5B4%5D == positions%5B5%5D == player:%0A return %22Player %25i Wins!%22 %25 player%0A elif pos...
3127bb27d0a75c0fa3c695a5d40d3a0fd5c321ad
Remove strange empty line
python/tools/recorded-call-graph-metrics/cg_trace.py
python/tools/recorded-call-graph-metrics/cg_trace.py
#!/usr/bin/env python3 """Call Graph tracing. Execute a python program and for each call being made, record the call and callable. This allows us to compare call graph resolution from static analysis with actual data -- that is, can we statically determine the target of each actual call correctly. If there is 100% c...
Python
0.994367
@@ -4014,17 +4014,16 @@ _calls:%0A -%0A
02e3516c0d124d5ec873db21e6e98976dde858a7
validate if all the questions in a responses section were answered before approving a project
qipr_approver/approver/workflows/approve_workflow.py
qipr_approver/approver/workflows/approve_workflow.py
from functools import reduce from django.contrib.auth.models import User from approver.models import Response, Question, Project, Choice from approver.constants import answer_submit_names, answer_response_names from approver.utils import get_current_user_gatorlink, after_approval def add_update_response(post_data, s...
Python
0.00024
@@ -2892,16 +2892,184 @@ e.all()%0A + total_responses = len(responses)%0A is_correct_response = False%0A if total_responses %3E 0:%0A if __response_count_matches_question_count(responses):%0A is_c @@ -3172,16 +3172,24 @@ , True)%0A + if i @@ -3212,24 +3212,32 @@ se:%0A ...
fa7d4fadeabe28b6468833f1c01c21fde1bc2747
Revert "adding unit test for get_force()"
hoomd/md/test-py/test_force_base.py
hoomd/md/test-py/test_force_base.py
# -*- coding: iso-8859-1 -*- # Maintainer: jglaser from hoomd import * from hoomd import md; context.initialize() import unittest import os # md.pair.lj class force_base_tests (unittest.TestCase): def setUp(self): print self.s = init.create_lattice(lattice.sc(a=2.1878096788957757),n=[10,10,10]); #...
Python
0
@@ -939,403 +939,8 @@ 5);%0A - force_x = lj.get_force(g, index=0)%0A force_y = lj.get_force(g, index=1)%0A force_z = lj.get_force(g, index=2)%0A self.assertAlmostEqual(force_x, self.s.particles.get(0).net_force%5B0%5D, places=5);%0A self.assertAlmostEqual(force_y, self.s.particles.ge...
713b366b228983d9b6e33238da9d22c9aa51176a
Use the async dialogs.prompt_text api
esp32/modules/setup.py
esp32/modules/setup.py
# SETUP APPLICATION # SHOWN ON FIRST BOOT import ugfx, badge, appglue, dialogs, utime # Globals nickname = "" def load_settings(): global nickname nickname = badge.nvs_get_str("owner", "name", "") def store_settings(): global nickname nickname_new = badge.nvs_set_str("owner", "name", nickname) ...
Python
0
@@ -85,89 +85,39 @@ me%0A%0A -# Globals%0A%0Anickname = %22%22%0A%0Adef load_settings():%0A global nickname%0A nickname = +def load_settings():%0A return bad @@ -152,20 +152,16 @@ e%22, %22%22)%0A - %0Adef sto @@ -172,38 +172,24 @@ ettings( -):%0A global nickname %0A nic @@ -180,35 +180,22 @...
ac8501b38db7b380fc2916b64427c15b149785c7
remove useless setup method on Dot as it should behave just as Bar
bokeh/charts/builders/dot_builder.py
bokeh/charts/builders/dot_builder.py
"""This is the Bokeh charts interface. It gives you a high level API to build complex plot is a simple way. This is the BoxPlot class which lets you build your BoxPlot plots just passing the arguments to the Chart class and calling the proper functions. It also add a new chained stacked method. """ #------------------...
Python
0
@@ -5127,223 +5127,4 @@ yph%0A -%0A def setup(self):%0A if self.ylabel is None:%0A self.ylabel = self.values.selected_title%0A%0A if self.xlabel is None:%0A self.xlabel = title_from_columns(self.attributes%5B'label'%5D.columns)%0A
542265f78186ea2b7594afe6ca692e5fb826c367
Bump version to 0.5.3
commonsdownloader/__init__.py
commonsdownloader/__init__.py
"""commonsdownloader package.""" __version__ = '0.5.2'
Python
0.000001
@@ -50,7 +50,7 @@ 0.5. -2 +3 '%0A
8cb34f4d88184d0c42e8c1fc41f451fa3cd5a6be
Fix undefined reference error in command line KeepKey plugin.
plugins/keepkey/cmdline.py
plugins/keepkey/cmdline.py
from electrum.util import print_msg, raw_input from .keepkey import KeepKeyPlugin from ..hw_wallet import CmdLineHandler class Plugin(KeepKeyPlugin): handler = CmdLineHandler() @hook def init_keystore(self, keystore): if not isinstance(keystore, self.keystore_class): return keys...
Python
0
@@ -1,12 +1,46 @@ +from electrum.plugins import hook%0A from electru
fb7e9dfcb315a637b10f18d3f98a4a0f8c3bdb69
copy existing notifications into history table
migrations/versions/0042_notification_history.py
migrations/versions/0042_notification_history.py
"""empty message Revision ID: 0042_notification_history Revises: 0041_email_template Create Date: 2016-07-07 13:15:35.503107 """ # revision identifiers, used by Alembic. revision = '0042_notification_history' down_revision = '0041_email_template' from alembic import op import sqlalchemy as sa from sqlalchemy.dialec...
Python
0
@@ -2854,24 +2854,712 @@ nique=False) +%0A%0A op.execute('''%0A INSERT INTO notification_history%0A (%0A id,%0A job_id,%0A job_row_number,%0A service_id,%0A template_id,%0A template_version,%0A api_key_id,%0A key_type,%0A content_char_count,%0A notification_ty...
e4b23cf4e33b1125c7d50e8675c2d7460f0ef468
remove loopback address from allowed hosts
feelings/feelings/deploy_settings/__init__.py
feelings/feelings/deploy_settings/__init__.py
import dj_database_url from feelings.settings import * def get_env_variable(var_name): try: return os.environ[var_name] except KeyError: error_msg = "Set the {} env variable".format(var_name) if DEBUG: warnings.war(error_msg) else: raise ImproperlyConfig...
Python
0
@@ -408,25 +408,8 @@ t',%0A - '127.0.0.1',%0A
814c6f6a1e6365bb5e0d83b0d8147fc6ec7ed15e
Update resampling.py
defenses/torch/audio/input_tranformation/resampling.py
defenses/torch/audio/input_tranformation/resampling.py
import torchaudio import librosa # resampling reference https://core.ac.uk/download/pdf/228298313.pdf # resampling input transformation defense for audio T = torchaudio.transforms audio_data = librosa.load(files, sr=16000)[0][-19456:] # Read audio file audio_data = torch.tensor(audio_data).float().to(device) sample ...
Python
0.000001
@@ -27,16 +27,17 @@ ibrosa%0A%0A +%0A # resamp @@ -175,16 +175,35 @@ ansforms +%0A%0A# Read audio file %0Aaudio_d @@ -253,27 +253,9 @@ 56:%5D - # Read audio file +%0A %0Aaud @@ -312,88 +312,177 @@ ce)%0A -sample = T.Resample(%0A 16000, 8000, resampling_method=%22sinc_interpolation%22%0A) +%0A# Discarding s...
455644f8e5f2afd51eff9d5f488d248f53caba40
Update run.py
installscripts/wizard/run.py
installscripts/wizard/run.py
#!/usr/bin/python from __future__ import print_function import os import sys import subprocess def is_non_zero_file(fpath): return os.path.isfile(fpath) and os.path.getsize(fpath) > 0 def pause(): programPause = raw_input("Press the <ENTER> key to continue...") tagEnvPrefix = raw_input("Please provide the ta...
Python
0.000001
@@ -1254,46 +1254,45 @@ k)%0A%09 -cmd = %5Bcidrcheck%5D%0A%09subprocess.call(cmd +subprocess.call(cidrcheck, shell=True )%0A%09i
a1d71466d09e9e1ea2f75eae57e72e0000c65ffc
Add new-style TEMPLATES setting for tests
tests/run.py
tests/run.py
import sys import django from colour_runner.django_runner import ColourRunnerMixin from django.conf import settings settings.configure( DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } }, MIDDLEWARE_CLASSES=(), TEMPLATE_DIR...
Python
0
@@ -313,14 +313,147 @@ LATE -_DIRS= +S=%5B%0A %7B%0A 'BACKEND': 'django.template.backends.django.DjangoTemplates',%0A 'APP_DIRS': False,%0A 'DIRS': ('te @@ -470,16 +470,33 @@ tes',),%0A + %7D,%0A %5D%0A )%0A%0A%0Aif d
b8f4d448e126c08ae0f5d9ab178ff60a06fb02f3
Improve readability of tex conversion
tex_tools.py
tex_tools.py
""" Created on Wed Aug 12 01:37:16 2015 @author: richard """ import re VAR_RE = '[a-z][\d_]*' def matrix_to_tex(matrix_): lines = [] for line in matrix_: lines.append(' & '.join(map(str, line)) + ' \\\\') return '\n'.join(lines) def _var_repler(var): var = var.group() if len(var) == 1: ...
Python
0.000005
@@ -683,24 +683,45 @@ ace(' ', '') +.replace('**1.0', '') %0A%0A tex =
c43e8314511ae614c5d3efe8d00e9d18cd04b953
fix bug in lookup: modified: textstore.py
textstore.py
textstore.py
from util import printStatus class RecordStore: def __init__(self, tagfile): printStatus('textstore.RecordStore', 'read from %s' % tagfile) self.mapping = {} self.tag2freq = {} for line in open(tagfile): #.readlines(): [photoid, userid, tags] = line.strip().spl...
Python
0.000001
@@ -255,24 +255,56 @@ adlines():%0D%0A + print line.strip()%0D%0A @@ -910,25 +910,141 @@ ping -%5B +.get( photoid -%5D%0D%0A +, (None, None))%0D%0A%0D%0A%0D%0Aif __name__ == '__main__':%0D%0A tagfile = 'id.userid.lemmtags.txt'%0D%0A store = RecordStore(tagfile)%0D%0A %0D%0A
d330b643d8b6a9452b5cfa47b87e5ec3a7d67bd2
handle string error messages
invenio_files_rest/errors.py
invenio_files_rest/errors.py
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015-2019 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Errors for Invenio-Files-REST.""" from __future__ import absolute_import, print_f...
Python
0.000008
@@ -322,16 +322,27 @@ nction%0A%0A +import six%0A from inv @@ -569,24 +569,277 @@ fails.%22%22%22%0A%0A + def get_errors(self):%0A %22%22%22Get errors.%0A%0A :returns: A string with the error message.%0A %22%22%22%0A if isinstance(self.errors, six.string_types):%0A return s...
20d6e123b8cc28f9600e8a20c64bfe8abbc6c3f4
Remove comment
issue_tracker/core/models.py
issue_tracker/core/models.py
from django.db import models from django.contrib.auth.models import User class Project(models.Model): user = models.ForeignKey(User) # issue = models.ForeignKey(Issue, null=True) name = models.CharField(max_length=100) version = models.CharField(max_length=15, null=True) release_date = models.DateF...
Python
0
@@ -135,58 +135,8 @@ er)%0A - # issue = models.ForeignKey(Issue, null=True)%0A
434610aabb80868bf086daabaea419513a8f471d
test change
imagersite/imager_profile/models.py
imagersite/imager_profile/models.py
from django.db import models from django.contrib.auth.models import User import uuid from django.db.models.signals import post_save from django.dispatch import receiver # Create your models here. class ActiveUsersManager(models.Manager): """Active user manager.""" def get_querysets(self): """Get the...
Python
0.000002
@@ -1752,16 +1752,54 @@ wargs):%0A + %22%22%22Output info about new user.%22%22%22%0A new_
6e1096efb884e813f1db3ea951d8eec551a06c6e
Add ArgsKwargs to thinc.api
thinc/api.py
thinc/api.py
from .config import Config, registry from .initializers import normal_init, uniform_init, xavier_uniform_init, zero_init from .loss import categorical_crossentropy, L1_distance, cosine_distance from .model import create_init, Model from .optimizers import Adam, RAdam, SGD, Optimizer from .schedules import cyclic_triang...
Python
0.000008
@@ -456,16 +456,28 @@ , Padded +, ArgsKwargs %0Afrom .u
f154aed297124b1eae6c80ae60bc2d44fd82405c
rename a variable in EventReaderBundle
AlphaTwirl/EventReader/EventReaderBundle.py
AlphaTwirl/EventReader/EventReaderBundle.py
# Tai Sakuma <tai.sakuma@cern.ch> from EventLoop import EventLoop ##__________________________________________________________________|| class AllEvents(object): def __call__(self, event): return True ##__________________________________________________________________|| class EventReaderBundle(object): def ...
Python
0.000002
@@ -762,17 +762,16 @@ reader -s = self. @@ -897,17 +897,16 @@ , reader -s )%0A
936153a4915bb748c48fc7c96bff31e5ff7011c2
move lines from __init__() to begin() in MPEventLoopRunner
AlphaTwirl/EventReader/MPEventLoopRunner.py
AlphaTwirl/EventReader/MPEventLoopRunner.py
# Tai Sakuma <tai.sakuma@cern.ch> from NullProgressMonitor import NullProgressMonitor import multiprocessing ##__________________________________________________________________|| class Worker(multiprocessing.Process): def __init__(self, task_queue, result_queue, progressReporter, lock): multiprocessing.Pr...
Python
0.000003
@@ -2029,16 +2029,94 @@ onitor)%0A + self._ntasks = 0%0A%0A def begin(self):%0A self._allReaders = %7B %7D%0A @@ -2314,86 +2314,8 @@ ueue -%0A self._ntasks = 0%0A%0A def begin(self):%0A self._allReaders = %7B %7D %0A%0A