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
00bfbae48af80fd12db31aecc663373dce3fa1a8
Format code
megaprojects/core/models.py
megaprojects/core/models.py
import uuid from django.conf import settings from django.db import models class TimeStampedModel(models.Model): """ An abstract base class model that provides self-updating ``created`` and ``modified`` fields. """ created = models.DateTimeField( auto_now_add=True, help_text='The time wh...
Python
0.000002
@@ -2053,26 +2053,63 @@ xt=' -Set as main object +Boolean indicating whether the entity is the main model thu
93b25421bb1cca24e6927304d23501edf1484a22
Add sstable count metric
metartg/checks/cassandra.py
metartg/checks/cassandra.py
#!/usr/bin/env python import simplejson as json from time import time import subprocess import os def tpstats_metrics(): p = subprocess.Popen([ '/usr/bin/java', '-jar', '/usr/share/metartg/contrib/GenericJMXLogJSON.jar', 'localhost', '8080', 'org.apache.cassandra.concurrent:*', ], stdou...
Python
0.002345
@@ -2341,32 +2341,223 @@ ),%0A %7D +%0A metrics%5B'%25s.%25s.count' %25 (keyspace, columnfamily)%5D = %7B%0A 'ts': now,%0A 'type': 'GAUGE',%0A 'value': len(sizes%5Bcolumnfamily%5D),%0A %7D %0A%0A return met
cdcae64d095a7cbab99e439bc37ee7009fe5c482
Mark version 0.3.1
mezzanine_polls/__init__.py
mezzanine_polls/__init__.py
__version__ = 0.3
Python
0.000008
@@ -10,9 +10,11 @@ __ = 0.3 +.1 %0A
afaa2dd700a7474b81b981b266ee5aaa977d28d5
Update team_rank_request.py to use response.json()
team_rank_request.py
team_rank_request.py
import requests from requests.auth import HTTPBasicAuth import secret import json x = 0 y = 0 parameters = 'teamstats' response = requests.get( 'https://www.mysportsfeeds.com/api/feed/pull/nfl/2016-2017-regular/playoff_team_standings.json?teamstats', auth=HTTPBasicAuth(secret.msf_username, secret.msf_pw)) r...
Python
0.000001
@@ -312,16 +312,42 @@ f_pw))%0A%0A +data = response.json()%0A%0A# rawdata @@ -365,16 +365,18 @@ content%0A +# data = j @@ -404,16 +404,18 @@ ode())%0A%0A +%0A%0A teamlist
e16fbffeaa31fcffe2a2b511828427473217d3c2
Fix iOS template by adding checking on string icon corresponding to identifier
templates/tpl.ios.py
templates/tpl.ios.py
from string import Template ### Strings licence = """The MIT License (MIT) Copyright (c) 2015 Cobaltians 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 l...
Python
0
@@ -2135,24 +2135,51 @@ dentifier%5D;%0A + if (icon != nil) %7B%0A NSRange @@ -2219,16 +2219,20 @@ ength);%0A + UICo @@ -2272,24 +2272,28 @@ learColor%5D;%0A + CGRect t @@ -2346,24 +2346,28 @@ ight);%0A %0A + UIFont * @@ -2443,16 +2443,20 @@ + size:siz @@ -2...
f326dd569e9240c2b883e9c5f436728f321a0c61
Add TransactionMiddleware
tenant/middleware.py
tenant/middleware.py
from django.core.urlresolvers import resolve from django.shortcuts import get_object_or_404 from tenant.models import Tenant from tenant.utils import connect_tenant_provider, disconnect_tenant_provider class TenantMiddleware(object): def process_request(self, request): request.tenant = None name ...
Python
0
@@ -84,16 +84,50 @@ t_or_404 +%0Afrom django.db import transaction %0A%0Afrom t @@ -761,8 +761,1182 @@ esponse%0A +%0A%0A%0Aclass TransactionMiddleware(object):%0A def get_tenant(self, request):%0A tenant = getattr(request, 'tenant', None)%0A if tenant:%0A return tenant.ident%0A %0...
28332ebd6292223d5b5197b98160b0b3831c1ed4
Fix conversion warning
modules/nettokom/backend.py
modules/nettokom/backend.py
# -*- coding: utf-8 -*- # Copyright(C) 2012 Florent Fourcot # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your op...
Python
0
@@ -2957,16 +2957,17 @@ rency = +u 'EUR'%0A
fa5fdc92f9f0a2eee1486e65d495979c3190fad8
put back the join message tj took out when he was going to do it another way
modules/python/ircclient.py
modules/python/ircclient.py
# Copyright (c) 2012 Stuart Walsh # # 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, merge, publish...
Python
0
@@ -4939,24 +4939,88 @@ l, client):%0A + client.send(%22:%7Bclient%7D JOIN :%7Bchannel%7D%22, channel=channel)%0A channe
48d4b35f92d848613297bdb9b5154f32b2c45d3b
rename 'set', add a missing return and fix a couple of other mode bugs
modules/python/ircclient.py
modules/python/ircclient.py
# Copyright (c) 2012 Stuart Walsh # # 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, merge, publish...
Python
0
@@ -2290,19 +2290,20 @@ rn%0A %0A -set +plus = True%0A @@ -2383,19 +2383,20 @@ :%0A -set +plus = True%0A @@ -2420,19 +2420,20 @@ :%0A -set +plus = False @@ -2477,19 +2477,20 @@ sible = -set +plus %0A i @@ -2491,19 +2491,20 @@ if -set +plus :%0A @@ -2893,16 +2893,38 @@ e +=...
7e2d3ca342749940e90cbc5d69df38bcc5a9f644
Fix queries too slow on list and get tests
moirai/database/__init__.py
moirai/database/__init__.py
# -*- coding: utf-8; -*- # # Copyright (c) 2016 Álan Crístoffer # # 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, ...
Python
0
@@ -1520,16 +1520,48 @@ 4 * 3600 +%0A self.__create_indexes() %0A%0A de @@ -3244,32 +3244,192 @@ %5B%0A %7B%0A + '$match': %7B%0A 'time': %7B%0A '$lt': 1%0A %7D%0A %7D%0A %7D,%0A %7B%...
83184a9ada18a82f3dfa4d73539f7a927ce50f01
Fix contact search breadcrumbs which were not correctly referencing parents
molly/apps/contact/views.py
molly/apps/contact/views.py
import simplejson import hashlib import urllib2 from datetime import timedelta from django.http import HttpResponse from django.utils.translation import ugettext as _ from molly.utils.views import BaseView from molly.utils.breadcrumbs import * from molly.apps.contact.providers import TooManyResults from .forms impor...
Python
0.000002
@@ -109,16 +109,25 @@ Response +, Http404 %0Afrom dj @@ -288,16 +288,37 @@ s import + BaseContactProvider, TooMany @@ -331,16 +331,34 @@ s%0A%0Afrom +molly.apps.contact .forms i @@ -383,18 +383,16 @@ ctForm%0A%0A -%0A%0A class In @@ -1164,36 +1164,52 @@ me,%0A -None +lazy_parent('index') ,%0A ...
5168c98ea9b903a06cb52c79da81fe598abcb570
use correct import
mpf/devices/shot_profile.py
mpf/devices/shot_profile.py
"""Shot profiles.""" from mpfmc.core.mode import Mode from mpf.core.system_wide_device import SystemWideDevice from mpf.core.mode_device import ModeDevice class ShotProfile(ModeDevice, SystemWideDevice): """A shot profile.""" config_section = 'shot_profiles' collection = 'shot_profiles' class_labe...
Python
0.000013
@@ -26,10 +26,8 @@ mpf -mc .cor
411b2a0758126a7a0eaafe1a8831c8c19abd903c
insert ICA reportlet title
mriqc/reports/individual.py
mriqc/reports/individual.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # pylint: disable=no-member # # @Author: oesteban # @Date: 2016-01-05 11:33:39 # @Email: code@oscaresteban.es # @Last modified by: oesteban """ Encapsulate...
Python
0.000001
@@ -3248,32 +3248,157 @@ = %5B%5D%0A else:%0A + if any(('melodic_reportlet' in k for k in in_plots)):%0A REPORT_TITLES%5B'bold'%5D.insert(3, 'ICA components')%0A%0A in_plots
f553eb0a451c3e755d41d646964b0c0c8e22f0e2
Update Finland's municipality data URL to 2016
munigeo/importer/finland.py
munigeo/importer/finland.py
""" munigeo importer for Finnish nation-level data """ import re import os import zipfile import requests import io from django import db from django.contrib.gis.gdal import DataSource, SpatialReference, CoordTransform from django.contrib.gis.geos import GEOSGeometry, MultiPolygon, Polygon, Point from munigeo.import...
Python
0
@@ -729,17 +729,17 @@ osta_201 -5 +6 _1000k.z @@ -3456,32 +3456,117 @@ oot_path, 'fi')%0A + if not os.path.exists(base_path):%0A os.makedirs(base_path)%0A path
119677750f88be27d1f7df8652e5457e5a424008
Fix syntax error.
myfedora/widgets/widgets.py
myfedora/widgets/widgets.py
# Copyright (C) 2008 Red Hat, Inc. All rights reserved. # # This copyrighted material is made available to anyone wishing to use, modify, # copy, or redistribute it subject to the terms and conditions of the GNU # General Public License v.2. This program is distributed in the hope that it # will be useful, but WITHOU...
Python
0.000004
@@ -2989,16 +2989,17 @@ Factory) +: %0A ent
e7f6f0be68a1de0312996b610255c7a624674a41
Configure mailgun
mysite/config/production.py
mysite/config/production.py
# -*- coding: utf-8 -*- ''' Production Configurations - Use djangosecure - Use Amazon's S3 for storing static files and uploaded media - Use sendgrid to send emails - Use MEMCACHIER on Heroku ''' from configurations import values # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings...
Python
0.000001
@@ -2937,31 +2937,36 @@ ue(' -mysite %3Cnoreply@example +hello %3Chello@digital-impacts .com @@ -3005,24 +3005,23 @@ e('smtp. -sendgrid +mailgun .com')%0A @@ -3018,26 +3018,24 @@ un.com')%0A - # EMAIL_HOST_ @@ -3097,24 +3097,23 @@ n_name=%22 -SENDGRID +MAILGUN _PASSWOR @@ -3115,26 +3115,24 @@ SSWORD%22)%0...
2626be18570958cca7665168f34166f1845ec6da
add test
test/service_test.py
test/service_test.py
# vim: set expandtab sw=4 ts=4: # # Unit tests for Service # # Copyright (C) 2014-2015 Dieter Adriaenssens <ruleant@users.sourceforge.net> # # This file is part of buildtimetrend/service # <https://github.com/buildtimetrend/service/> # # This program is free software: you can redistribute it and/or modify # it under th...
Python
0.000002
@@ -2817,28 +2817,479 @@ repo_allowed(%22name/test2%22))%0A +%0A def test_is_repo_allowed_set_denied_allowed(self):%0A # set denied repo%0A self.settings.add_setting(%22denied_repo%22, %7B%22test1%22%7D)%0A # set allowed repo%0A self.settings.add_setting(%22allowed_repo%22, %7B%22name%22...
e35fd7126b5e82d9628185bbe6503e288600ff53
Fix flow formatting unit tests.
test/test_console.py
test/test_console.py
from libmproxy import console, proxy, filt, flow import tutils import libpry class uState(libpry.AutoTree): def test_flow(self): """ normal flow: connect -> request -> response """ c = console.ConsoleState() f = self._add_request(c) assert f.req...
Python
0
@@ -2706,156 +2706,8 @@ ()%0A%0A - assert ('method', '%5Bedited%5D ') in console.format_flow(f, True)%0A assert ('method', '%5Bedited%5D ') in console.format_flow(f, True, True)%0A @@ -2760,33 +2760,32 @@ thod', '%5Breplay%5D - ') in console.fo @@ -2838,17 +2838,16 @@ %5Breplay%5D - ') in co
2af6533a366e008253f1ee07706ab07f6071f112
Remove duplicated import
vcs_info_panel/tests/test_clients/test_git.py
vcs_info_panel/tests/test_clients/test_git.py
import subprocess import datetime import pytz from unittest.mock import patch import datetime from django.test import TestCase from vcs_info_panel.clients.git import GitClient def without_git_repository(*commands): def decorator(func): def inner(*args, **kwargs): with patch('subprocess.check...
Python
0.000002
@@ -11,32 +11,16 @@ process%0A -import datetime%0A import p
b39ac9a59c4e6a36baa67a7ec57e687ee673aa68
Check for required UFO info fields
Lib/fontbakery/specifications/ufo_sources.py
Lib/fontbakery/specifications/ufo_sources.py
# -*- coding: utf-8 -*- # # This file has been automatically formatted with `yapf --style ' # {based_on_style: google}'` and `docformatter`. from __future__ import (absolute_import, division, print_function, unicode_literals) from fontbakery.callable import check, condition from fontbakery.chec...
Python
0
@@ -340,16 +340,22 @@ R, FAIL, + WARN, PASS, S @@ -2878,16 +2878,1259 @@ rce.%22%0A%0A%0A +@register_check%0A@check(id='com.daltonmaag/check/required-fields')%0Adef com_daltonmaag_check_required_fields(font):%0A %22%22%22Check that required fields are present in the UFO fontinfo.%0A%0A ufo2ft requires these i...
b234ab98b9c1b23f16648e39b6091fd39d10ac89
change rollback states to failure states and handle missing finial cfn state as failure - add DELETE_COMPLETE to failure states
src/main/python/gaius/service.py
src/main/python/gaius/service.py
# -*- coding: utf-8 -*- """ Interface to the Crassus Lambda function. This module notifies Crassus about updates to a CFN stack so Crassus will trigger the update process. """ import json import logging from datetime import datetime from dateutil import tz, parser as datetime_parser from time import sleep import boto...
Python
0
@@ -397,31 +397,8 @@ E',%0A - 'DELETE_COMPLETE',%0A @@ -586,16 +586,39 @@ _FAILED' +,%0A 'DELETE_COMPLETE' %0A%5D%0A%0A%0Adef
367fed89f27e0a5a7947fc32540c99bcba58fbad
Improve HTTP error reporting.
zerver/management/commands/register_server.py
zerver/management/commands/register_server.py
import subprocess from argparse import ArgumentParser from typing import Any, Dict import requests from django.conf import settings from django.core.management.base import CommandError from django.utils.crypto import get_random_string from requests.models import Response from zerver.lib.management import ZulipBaseCom...
Python
0
@@ -4692,16 +4692,21 @@ TTPError + as e :%0A @@ -4715,38 +4715,179 @@ -content_dict = response.json() +# Report nice errors from the Zulip API if possible.%0A try:%0A content_dict = response.json()%0A except Exception:%0A raise e%0A %0A
6e6e2e03da2f4ef141b51843ca16fdb52f0770ca
Use tokenized no-reply address in send_test_email.
zerver/management/commands/send_test_email.py
zerver/management/commands/send_test_email.py
from typing import Any from django.conf import settings from django.core.mail import mail_admins, mail_managers, send_mail from django.core.management import CommandError from django.core.management.commands import sendtestemail from zerver.lib.send_email import FromAddress class Command(sendtestemail.Command): ...
Python
0
@@ -1139,15 +1139,36 @@ ess. -NOREPLY +tokenized_no_reply_address() , kw
90af4693dce351499e6898f02a5b2f6c2a0ca99f
Fix https://github.com/mottosso/Qt.py/issues/24
Qt.py
Qt.py
"""Map all bindings to PySide2 This module replaces itself with the most desirable binding. Resolution order: - PySide2 - PyQt5 - PySide - PyQt4 Usage: >>> import sys >>> from Qt import QtWidgets >>> app = QtWidgets.QApplication(sys.argv) >>> button = QtWidgets.QPushButton("Hello Worl...
Python
0.000003
@@ -410,9 +410,9 @@ 0.2. -3 +4 %22%0A%0A%0A @@ -601,32 +601,90 @@ e.pyqtProperty%0A%0A + from PyQt5 import uic%0A PyQt5.load_ui = uic.loadUi%0A%0A # Add%0A Py @@ -1121,24 +1121,82 @@ qtProperty%0A%0A + from PyQt4 import uic%0A PyQt4.load_ui = uic.loadUi%0A%0A # Add%0A @@ -1654,208 +1654,7...
077b7cf72cc8347f9509f564ba702cc25013a0e8
Refactor ca.py
ca.py
ca.py
import random from time import sleep from tqdm import tqdm import numpy as np import matplotlib.pyplot as plt def new_mitotic_event(): return np.random.randint(5,11) def check_full_neighborhood(cell, cells): #TODO: comprobar el grid para ver si el vecindario tiene espacio return True #Devolver lista con posic...
Python
0.000002
@@ -389,122 +389,229 @@ lt): -%0A return tests_result%5B0%5D == '1'%0A%0Adef if_apply_mitotic(mitotic_candidate_cell, cells):%0A return tests_result%5B1 + # Randomly death or mutation damage applied%0A return tests_result%5B0%5D == '1' or tests_result%5B1%5D == '1'%0A%0Adef if_apply_mitotic(tests_result):%0A ...
e6a807733c689d632c3d217962a78b49ba485516
Make sure we don't overwrite a result file
plumbium/processresult.py
plumbium/processresult.py
from __future__ import print_function import datetime from functools import wraps import json import os import os.path import shutil from subprocess import check_output, STDOUT, CalledProcessError import tarfile import tempfile import traceback import sys class Pipeline(object): def __init__(self): self.d...
Python
0.000001
@@ -965,16 +965,71 @@ inally:%0A + self.finish_date = datetime.datetime.now()%0A @@ -2064,16 +2064,86 @@ H:%25M'),%0A + 'finish_date': self.finish_date.strftime('%25Y%25m%25d %25H:%25M'),%0A @@ -2607,24 +2607,50 @@ le.open( +self._clear_filename('.', basename + '.tar @@ ...
a971b84541b991bbc14be73e94b633c88edcd567
Remove unused vars
programs/ledcube/audio.py
programs/ledcube/audio.py
# # Copyright (c) 2014 PolyFloyd # import io import numpy.fft import os import pyaudio class Source: def get_spectrum(self, signal): n = len(signal) signal = numpy.array([(s + 1) / 2 for s in signal], dtype=float) spectrum = numpy.abs(numpy.fft.rfft(signal)) freqs = numpy.fft...
Python
0.000001
@@ -33,18 +33,8 @@ %0A#%0A%0A -import io%0A impo @@ -59,23 +59,8 @@ t os -%0Aimport pyaudio %0A%0Acl @@ -112,32 +112,8 @@ l):%0A - n = len(signal)%0A
1c66a337dd14b7ce148e356b729d538413093b8c
Update admin for deform-fields
project/apps/api/admin.py
project/apps/api/admin.py
# import logging # log = logging.getLogger(__name__) from django.contrib import admin from django_object_actions import ( DjangoObjectActions, takes_instance_or_queryset, ) from easy_select2 import select2_modelform from .models import ( Convention, Contest, Contestant, Group, Performanc...
Python
0
@@ -3975,32 +3975,152 @@ 'kind',%0A )%0A%0A + readonly_fields = (%0A 'director',%0A 'lead',%0A 'tenor',%0A 'baritone',%0A 'bass',%0A )%0A%0A save_on_top
573b34ef9a07b47549d8074548fc0b7a7238b016
fix flake8 error
project/ctnotify/views.py
project/ctnotify/views.py
# -*- coding: utf-8 -*- import json # from werkzeug import Response from boto.s3.connection import S3Connection from boto.s3.key import Key from google.appengine.api import urlfetch from google.appengine.ext import deferred from kay.utils import render_to_response from ctnotify.queue import get_process_que, get_s...
Python
0
@@ -1231,17 +1231,19 @@ '%60%60%60%5Cn' -+ + + json.dum @@ -2194,16 +2194,45 @@ ss_key,%0A +
3dd0d906832d353ff46df699e9ed78757641c50f
Update settings.py
projfd/projfd/settings.py
projfd/projfd/settings.py
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) import getpass, imp, os from django.utils.crypto import get_random_string from subprocess import check_output BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SETTINGS_DIR = os.path.dirname(__file__) PROJECT_PATH = os.path.jo...
Python
0.000001
@@ -1671,32 +1671,15 @@ cial -.apps.django_app.default +_django ',%0A @@ -2380,32 +2380,37 @@ S = (%0A 'social +_core .backends.facebo @@ -2431,32 +2431,37 @@ th2',%0A 'social +_core .backends.google @@ -2486,16 +2486,21 @@ 'social +_core .backend
60887e7ffb6954bc78b0be7ece93690211837149
remove debug code
hs.py
hs.py
#!/usr/bin/python3 ################################################################################ # hs.py - Hokie Stalker # Query the Virginia Tech people search service for information about a person. # Licensed under the New BSD License. # # https://github.com/mutantmonkey/hokiestalker # author: mutantmonkey <mutan...
Python
0.02323
@@ -2006,35 +2006,8 @@ xt%0A%0A - print(entry_data)%0A%0A
50628685c310703fb24f266dfd4d72b666eecfa4
Update version to 1.0.0 (not yet tagged)
py/desisurvey/_version.py
py/desisurvey/_version.py
__version__ = '0.8.2.dev415'
Python
0
@@ -12,18 +12,11 @@ = ' -0.8.2.dev415 +1.0.0 '%0A
aa13f33ec07b6a1dd9728d311c2c05b2a333b5a6
Fix wrong reference to self in internalServerErrorHandler.
src/sheared/web/server/server.py
src/sheared/web/server/server.py
# vim:nowrap:textwidth=0 # # Sheared -- non-blocking network programming library for Python # Copyright (C) 2003 Sune Kirkeby <sune@mel.interspace.dk> # # This program 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 Fou...
Python
0.999918
@@ -1673,26 +1673,28 @@ r%5Cn')%0A se -lf +rver .logInternal
5934d94c9644eaea850a27773db5890b68078477
Load all api items
pybossa_analyst/client.py
pybossa_analyst/client.py
# -*- coding: utf8 -*- """API client module for pybossa-analyst.""" import enki class PyBossaClient(object): """A class for interacting with PyBossa.""" def __init__(self, app=None): """Init method.""" self.app = app if app is not None: # pragma: no cover self.init_app(a...
Python
0
@@ -556,578 +556,1659 @@ def -get_results(self, project_id, **kwargs):%0A %22%22%22Return results.%22%22%22%0A return enki.pbclient.find_results(project_id, all=1, **kwargs)%0A%0A def get_tasks(self, project_id, **kwargs):%0A %22%22%22Return tasks.%22%22%22%0A return enki.pbclient.find_...
701405657d4edcf3c953a7f45866829f7294d2d0
make tests a bit more robust about the cwd
pycket/test/test_basic.py
pycket/test/test_basic.py
import pytest from pycket.expand import expand, to_ast from pycket.interpreter import * from pycket.values import * from pycket.prims import * def run_fix(p,v): e = expand(p) ast = to_ast(e) val = interpret_one(ast) assert isinstance(val, W_Fixnum) assert val.value == v def run(p,v): e = expan...
Python
0.000001
@@ -7,16 +7,26 @@ pytest%0A +import os%0A from pyc @@ -147,16 +147,100 @@ port *%0A%0A +stdlib_fn = os.path.join(os.path.dirname(os.path.dirname(__file__)), %22stdlib.sch%22)%0A%0A def run_ @@ -505,23 +505,17 @@ ile( -%22../ stdlib -.sch%22 +_fn ) as
73b7d0670414ec65a152d239a5c5c60464ce8ff9
Fix bad import. Fixes #2196
pymatgen/core/__init__.py
pymatgen/core/__init__.py
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ This package contains core modules and classes for representing structures and operations on them. """ import os try: from ruamal import yaml except ImportError: try: import ruamel_yaml as...
Python
0.000001
@@ -240,17 +240,17 @@ rom ruam -a +e l import
afd6afa06e60676d1d633de9529dde0a5c4b6683
Remove unnecessary yield
python/ciphers/polyval.py
python/ciphers/polyval.py
# Copyright 2021 Google LLC # # Use of this source code is governed by an MIT-style # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. import ciphers.cipher import ciphers.gf import parsers.polyval class Hash(ciphers.cipher.Cipher): def make_testvector(self, input, descr...
Python
0.000015
@@ -1280,24 +1280,32 @@ in -range(0, 80, 16) +%5B0, 16, 32, 48, 64, 256%5D :%0A @@ -1346,44 +1346,8 @@ len%7D -%0A yield %7B**v, %22message%22: 256%7D %0A%0A
d55f2b98822faa7d71f5fce2bfa980f8265e0610
Use take() instead of takeSample() in PySpark kmeans example.
python/examples/kmeans.py
python/examples/kmeans.py
""" This example requires numpy (http://www.numpy.org/) """ import sys import numpy as np from pyspark import SparkContext def parseVector(line): return np.array([float(x) for x in line.split(' ')]) def closestPoint(p, centers): bestIndex = 0 closest = float("+inf") for i in range(len(centers)): ...
Python
0
@@ -835,24 +835,76 @@ gv%5B4%5D)%0A%0A +# TODO: change this after we port takeSample()%0A # kPoints = da @@ -931,16 +931,43 @@ K, 34)%0A + kPoints = data.take(K)%0A temp
d9f0f53997bbaea4a55588f2d7edcb2ae9e85184
remove install-time PySerial dependency and don't fail if installed as non-root
python/fibre/discovery.py
python/fibre/discovery.py
""" Provides functions for the discovery of Fibre nodes """ import sys import json import time import threading import traceback import fibre.protocol import fibre.utils import fibre.remote_object import fibre.serial_transport from fibre.utils import Event, Logger from fibre.protocol import ChannelBrokenException # L...
Python
0
@@ -195,38 +195,8 @@ ect%0A -import fibre.serial_transport%0A from
e0c3a6d602549633fd4ec732b88ca8e6ef2e7d27
optimize parameter name
python/paddle/v2/layer.py
python/paddle/v2/layer.py
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
Python
0.00001
@@ -1265,24 +1265,25 @@ parent_layer +s ):%0A a @@ -1311,16 +1311,17 @@ nt_layer +s , dict)%0A @@ -1416,16 +1416,17 @@ nt_layer +s __ = par @@ -1434,16 +1434,17 @@ nt_layer +s %0A%0A de @@ -1570,21 +1570,21 @@ for -param +layer _name in @@ -1603,16 +1603,17 @@ nt_layer +s __:%0A @@ -1653,...
07f8b59e5708d423da709d91170f2ecd3946a397
add to the logging if you are using break_on_open or not
pythonx/vdebug/session.py
pythonx/vdebug/session.py
from __future__ import print_function import socket import vim from . import dbgp from . import error from . import event from . import listener from . import log from . import opts from . import util class SessionHandler: def __init__(self, ui, breakpoints): self.__ui = ui self.__breakpoints ...
Python
0
@@ -6502,57 +6502,229 @@ -status = self.__api.step_into()%0A else: +log.Log('starting with step_into (break_on_open = 1)', log.Logger.DEBUG)%0A status = self.__api.step_into()%0A else:%0A log.Log('starting with run (break_on_open = 0)', log.Logger.DEBUG) %0A ...
b5f2e4127a36d8509cd4ab3932ae20408726229d
rename clear_list() -> clear_object(), add random_string()
pywincffi/dev/testutil.py
pywincffi/dev/testutil.py
""" Test Utility ------------ This module is used by the unittests. """ import os import subprocess import sys from cffi import FFI, CDefError try: # The setup.py file installs unittest2 for Python 2 # which backports newer test framework features. from unittest2 import TestCase as _TestCase except Impo...
Python
0.000059
@@ -105,16 +105,94 @@ port sys +%0Afrom random import choice%0Afrom string import ascii_lowercase, ascii_uppercase %0A%0Afrom c @@ -2887,19 +2887,21 @@ ear_ -lis +objec t(self, list @@ -2896,21 +2896,21 @@ t(self, -list_ +thing ):%0A @@ -2928,189 +2928,1014 @@ -Clear a Python list of entries in plac...
e7d379af6040f223f7c5627ed7727c3410eb3950
Update at 2017-07-21 16-38-19
tt.py
tt.py
import json import random from pathlib import Path import numpy as np import scipy.misc from moviepy.editor import VideoFileClip from tqdm import tqdm class WindowNpyGenerator(object): def __init__(self, n_train=None, n_val=None, fps=1, timesteps...
Python
0
@@ -1393,16 +1393,18 @@ , desc=' + chunk'): @@ -1739,20 +1739,23 @@ , desc=' -data +windows ')):%0A
e6104a60ba37cf7c34d371d51bce107ce69a0d06
rename handlers to handler-names in tests
src/unittest/python/cli_tests.py
src/unittest/python/cli_tests.py
from __future__ import print_function, absolute_import, division from unittest import TestCase import monocyte.cli as cli class CliTest(TestCase): def test_cloudwatch_can_be_deactivated(self): test_config = { "cloudwatchlogs": {} } expected_config = { "cloudw...
Python
0
@@ -2201,19 +2201,20 @@ '-- -use- handler +-name s': @@ -2636,16 +2636,21 @@ 'handler +_name s': %5B'ha
d680fca8bef783bd6fad7c71989ca51fb4725bc8
upgrade to latest chatexchange+fix
ws.py
ws.py
#requires https://pypi.python.org/pypi/websocket-client/ import websocket import threading import json,os,sys,getpass,time from findspam import FindSpam from ChatExchange.chatexchange.client import * import HTMLParser parser=HTMLParser.HTMLParser() if("ChatExchangeU" in os.environ): username=os.environ["ChatExchang...
Python
0
@@ -846,16 +846,30 @@ (data):%0A + return True%0A global @@ -1810,63 +1810,52 @@ -wrap +room .send -M +_m essage( -%2211540%22, s)%0A -wrap +room m.send -M +_m essage( -%2289%22, s)%0A @@ -2074,19 +2074,18 @@ n;%0A if( -msg +ev .content @@ -2127,11 +2127,10 @@ str( -msg +ev .dat @@ -2204,16 +...
e480a5e93015989d87331c5d8c0b251c73d40e2c
Use raw_id_fields in the TokenAdmin
readthedocs/core/admin.py
readthedocs/core/admin.py
# -*- coding: utf-8 -*- """Django admin interface for core models.""" from datetime import timedelta from django.contrib import admin from django.contrib.auth.admin import UserAdmin from django.contrib.auth.models import User from django.utils import timezone from django.utils.translation import ugettext_lazy as _ ...
Python
0
@@ -409,16 +409,238 @@ Project%0A +from rest_framework.authtoken.admin import TokenAdmin%0A%0A# Monkeypatch raw_id_fields onto the TokenAdmin%0A# https://www.django-rest-framework.org/api-guide/authentication/#with-django-admin%0ATokenAdmin.raw_id_fields = %5B'user'%5D %0A%0Aclass
6d8880c10dab2614e0c0856da68a0dd1413fb655
Add SSL configuration option for PostgreSQL
redash/query_runner/pg.py
redash/query_runner/pg.py
import json import logging import select import sys import psycopg2 from redash.query_runner import * from redash.utils import JSONEncoder logger = logging.getLogger(__name__) types_map = { 20: TYPE_INTEGER, 21: TYPE_INTEGER, 23: TYPE_INTEGER, 700: TYPE_FLOAT, 1700: TYPE_FLOAT, 701: TYPE_FLO...
Python
0.000001
@@ -1841,32 +1841,196 @@ %22Database Name%22%0A + %7D,%0A %22sslmode%22: %7B%0A %22type%22: %22string%22,%0A %22title%22: %22SSL Mode%22,%0A %22default%22: %22prefer%22%0A
af5b574fb785e65fd1292bb28e90d005be1ecd03
Fix pep8 errors
reporter/test/test_osm.py
reporter/test/test_osm.py
# coding=utf-8 """Test cases for the OSM module. :copyright: (c) 2013 by Tim Sutton :license: GPLv3, see LICENSE for more details. """ import os from reporter.utilities import LOGGER from reporter.osm import load_osm_document, extract_buildings_shapefile from reporter.test.helpers import FIXTURE_PATH from reporter.te...
Python
0.000217
@@ -1375,21 +1375,16 @@ verpass -test failed %25
acf2d57fa49a5ed25275a279d04946178f8cedde
Fix formatting and add doc strings
reporting_scripts/base.py
reporting_scripts/base.py
import csv from pymongo import MongoClient class BaseEdX(object): def __init__(self, args): self.url = args.url client = MongoClient(self.url) self.db = client[args.db_name] self.collections = None self.output_directory = args.output_directory self.row_limit = args...
Python
0.000002
@@ -466,16 +466,106 @@ _file):%0A + %09%22%22%22%0A %09Genersate csv report from generated data and given list of headers%0A %09%22%22%22%0A %09sel @@ -586,16 +586,16 @@ sv_data%0A - %09sel @@ -716,18 +716,20 @@ limit:%0A%09 -%09%09 + self._wr @@ -757,25 +757,24 @@ t_file)%0A -%09 %09else:%...
6d74c9d233aa44fd7072a269fa200bea610026b7
move WSfactory declaration for insecure connections to work
Web.py
Web.py
from autobahn.twisted.websocket import WebSocketServerFactory, WebSocketServerProtocol, listenWS from twisted.web.server import Site from twisted.web.static import File from twisted.internet import reactor, task, ssl from twisted.web.util import Redirect from twisted.web.resource import Resource from Addresses import C...
Python
0
@@ -1357,63 +1357,8 @@ WS%0A - WSfactory.protocol = self.MyServerProtocol%0A @@ -1427,32 +1427,87 @@ %22, debug=False)%0A + WSfactory.protocol = self.MyServerProtocol%0A list
16c8a739ab69e0888334923b3d7d8039620f59a3
Return the correctly sorted list of teams for playoffs
api.py
api.py
from flask.ext import restful from flask.ext.restful import Resource, Api, fields, marshal_with from fllipit import APP from models import DB, Team import pypyodbc API = Api(APP) # Get teams from the database def getTeams(): teams = [] if APP.config['TEST_DB']: # In test mode, use the sqlite database...
Python
0.999999
@@ -4091,193 +4091,9 @@ er)%0A - %0A - if roundNumber %3C= 4:%0A # If this is the first playoff round, return team list sorted by qualifying rank%0A return rankTeams(teams)%0A else:%0A @@ -4156,28 +4156,24 @@ und%0A - return sorte @@ -4171,28 +4171,2...
0e58ef45f45df0192be6c52cd34df5f1b5c5a028
correct if condition
app.py
app.py
#!/usr/bin/env python import urllib import json import os from flask import Flask from flask import request from flask import make_response # Flask app should start in global layout app = Flask(__name__) @app.route('/webhook', methods=['POST']) def webhook(): req = request.get_json(silent=True, force=True) ...
Python
0.999998
@@ -622,16 +622,17 @@ tion%22) = += %22tell.h
ceba6831778d896a9e320d04cea5d5d4e3accc13
rename sms handling function
app.py
app.py
#!/usr/bin/env python import os import random from datetime import datetime, timedelta import twilio.twiml from flask import Flask, request from flask.ext.pymongo import PyMongo, DESCENDING app = Flask(__name__) CONFIGS = ( 'AUTH_TOKEN', 'CELL_NUM', 'MONGOLAB_URI', 'TWILIO_NUM', ) # Set up the app ...
Python
0.000056
@@ -5095,12 +5095,14 @@ def -send +handle _sms
844c66cf2c484758567903e7c559ef005b44c85e
Check for lack of javascript and add usage message.
app.py
app.py
from PIL import Image, ImageFile import flask import os from gevent.event import AsyncResult, Timeout from gevent.queue import Empty, Queue from shutil import rmtree from hashlib import sha1 from stat import S_ISREG, ST_CTIME, ST_MODE DATA_DIR = 'data' KEEP_ALIVE_DELAY = 45 MAX_IMAGE_SIZE = 800, 600 MAX_IMAGES = 10 ...
Python
0
@@ -3285,17 +3285,286 @@ /h3%3E%0A%3Cp%3E -I +Upload an image for everyone to see. Valid images are pushed to everyone%0Acurrently connected, and only the most recent 10 images are saved.%3C/p%3E%0A%3Cnoscript%3ENote: You must have javascript enabled in order to upload and%0Adynamically view new images.%3C/noscript%3E...
56d221e2b9a1f04ff8ca14c6ad3cb628633e35fd
Simplify query.
app.py
app.py
import chdb import flask import flask_sslify from flask.ext.compress import Compress import os import collections def get_db(): db = getattr(flask.g, '_db', None) if db is None: db = flask.g._db = chdb.init_db() return db Category = collections.namedtuple('Category', ['id', 'title']) CATEGORY_AL...
Python
0.999999
@@ -1623,20 +1623,8 @@ ets, - categories, art @@ -1651,30 +1651,8 @@ ERE -categories.id = ? AND snip @@ -1729,21 +1729,9 @@ d = -categories.id +? ORD
925ccb3c563da694866aa7396b71222d3ef1c2d6
Update path again
app.py
app.py
import json import datetime import random import os from flask import Flask from flask import render_template app = Flask(__name__) def isWeekend(date): if date.weekday() == 5 or date.weekday() == 6: return True else: return False def fuckShitUp(s): # Divide into words words = s.sp...
Python
0
@@ -691,16 +691,17 @@ Path = %22 +/ storage/
e33a06ad4d4a7494f925a96e9d272e32e4dc18ba
Return json when error occurs
app.py
app.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from flask import Flask, request, json from flask.ext.cors import CORS import database import rsser import logging import threading logging.basicConfig(level=logging.INFO) logging.getLogger("gospellibrary").setLevel(logging.WARNING) logging.getLogger("requests").setLevel...
Python
0.000142
@@ -1130,31 +1130,87 @@ return -%22ERROR%22 +json.dumps(%7B%22error%22: %22No %5C%22speakers%5C%22 field in request data!%22%7D) %0A%0A if len @@ -1305,26 +1305,90 @@ return -%22%22 +json.dumps(%7B%22error%22: %22Speaker list was empty. Ignoring request.%22%7D) %0A%0A id_ = @@ -1727,15 +1727,65 @...
d177d63ebc87208fdba4227377b2e1aebda8f077
Add port code for Heroku
app.py
app.py
from flask import Flask, Response, request from hypermedia_resource import HypermediaResource from hypermedia_resource.wrappers import HypermediaResponse, ResponseBuilder import maze app = Flask(__name__) # Helper functions for the views def maze_resource(type_of): """ Sets up a HypermediaResource for the re...
Python
0.000003
@@ -1,12 +1,22 @@ +import os%0A from flask i @@ -1578,35 +1578,84 @@ -app.debug = True%0A app.run( +port = int(os.environ.get(%22PORT%22, 5000))%0A app.run(host='0.0.0.0', port=port )%0A
874f63fff012c00a39c553e7eb9ca0ffcb4dcd18
error message: ERROR
app.py
app.py
#System Imports import sys, os import json import static import time import random from shutil import copyfile import operator import urllib2 import itertools import subprocess import math # from filechunkio import FileChunkIO from celery import Celery from collections import defaultdict, OrderedDict import collections...
Python
0.999999
@@ -2699,36 +2699,21 @@ return ' -Something went wrong +ERROR '%0A%0A%0A%0A%0A#
b03ac5fec972ba3014ecd68337f5f390e607a791
Add link to source. Center layout.
app.py
app.py
from PIL import Image, ImageFile import flask import os from gevent.event import AsyncResult, Timeout from gevent.queue import Empty, Queue from shutil import rmtree from hashlib import sha1 from stat import S_ISREG, ST_CTIME, ST_MODE DATA_DIR = 'data' KEEP_ALIVE_DELAY = 45 MAX_IMAGE_SIZE = 800, 600 MAX_IMAGES = 10 ...
Python
0
@@ -3125,17 +3125,17 @@ -width: -5 +8 00px;%0A @@ -3245,16 +3245,67 @@ ospace;%0A + text-align:center;%0A %7D%0A%0A a %7B%0A color: #fff;%0A %7D%0A%3C/st @@ -3455,18 +3455,18 @@ recent -10 +%25s images @@ -3480,16 +3480,229 @@ ed.%3C/p%3E%0A +%3Cp%3EThe complete source for this Flask web service...
096cd81f318e8446855fb806772c674328adc6b2
Create app.py
app.py
app.py
#!/usr/bin/env python from __future__ import print_function from future.standard_library import install_aliases install_aliases() from urllib.parse import urlparse, urlencode from urllib.request import urlopen, Request from urllib.error import HTTPError import json import os from flask import Flask from flask impor...
Python
0.000003
@@ -1223,17 +1223,16 @@ n res%0A%0A%0A -# def make @@ -1249,17 +1249,16 @@ eq):%0A -# result @@ -1280,17 +1280,16 @@ lt%22)%0A -# paramet @@ -1327,13 +1327,12 @@ -#city +news = p @@ -1368,16 +1368,15 @@ -# if -city +news is @@ -1380,33 +1380,32 @@ is None:%0A -# return None%0...
60cdd82801a4193901c24ffd224086dd5b1a0163
fix #1 and issues in the verification
app.py
app.py
import os import base64 from io import StringIO from flask import Flask, render_template, redirect, url_for, flash, session, \ abort from werkzeug.security import generate_password_hash, check_password_hash from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.login import LoginManager, UserMixin, login_user, ...
Python
0
@@ -766,14 +766,16 @@ urn +%22 123456 +%22 %0A%0Ade @@ -1121,16 +1121,100 @@ ing(16)) +%0A %0A def __init__(self, **kwargs):%0A super(User, self).__init__(**kwargs) %0A%0A @p @@ -3688,28 +3688,66 @@ we -check the token%0A +get out of here%0A return redirect(url_for('index'))%0A ...
948100fde4a648e0f269c08fcb22ebdbc16948f1
move every get method into the new condor
app.py
app.py
# bultin library # external libraries from sanic import Sanic from sanic.response import text, json from condor.dbutil import requires_db from condor.models import Bibliography, RankingMatrix, TermDocumentMatrix, Document app = Sanic(__name__) @app.route("/ping") async def start(request): return text("pong") ...
Python
0
@@ -615,50 +615,29 @@ in -list_r +R anking -_m +M atri -ces_from_db(db, count=10 +x.list(db )%0A @@ -679,241 +679,8 @@ s)%0A%0A -def list_ranking_matrices_from_db(db, count):%0A %22%22%22%0A List all ranking matrices%0A %22%22%22%0A ranking_matrices = db.query(RankingMatrix).order_by(%0A Ran...
e98b499704fbd9043be74e80dfe4cbae29ae47b9
send images in conversations
app.py
app.py
import os import config from flask import Flask, request, render_template from flask_sqlalchemy import SQLAlchemy from analytics import Analytics # --------------------------------------------------------------- # ACCESS_TOKEN = os.environ.get('ACCESS_TOKEN', config.ACCESS_TOKEN) VERIFY_TOKEN = os.environ.get('VERIFY...
Python
0
@@ -4692,18 +4692,22 @@ e_image( -id +sender =sender,
8fc38abecd4a9cba6579c7a422b957748115f450
disable CSRF token
app.py
app.py
from flask import Flask, render_template, flash from flask_wtf import Form from flask_wtf.file import FileField from tools import s3_upload import json app = Flask(__name__) app.config.from_object('config') class UploadForm(Form): example = FileField('Example File') @app.route('/', methods=['POS...
Python
0.000001
@@ -368,16 +368,34 @@ oadForm( +csrf_enabled=False )%0D%0A i
e33174b6fcf8110478ec84016781ed65df7eb055
Add web-interface to utility
app.py
app.py
#!notify/bin/python3 import hug import os from pushbullet import Pushbullet @hug.cli() def create_note(title: hug.types.text, content: hug.types.text): api_key = os.environ["PB_API_KEY"] pb = Pushbullet(api_key) pb.push_note(title, content) if __name__ == '__main__': create_note.interface.cli()
Python
0.999987
@@ -72,16 +72,27 @@ ullet%0A%0A%0A +@hug.get()%0A @hug.cli
3bfbc1de88aadc5e0e20dea8443cc26f99c34c63
Remove type ignore
bot.py
bot.py
from __future__ import annotations import asyncio import logging import lzma import os import sys import tarfile from asyncio import Task from datetime import datetime from pathlib import Path from typing import Any, Iterable, Optional, Type, TypeVar, overload import aiohttp import toml from asyncqlio.db import Datab...
Python
0.000001
@@ -1149,16 +1149,23 @@ nc(bot: +Beattie Bot, mes @@ -1335,24 +1335,8 @@ .id) - # type: ignore %0A
ed3ee7caae9ce754e2ec098e8889bfbed2198aa6
Print log msg before trying to write to log file
bot.py
bot.py
#!/usr/bin/python import init_twit as tw import markovgen, time, re, random, codecs # make a separate file for these reusable functions: bot.py # main bot-specific app logic in app.py corpus_file = 'corpus.txt' with open(corpus_file) as text: markov = markovgen.Markov(text) def log(msg): with codecs.open('log','a'...
Python
0
@@ -286,16 +286,27 @@ g(msg):%0A +%09print msg%0A %09with co @@ -359,27 +359,16 @@ sg+%22%5Cn%22) -%0A%09print msg %0A%0Adef ge
2f4c3f721649359f475dbfcbbf50bd3816ca436d
Set game and online status in init, change is_owner implementation for selfbots
bot.py
bot.py
import datetime import sys import aiohttp import discord from discord.ext import commands from config import Config from utils import contextmanagers, exceptions class BContext(commands.Context): """An extension of Context to add reply and mention methods, as well as support use with self bots""" async ...
Python
0
@@ -1668,40 +1668,409 @@ s -uper().__init__(*args, **kwargs) +elf_bot = kwargs.get('self_bot')%0A if self_bot:%0A game = None%0A status = discord.Status.idle%0A else:%0A game = discord.Game(name='b%3Ehelp')%0A status = None%0A super().__init__(*args, ...
0d00da01ef8aa6534247e933c81c66b477d1ab3c
Use send_message instead of whisper in on_command_error.
bot.py
bot.py
from discord.ext import commands import discord from cogs.utils import checks import datetime, re import json, asyncio import copy description = """ Hello! I am a bot written by Danny to provide some nice utilities. """ initial_extensions = [ 'cogs.meta', 'cogs.splatoon', 'cogs.rng', 'cogs.mod', '...
Python
0
@@ -676,24 +676,49 @@ ait bot. -whisper( +send_message(ctx.message.author, 'This co @@ -837,16 +837,41 @@ bot. -whisper( +send_message(ctx.message.author, 'Sor
132b422e81c8a3f3de4d1600acdc6a71327bfc1e
Update bro .py
bro.py
bro.py
def combiner(verbose, files=[]): import subprocess import os import time files = files.split("\n") files.pop(-1) if verbose == False: epoch = time.time() path = os.getcwd() os.mkdir(path + "/" + str(epoch)) os.chdir(path + "/" + str(epoch)) for file in files: subprocess.check_output(["bro","-r",fil...
Python
0.000001
@@ -1,16 +1,11 @@ def -combiner +bro (ver
4aad9aeb5acf0c8aba609a53f20107ec48cdfa2b
Initialise gpio
car.py
car.py
import time, os, sys import wiringpi as io class light(object): def __init__(self, pin): #make pins into output io.pinMode(pin,1) #set output low io.digitalWrite(pin,0) #set variables self.status = 0 self.pin = pin def on(self): #turn light on ...
Python
0.000003
@@ -602,16 +602,111 @@ eep(2)%0A%0A +#initialise%0Atry:%0A io.wiringPiSetupGpio()%0Aexcept:%0A print %22GPIO issue%22, sys.exc_info()%5B0%5D%0A%0A lightFL
43a26a77d84fb8547564518a8469be69ed852cf1
add discourse to csp
csp.py
csp.py
csp = { 'default-src': '\'self\'', 'style-src': [ '\'self\'', '\'unsafe-inline\'', 'fonts.googleapis.com' ], 'script-src': [ '\'self\'', 'cdn.httparchive.org', 'www.google-analytics.com', 'use.fontawesome.com', 'cdn.speedcurve.com', 'spdcrv.global.ssl.fastly.net' ], 'font-src': [ '\'self\'', ...
Python
0.002031
@@ -532,32 +532,59 @@ tparchive.org',%0A +%09%09'avatars.discourse.org',%0A %09%09'www.google-an @@ -654,8 +654,9 @@ et'%0A%09%5D%0A%7D +%0A
fa954f6db40cf59779dcdb2303f6afc1b18388f0
Remove debugging prints and increase float precision.
csv.py
csv.py
#!/usr/bin/python #This script will slurp in a trace file and output a CSV formatted #file with the timestamp as the first column and subsequent vehicle #data keys as separate columns in undefined order. #TODO: This implementation is dead simple -- it will read through the #tracefile once to identify all unique keys ...
Python
0
@@ -1266,16 +1266,17 @@ y%5D%0A%0A +# print %22C @@ -1375,20 +1375,25 @@ tring = -str( +%22%25.3f%22 %25 timestam @@ -1393,17 +1393,16 @@ imestamp -) + %22,%22%0A @@ -2030,16 +2030,17 @@ n += 1%0A%0A +# print co
76c30e257119cda7a0372c40b9543ed825675626
Replace print statement by function, fix string literal to unicode
d2h.py
d2h.py
# -*- coding: utf-8 -*- import argparse import datetime import os import smtplib import time import urllib import urllib2 from xml.etree import ElementTree from email.mime.text import MIMEText try: from ConfigParser import SafeConfigParser except ImportError: from configparser import SafeConfigParser DELICIOUS...
Python
0.998662
@@ -1130,16 +1130,17 @@ print( +u 'Fetch %25 @@ -1510,17 +1510,18 @@ print - +(u 'Append @@ -1561,16 +1561,17 @@ osts%5B-1%5D +) %0A ret @@ -2038,32 +2038,33 @@ )%0A print( +u 'SMTP connected: @@ -2149,24 +2149,25 @@ print( +u 'SMTP connec @@ -2671,17 +2671,17 @@ print - +( u'Sent...
5000dc1045d2771b85528b60991e9ac2aad7d69d
fix bug to merge dict
sync_settings/libs/exceptions.py
sync_settings/libs/exceptions.py
# -*- coding: utf-8 -*- import json import sys import traceback class GistException(Exception): def to_json(self): json_error = json.loads(json.dumps(self.args[0])) trace = traceback.extract_tb(sys.exc_info()[2])[-1] return json_error.update({ 'filename': str(trace[0]), 'line': str(trace[1]...
Python
0
@@ -238,25 +238,12 @@ urn -json_error.update +dict (%7B%0A @@ -307,10 +307,24 @@ %5D)%0A %7D +, **json_error )%0A
26f6d383fba8f515a129df640724efe895e872a5
Fix missing comma
synthtool/gcp/gapic_generator.py
synthtool/gcp/gapic_generator.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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Python
0.999999
@@ -4073,32 +4073,33 @@ ARTMAN_VERSION%7D' +, %0A '--
732cd1fd8447e8e6ca7581f30df759351f7480f2
allow running server on windows for testing
ext.py
ext.py
# standard python imports import json import os import subprocess import datetime # external imports from flask import request, abort, current_app from flask_login import current_user, login_user from sqlalchemy.orm.exc import NoResultFound # internal imports from main.app import app from main.users.models import U...
Python
0
@@ -1436,24 +1436,284 @@ erver%0A #%0A + flow_dir = os.path.dirname(os.path.realpath(__file__))%0A if app.config.get('FLOW_WINDOWS', False): # allow testing on Windows, where commands below don't work by default%0A rhizo_server_version = 'X'%0A flow_server_version = 'X'%0A else:%0A ...
898128d2723ebcc40ff0fd6ba00351058216477b
Remove test_legacy_model_properties.
tardis/tests/test_tardis_full.py
tardis/tests/test_tardis_full.py
import pytest import numpy as np import tardis import numpy.testing as nptesting from astropy import units as u import os from tardis.io.util import yaml_load_config_file from tardis.simulation.base import Simulation from tardis.model import Radial1DModel from tardis.io.config_reader import Configuration from tardis....
Python
0
@@ -357,69 +357,8 @@ ner%0A -from tardis.plasma.standard_plasmas import LegacyPlasmaArray%0A %0A%0A%0Ad @@ -3668,1513 +3668,4 @@ )))%0A -%0A%0A def test_legacy_model_properties(self):%0A %22%22%22Tests whether a number of model attributes exist and also verifies%0A their types%0A%0A Currently...
94c30a0efe0c3597678c64f46735ca7cd9990ccd
Revert Settings.py, only added admin schema
templatesAndSettings/settings.py
templatesAndSettings/settings.py
""" Keep this file untracked """ # SECURITY WARNING: keep the secret key used in production secret! secret_key = 'random_secret_key_like_so_7472873649836' media_root = '/Users/lsetiawan/Desktop/shared_ubuntu/APL/ODM2/ODM2-Admin/ODM2CZOData/upfiles/' media_url = '/odm2testapp/upfiles/' # Application definition custom...
Python
0
@@ -161,32 +161,34 @@ dia_root = ' +C: /Users/l setiawan/Des @@ -179,54 +179,38 @@ rs/l -setiawan/Desktop/shared_ubuntu/APL/ODM2/ODM2-A +eonmi/Google Drive/ODM2Djangoa dmin @@ -410,76 +410,8 @@ t = -'/Users/lsetiawan/Desktop/shared_ubuntu/APL/ODM2/ODM2-Admin/static'# 'C:/ @@ -665,20 +665,17 @@ NAME': ' -odm2 +...
59367ba641fd33a78da38a42389d73d9f250dc36
Remove duplicate import in compat.py
tensorflow/python/util/compat.py
tensorflow/python/util/compat.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Python
0
@@ -1331,63 +1331,8 @@ ort%0A -from tensorflow.python.util.tf_export import tf_export%0A %0A%0Ade
6ad81047a282f0e67ceebe9e25d7f0201e636a84
Fix icu dependency checksum.
tensorflow_serving/workspace.bzl
tensorflow_serving/workspace.bzl
# TensorFlow Serving external dependencies that can be loaded in WORKSPACE # files. load("@org_tensorflow//third_party:repo.bzl", "tf_http_archive") load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def tf_serving_workspace(): ""...
Python
0.99917
@@ -1850,72 +1850,72 @@ = %22 -dfc62618aa4bd3ca14a3df548cd65fe393155edd213e49c39f3a30ccd618fc27 +10cd92f1585c537d937ecbb587f6c3b36a5275c87feabe05d777a828677ec32f %22,%0A
5245e51aad4f7693f46b0621f2611c8a03c9ccb1
Change variable names for readability
gui.py
gui.py
#! python3 # -*- coding: utf-8 -*- import sys from main import supported_comics, verify_xpath from comic import Comic from PyQt5.QtWidgets import (QWidget, QLabel, QComboBox, QApplication, QPushButton, QTextEdit, QCheckBox, QLineEdi...
Python
0.000002
@@ -379,23 +379,19 @@ %0A%0Aclass -Example +GUI (QWidget @@ -2284,27 +2284,31 @@ ct(self. -onActivated +change_url_text )%0A%0A @@ -2417,19 +2417,23 @@ def -onActivated +change_url_text (sel @@ -3914,18 +3914,19 @@ %22%22%22%0A -ex +gui .dialog_ @@ -3952,14 +3952,8 @@ age) - + %22n%22 )%0A @@ -40...
2536526a383d1b2a921277970584ef5d3ba6073d
revert LIF base model
lif.py
lif.py
from numpy import * from pylab import * ## setup parameters and state variables T = 1000 # total time to simulate (msec) dt = 0.125 # simulation time step (msec) time = arange(0, T+dt, dt) # time array t_rest = 0 # initial refractory time ## LIF properti...
Python
0
@@ -84,18 +84,17 @@ = -10 +2 00 @@ -687,16 +687,23 @@ lta (V)%0A +I = 1.5 %0A## Inpu @@ -848,43 +848,8 @@ st:%0A - I = (math.sin(t / 50) + 1)%0A
e4e532027763b4e59ac94c5b78799632dafa3018
fix div
nju.py
nju.py
import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) class Gfx(object): def __init__(self, width, height): self.width = width self.height = height self.pins = { 'A0': 17, 'E1': 22, 'E2': 21, 'D0': 23, 'D1': 24, '...
Python
0.000017
@@ -1937,15 +1937,16 @@ dth/ +/ 2), 1)%0A - %0A @@ -2041,16 +2041,17 @@ xy(x, y/ +/ 8)%0A @@ -2208,16 +2208,17 @@ .height/ +/ 8):%0A @@ -2458,16 +2458,18 @@ fill(0)%0A +# g.fill(2
ff7365e780624a1ef66c12a6d7b61448a3f9294c
fix flake8 warnings in zapwallettxes.py
test/functional/zapwallettxes.py
test/functional/zapwallettxes.py
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the zapwallettxes functionality. - start three bitcoind nodes - create four transactions on node ...
Python
0
@@ -710,10 +710,260 @@ ort -*%0A +(assert_equal,%0A assert_raises,%0A bitcoind_processes,%0A connect_nodes_bi,%0A JSONRPCException,%0A ) %0A%0Acl @@ -1223,18...
bf2683749f7748447a679685a85068c5fb9aa7a5
add work around for assert_called_once
test/parser/testlogfileparser.py
test/parser/testlogfileparser.py
# -*- coding: utf-8 -*- # # Copyright (c) 2019, the cclib development team # # This file is part of cclib (http://cclib.github.io) and is distributed under # the terms of the BSD 3-Clause License. """Unit tests for the logfileparser module.""" import io import os import sys import tempfile import unittest from six i...
Python
0.000001
@@ -4148,16 +4148,33 @@ parse()%0A + try:%0A @@ -4214,16 +4214,265 @@ _once()%0A + except AttributeError: # assert_called_once is not availible until python 3.6%0A self.assertEqual(parser.logger.error.call_count, 1, %22Expected mock to have been called once. Called %7B%7D times....
74799081cd800cecd10e3b2248cf39c37ff42818
Move credentials so we can use them throughout the application
run.py
run.py
import json import os from google.cloud import pubsub import google.auth from micromanager import MicroManager from micromanager.resources import Resource from stackdriver import StackdriverParser # Load configuration project_id = os.environ.get('PROJECT_ID') subscription_name = os.environ.get('SUBSCRIPTION_NAME') ...
Python
0
@@ -415,16 +415,205 @@ 'true'%0A%0A +# We're using the application default credentials, but defining them%0A# explicitly so its easy to plug-in credentials using your own preferred%0A# method%0Aapp_creds, _ = google.auth.default()%0A%0A # Instan @@ -1871,16 +1871,39 @@ set_info +, credentials=app_creds )%0A%0A ...
3228b640d74dd1b06e9d96fb8265cc8c952074f6
solve Flatten layer issue
run.py
run.py
from keras.models import Model from keras.layers import (Activation, Dropout, AveragePooling2D, Input, Flatten, MaxPooling2D, Convolution2D) from firemodule import FireModule from keras.datasets import cifar10, mnist from keras.optimizers import SGD from keras.utils import np_utils import nump...
Python
0.000002
@@ -23,17 +23,29 @@ rt Model +, Sequential %0A - from ker @@ -629,18 +629,16 @@ test)%0A%0A%0A -%0A%0A inputs = @@ -1270,14 +1270,12 @@ 2D(( -10, 10 +2, 2 ))(l @@ -1339,25 +1339,24 @@ ax%22)(layer)%0A -%0A model = Mode @@ -1408,64 +1408,130 @@ ile( -x_train, y_train, optimizer = SGD(0.01, momentum = 0.85) +lo...
454740f2657efa88efa16abdba93dc427bcf4d70
Add try catch to capture all the exceptions that might generate anywhere todo: need to capture exceptions in specific places and raise them to log from the main catch
run.py
run.py
from PdfProcessor import * import argparse from datetime import datetime import ConfigParser import ProcessLogger parser = argparse.ArgumentParser(description='Processes the pdf and extracts the text') parser.add_argument('-i','--infile', help='File path of the input pdf file.', required=True) parser.add_argument('-o'...
Python
0.000002
@@ -106,16 +106,33 @@ ssLogger +%0Aimport traceback %0A%0Aparser @@ -427,24 +427,33 @@ rse_args()%0A%0A +try:%0A logger = Pro @@ -480,16 +480,20 @@ ('run')%0A + logger.i @@ -546,16 +546,20 @@ now()))%0A + logger.i @@ -591,16 +591,20 @@ infile)%0A + logger.i @@ -641,16 +641,20 @@ ir) %0A%0A%0...
ec09e3b35d431232feb0df1577b3fe6578b68704
Remove old SSL code from run.py
run.py
run.py
import logging import os import sys import ssl import json import uvloop import asyncio from aiohttp import web from setproctitle import setproctitle from virtool.app import create_app from virtool.app_init import get_args, configure sys.dont_write_bytecode = True logger = logging.getLogger("aiohttp.server") setpro...
Python
0.000002
@@ -33,19 +33,8 @@ sys%0A -import ssl%0A impo @@ -41,16 +41,16 @@ rt json%0A + import u @@ -744,364 +744,8 @@ _%22:%0A - ssl_context = None%0A%0A if settings_temp.get(%22use_ssl%22, False):%0A cert_path = settings_temp.get(%22cert_path%22, None)%0A key_path = settings_temp.get(%22key_path%22, N...
c15de13fa8dae840349463f6853f3edd3784ba6d
Update connect_db.py
connect_db.py
connect_db.py
from couchdb import Server # server = Server() # connects to the local_server # >>> remote_server = Server('http://example.com:5984/') # >>> secure_remote_server = Server('https://username:password@example.com:5984/') class db_server(object): def __init__(self,username,login): self.secure_server=Serve...
Python
0
@@ -1,8 +1,25 @@ +#!/usr/bin/python %0Afrom co
68510d03ba9d2a2dc5b2a471a92b5976306ffc39
Fix variable name
VMEncryption/main/oscrypto/OSEncryptionState.py
VMEncryption/main/oscrypto/OSEncryptionState.py
#!/usr/bin/env python # # VM Backup extension # # Copyright 2015 Microsoft Corporation # # 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.99981
@@ -5036,16 +5036,23 @@ +/%5Cs+', +content s)%0A
dc53ec2c73b5ec18fe77ed7fdb12a1e50664952b
clean imports
courriers/views.py
courriers/views.py
# -*- coding: utf-8 -*- from django.views.generic import ListView, DetailView, FormView, TemplateView from django.core.urlresolvers import reverse from django.db.models import Q from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404 from django.utils.functional import cached_propert...
Python
0.000001
@@ -144,39 +144,8 @@ rse%0A -from django.db.models import Q%0A from
c1f11cbd217391dd51566e0b2a8377c5c13772f6
Remove unused imports
courriers/views.py
courriers/views.py
# -*- coding: utf-8 -*- from django.views.generic import View, ListView, DetailView, FormView, TemplateView from django.views.generic.edit import FormMixin from django.views.generic.detail import SingleObjectMixin from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect from django.shor...
Python
0.000001
@@ -53,14 +53,8 @@ port - View, Lis @@ -341,28 +341,8 @@ _404 -, render_to_response %0Afro
73f335371db10008a2d221b777350f0b584abde6
use new TimingGenerator
nexys_video.py
nexys_video.py
#!/usr/bin/env python3 from nexys_base import * from litevideo.output.hdmi.s7 import S7HDMIOutClocking from litevideo.output.hdmi.s7 import S7HDMIOutPHY from litevideo.output.core import TimingGenerator class VideoOutSoC(BaseSoC): def __init__(self, platform, *args, **kwargs): BaseSoC.__init__(self, p...
Python
0
@@ -98,17 +98,16 @@ locking%0A -%0A from lit @@ -148,17 +148,16 @@ IOutPHY%0A -%0A from lit @@ -507,17 +507,16 @@ nerator( -1 ))%0A @@ -554,22 +554,20 @@ elf.vtg. -timing +sink .valid.e @@ -594,22 +594,20 @@ elf.vtg. -timing +sink .hres.eq @@ -631,30 +631,28 @@ self.vtg. -timing +sink .hsync_start @...
3e7d2c771d6335411eb602240914b5cd3e15c227
Maintain only one list instead of two
crawler/crawler.py
crawler/crawler.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import re import requests from lxml import html import redis redis_server = redis.StrictRedis(host='localhost', port=6379) def extract_num(raw): """Extract num from the unicode string.""" matched = re.search(r'\d+', raw).group() return matched def update_...
Python
0.00033
@@ -40,16 +40,74 @@ -8 -*-%0A%0A +from __future__ import absolute_import, unicode_literals%0A%0A import r @@ -1553,24 +1553,22 @@ ver. -r +l push(' -song +top list -s ', k @@ -2042,25 +2042,23 @@ r.sort(' -song +top list -s ', start @@ -2069,9 +2069,9 @@ num= -4 +3 00, @@ -2323,90 +2323,8 @@ in -set.diff...
3c31ce72856a651d5365c6dc3949f9ffe482cba9
removing a __name__ == '__main__' bit
crawler/threads.py
crawler/threads.py
# -*- coding: utf-8 -*- from threading import Thread, Event from Queue import Empty, Queue import lxml.html as parser from .functions import fetch_element_att, fetch_element_text, \ fetch_links, fetch_url, parse_content, parse_headers from .events import NewUrlEvent, NewURLDataEvent, NewNoteEvent, send_event from...
Python
0.999027
@@ -6670,238 +6670,8 @@ t))) -%0A%0Aif __name__ == '__main__':%0A urls = %5B'http://www.classicalguitar.org/about', 'http://www.classicalguitar.org'%5D%0A d = Dispatcher(base='http://www.classicalguitar.org/')%0A d.signal_queue.put(('add_urls', urls))%0A d.start() %0A
a2f7b49c992eec2aa2d37b65c9e601850d3ba208
fix twitter/mastodon interface (really)
retweetbot.py
retweetbot.py
#!/usr/bin/env python import twitter import requests import pytoml as toml import trigger from time import sleep import traceback class RetweetBot(object): """ This bot retweets all tweets which 1) mention him, 2) contain at least one of the triggerwords provided. api: The api object, generated ...
Python
0
@@ -4325,18 +4325,20 @@ return -() +None %0A @@ -5473,24 +5473,15 @@ -mastodon.append( +toot = self @@ -5496,16 +5496,82 @@ (status) +%0A if toot:%0A mastodon.append(toot )%0A%0A
cb8d69635d1cc40ed3748589142433208b089c4e
Update test/runner.py to allow test run by names (#930)
rest-api/test/runner.py
rest-api/test/runner.py
#!/usr/bin/env python2 # Copyright 2015 Google Inc # # 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
@@ -1655,19 +1655,36 @@ _pattern +, test_names=None ):%0A - # If t @@ -2492,16 +2492,115 @@ tests.%0A + if test_names:%0A suite = unittest.loader.TestLoader().loadTestsFromNames(test_names)%0A else:%0A suite @@ -2664,16 +2664,16 @@ attern)%0A - return @@ -3505,16 +3505,185 @@ ort'%0A ) +%0A par...