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 |
|---|---|---|---|---|---|---|---|
e4eb1925bff31a2e64d0ce6a55a6da97d2d60b9b | Add participants to button | python/games/button.py | python/games/button.py | import functools
import threading
import websocket
import graphics
import requests
import driver
import game
import json
import sys
import re
def on_message(game, ws, message):
a = json.loads(message)
game.reset_time(a["payload"]["seconds_left"])
class Button(game.Game):
def __init__(self, *args, **kwargs... | Python | 0 | @@ -248,16 +248,79 @@
_left%22%5D)
+%0A game.reset_participants(a%5B%22payload%22%5D%5B%22participants_text%22%5D)
%0A%0Aclass
@@ -637,32 +637,126 @@
th=5, height=7)%0A
+ self.text_participants = graphics.TextSprite(%22???,???%22, x=16, y=8, width=5, height=7)%0A
self.tim
@@ -949,73 +949,30 @@
a... |
8c489cb6a09d740129bf73c710a7541844abe936 | Add docstring clarity | motobot/core_plugins/privmsg_handlers.py | motobot/core_plugins/privmsg_handlers.py | from motobot import IRCBot, hook, Priority, Context, strip_control_codes
from motobot.modifiers import Modifier, CommandModifier, ParamsModifier, TrailingModifier, EatType
@hook('PRIVMSG')
def handle_privmsg(bot, context, message):
""" Handle the privmsg commands.
Will send messages to each plugin accounting... | Python | 0.000005 | @@ -337,16 +337,107 @@
d level.
+%0A Will then parse the responses from each plugin, if any, and send them%0A via the bot.
%0A%0A %22%22
|
02d6f690552586c002da55c8cec8124e9ec1855c | enable high dpi | IPython/terminal/pt_inputhooks/qt.py | IPython/terminal/pt_inputhooks/qt.py | import sys
import os
from IPython.external.qt_for_kernel import QtCore, QtGui
# If we create a QApplication, keep a reference to it so that it doesn't get
# garbage collected.
_appref = None
_already_warned = False
def inputhook(context):
global _appref
app = QtCore.QCoreApplication.instance()
if not app... | Python | 0.000001 | @@ -912,16 +912,96 @@
return%0A
+ QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)%0A
|
fc1f643608165b13078993b9fcbf4bab3b8e459d | Change text styles (seems like an improvement to me) | coloredlogs.py | coloredlogs.py | #!/usr/bin/env python
"""
Colored terminal output for Python's logging module.
Author: Peter Odding <peter@peterodding.com>
Last Change: May 16, 2013
URL: https://pypi.python.org/pypi/coloredlogs
The ColoredStreamHandler class enables colored terminal output for a logger
created with Python's logging module. The log... | Python | 0 | @@ -140,10 +140,10 @@
May
-16
+30
, 20
@@ -2889,31 +2889,10 @@
ity
-in ('WARNING', 'ERROR',
+==
'CR
@@ -2898,17 +2898,16 @@
RITICAL'
-)
:%0A
@@ -2959,17 +2959,35 @@
e, bold=
-(
+True)%0A elif
severity
@@ -2991,33 +2991,165 @@
ity
-in (
+==
'ERROR'
-, 'CRITICAL'))
+:%0A message = ... |
05787a96c5dda27de42277902a710365826ab9fb | add new step to preparation method | cis/publisher.py | cis/publisher.py | """First class object for publishing messages to Mozilla Change Integration Service."""
import base64
import json
import logging
from cis.libs import api
from cis.libs import connection
from cis.libs import encryption
from cis.libs import utils
from cis.libs import validation
from cis.settings import get_config
uti... | Python | 0 | @@ -3343,24 +3343,140 @@
profile.')%0A%0A
+ # Reintegrate groups this publisher is not authoritative for.%0A self._reintegrate_profile_with_api()%0A%0A
# Dy
@@ -4761,16 +4761,21 @@
file = p
+erson
.get_use
|
9f68a4c514c7fe7616ed44de8b00082069d7b385 | Update cores.py | cores/cores.py | cores/cores.py | #!/usr/bin/env python2
# C.O.R.E.S
# Cross-Origin Resource Exploitation Server
try:
import sys
import os
import time
import argparse
from argparse import RawTextHelpFormatter
# IP Query
import json, urllib, socket
# Simple HTTP Server
import SocketServer, SimpleHTTPServer, multiprocessing
# Custom theme
from... | Python | 0.000001 | @@ -5753,16 +5753,17 @@
get URL:
+
'+ args
|
3e0ac9f0c7b42a8f608b65ac810e469e42be79ee | Add failure cases to integration group tests | integration/group.py | integration/group.py | from spec import Spec, eq_
from fabric import ThreadingGroup as Group
class Group_(Spec):
def simple_command(self):
group = Group('localhost', '127.0.0.1')
result = group.run('echo foo', hide=True)
eq_(
[x.stdout.strip() for x in result.values()],
['foo', 'foo'],
... | Python | 0.000001 | @@ -1,12 +1,41 @@
+from socket import gaierror%0A%0A
from spec im
@@ -48,16 +48,21 @@
pec, eq_
+, ok_
%0A%0Afrom f
@@ -98,16 +98,61 @@
s Group%0A
+from fabric.exceptions import GroupException%0A
%0A%0Aclass
@@ -401,8 +401,909 @@
)%0A
+%0A def failed_command(self):%0A group = Group('localhost', '1... |
9cf8051adddc5c79737151f828d5de5744466607 | fix imports for visualize | sandpiles/visualize.py | sandpiles/visualize.py | from collections import defaultdict
import random
import matplotlib.pyplot as plt
import numpy as np
pile = defaultdict(dict)
def sandpile(size="3x3", sand_min=3, sand_max=3, initial_min=10, initial_max=10):
"""
size --> the dimensions of the grid. Can be rectangles
sand_min --> the minimum capacity of ... | Python | 0.000001 | @@ -1,8 +1,44 @@
+import random%0Aimport glob%0Aimport os%0A
from col
@@ -68,22 +68,8 @@
dict
-%0Aimport random
%0A%0Aim
@@ -116,16 +116,31 @@
py as np
+%0Aimport imageio
%0A%0Apile =
|
6f7e89d2981b88e27e6cf9b09d25b7f118d0980e | Include fix | python/ukf/__init__.py | python/ukf/__init__.py | import os
from ctypes import *
class IOBoardParams(Structure):
_fields_ = [
("accel_orientation", c_double * 4),
("accel_offset", c_double * 3),
("gyro_orientation", c_double * 4),
("mag_orientation", c_double * 4),
("mag_field", c_double * 3),
]
class State(Structure):... | Python | 0 | @@ -1280,17 +1280,16 @@
dylib%22))
-)
%0A%0Acukf.s
|
9a4c15effd96aa6ac523c27ee6853ba59be2592e | add comment | quadpy/line_segment/_helpers.py | quadpy/line_segment/_helpers.py | import numpy
from ..helpers import plot_disks_1d
def _find_shapes(fx, intervals, x, domain_shape=None, range_shape=None):
# This following logic is based on the below assertions
#
# assert intervals.shape == (2,) + domain_shape + interval_set_shape
# assert fx_gk.shape == range_shape + interval_set_s... | Python | 0 | @@ -3241,32 +3241,190 @@
args, **kwargs)%0A
+ # mpl keeps a hidden background patch that renders bbox_inches ineffective.%0A # keep an eye out for https://stackoverflow.com/q/61712551/353337%0A
plt.save
|
a93691e274ecba4ee7ccb9cdde74c3220265deff | fix celery task argument passing | invenio_stats/cli.py | invenio_stats/cli.py | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2018 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.
"""Aggregation classes."""
from __future__ import absolute_import, print_function
from f... | Python | 0.00013 | @@ -2222,16 +2222,21 @@
ypes or
+list(
current_
@@ -2260,16 +2260,17 @@
s.keys()
+)
%0A if
@@ -3136,32 +3136,37 @@
+list(
current_stats.st
@@ -3181,32 +3181,33 @@
egations.keys())
+)
%0A if eager:%0A
@@ -4303,32 +4303,37 @@
+list(
current_stats.st
@@ -4348,32 +4348,3... |
f7239feb9bef69c1f1cd07ceb066c82bf76fb67e | Abort build if package does not exist | client/cli/publish.py | client/cli/publish.py | """This module is responsible for publishing OK."""
import argparse
import client
import os
import shutil
import sys
import zipfile
OK_ROOT = os.path.normpath(os.path.dirname(client.__file__))
CONFIG_NAME = 'config.ok'
EXTRA_PACKAGES = ['sanction', 'requests']
def abort(message):
print(message + ' Aborting', fil... | Python | 0.000001 | @@ -834,24 +834,126 @@
ve.%0A %22%22%22%0A
+ if not os.path.exists(src_directory):%0A abort('Tree ' + src_directory + ' does not exist.')%0A
for root
|
ac8ddf5dc07134e2001248d18030bc3c153f6305 | Encode query parameters | froide_campaign/views.py | froide_campaign/views.py | from django.shortcuts import render, get_object_or_404
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.utils.translation import ugettext_lazy as _
from django.http import QueryDict
from django.db.models import Q
from django import forms
import django_filters
from froide.helper.cac... | Python | 0.999064 | @@ -2699,16 +2699,32 @@
encode()
+.encode('utf-8')
, mutabl
|
90b8e653596a77bde867cd2114a24c64b32acd8b | Add attribute constant entry for closed player slots. | sc2reader/constants.py | sc2reader/constants.py | # -*- coding: utf-8 -*-
# These are found in Repack-MPQ/fileset.{locale}#Mods#Core.SC2Mod#{locale}.SC2Data/LocalizedData/Editor/EditorCategoryStrings.txt
# EDSTR_CATEGORY_Race
# EDSTR_PLAYERPROPS_RACE
# The ??? means that I don't know what language it is.
# If multiple languages use the same set they should be comma s... | Python | 0 | @@ -2251,16 +2251,38 @@
'Open',%0A
+ 'dslC': 'Closed',%0A
%7D%0AGATEWA
|
13ef70a9b7f2274e8f84501933ab96178a5aa35d | Fix events.quitting not fired on normal exit (#7) | invokust/loadtest.py | invokust/loadtest.py | # -*- coding: utf-8 -*-
import sys
import gevent
import json
import signal
import logging
import time
from locust import runners, events
logger = logging.getLogger(__name__)
class TimeOutException(Exception): pass
class LocustLoadTest(object):
'''
Runs a Locust load test and returns statistics
'''
... | Python | 0.000001 | @@ -3912,43 +3912,8 @@
on:%0A
- events.quitting.fire()%0A
@@ -4078,43 +4078,8 @@
e:%0A
- events.quitting.fire()%0A
@@ -4135,12 +4135,65 @@
t(repr(e)))%0A
+%0A finally:%0A events.quitting.fire()%0A
|
8d34d33286d954a94ab4b3fd7fe5350c5a724c48 | rename yield_execution to coroutine | test/async_lock.py | test/async_lock.py | import kaa
@kaa.yield_execution(synchronize = True)
def f(x):
print 'in', x
yield kaa.YieldContinue
print 'work1', x
yield kaa.YieldContinue
print 'work2', x
yield kaa.YieldContinue
print 'out', x
f(1)
f(2)
f(3)
kaa.main.run()
| Python | 0.000034 | @@ -14,23 +14,17 @@
kaa.
-yield_exec
+coro
uti
-o
n
+e
(syn
|
41a598852efe48efa1973cca00f419cc84795f0b | Fix pep8 in system tests | fuelweb_test/settings.py | fuelweb_test/settings.py | # Copyright 2013 Mirantis, 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 or ... | Python | 0.000001 | @@ -909,16 +909,21 @@
ron.get(
+%0A
'OPENSTA
|
0cf49cbc329eabee5a51525cca65322f51f8bfaf | send datetime object to the influxdb sdk | iotrelay_influxdb.py | iotrelay_influxdb.py | '''
Copyright (c) 2016, Emmanuel Levijarvi
All rights reserved.
License BSD
'''
import logging
import calendar
from collections import defaultdict
import influxdb
logger = logging.getLogger(__name__)
__version__ = "1.5.0"
DEFAULT_BATCH_SIZE = 30
HOST = 'localhost'
USERNAME = 'root'
PASSWORD = 'root'
DATABASE = 'iotrel... | Python | 0 | @@ -92,24 +92,8 @@
ing%0A
-import calendar%0A
from
@@ -178,16 +178,17 @@
name__)%0A
+%0A
__versio
@@ -201,16 +201,17 @@
%221.5.0%22%0A
+%0A
DEFAULT_
@@ -1103,75 +1103,8 @@
e)%5D%0A
- timestamp = calendar.timegm(reading.timestamp.timetuple())%0A
@@ -1159,16 +1159,24 @@
'time':
+reading.
timestam
|
9cbbf70279ad71cf89cb4aec14d2161f32c786ca | Update collection.py | fx_collect/collection.py | fx_collect/collection.py | from instrument import Instrument
from datetime import datetime, timedelta
from broker import FXCMBrokerHandler
from database import DatabaseHandler
import time
import sys
class CollectionHandler(object):
def __init__(self, broker, instrument):
self.br_handler = FXCMBrokerHandler()
self.db_handle... | Python | 0 | @@ -2551,16 +2551,19 @@
+if
i.market
@@ -2575,61 +2575,22 @@
us =
+=
'O
-pen'%0A if i.market_status == '
+': #
Open
-':
%0A
|
08e60c3226832895f7b3427c3f8734a61fbd6be7 | Fix color command | cogs/colors.py | cogs/colors.py | import json
import os
import discord
from colormath.color_conversions import convert_color
from colormath.color_objects import LabColor, sRGBColor
from colormath.color_diff import delta_e_cie2000
from colour import Color as Colour
from bot.bot import command
from cogs.cog import Cog
from utils.utilities import split_... | Python | 0.000033 | @@ -4175,19 +4175,24 @@
.append(
+str(
id)
+)
%0A
|
ba355cd70f43bfbec33d807248dfb3be73d6a3bc | change formatting | cogs/server.py | cogs/server.py | from bot.bot import command
from cogs.cog import Cog
from discord.ext.commands import cooldown
class Server(Cog):
def __init__(self, bot):
super().__init__(bot)
@command(no_pm=True, pass_context=True)
@cooldown(1, 20)
async def top(self, ctx):
server = ctx.message.server
sort... | Python | 0.000004 | @@ -528,11 +528,11 @@
+= '
-#
%7B%7D
+.
%7B%7D
@@ -579,16 +579,20 @@
u.roles)
+ - 1
)%0A%0A
|
409555e83993c6704f415fb4bf186aa2d1ea75c6 | Change inline fields | cogs/stonks.py | cogs/stonks.py | import discord
import json
import io
import re
import matplotlib.pyplot as plt
from bs4 import BeautifulSoup
from dateutil.parser import parse as parse_date
from dateutil.rrule import rrule, DAILY
from datetime import datetime, timedelta
from discord.ext import commands
from discord.utils import escape_markdown
from u... | Python | 0.000001 | @@ -1745,22 +1745,8 @@
2f%7D%22
-, inline=False
)%0A
@@ -1956,16 +1956,30 @@
hange)%7D%22
+, inline=False
)%0A
|
7df119ec9b47e5181600e58311e4733fc0bb988a | add single quotes to myriaL | raco/myrial/scanner.py | raco/myrial/scanner.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import ply.lex as lex
import raco.myrial.exceptions
keywords = ['WHILE', 'DO', 'DEF', 'APPLY', 'CASE', 'WHEN', 'THEN',
'ELSE', 'END', 'CONST', 'LOAD', 'DUMP', 'UDA', 'TRUE', 'FALSE']
types = ['INT', 'STRING', 'FLOAT', 'BOOLEAN']
comprehension_keywords = ['SELEC... | Python | 0 | @@ -2103,16 +2103,37 @@
%5D%7C%5C%5C.)*%22
+%7C%5C'(%5B%5E%5C%5C%5Cn%5C'%5D%7C%5C%5C.)*%5C'
'%0A t.
|
c05db601fd5b7f1afb96c00a6347221ef3abb366 | version bump | pk/core/version.py | pk/core/version.py | __version__ = '0.12.0'
| Python | 0.000001 | @@ -13,11 +13,11 @@
= '0.12.
-0
+1
'%0A
|
945cd889c6120d15e71764427217788a978d65ef | Fix env | buildbot_travis/steps/runner.py | buildbot_travis/steps/runner.py | from twisted.internet import defer
from buildbot.process import buildstep
from buildbot.process.buildstep import SUCCESS, FAILURE
from .base import ConfigurableStep
class TravisRunner(ConfigurableStep):
haltOnFailure = True
flunkOnFailure = True
progressMetrics = ConfigurableStep.progressMetrics + ('com... | Python | 0.000127 | @@ -1574,24 +1574,128 @@
'env'%5D = %7B%7D%0A
+ if self.build.slaveEnvironment:%0A cmd.args%5B'env'%5D.update(self.build.slaveEnvironment)%0A
cmd.
|
e383c1702ccd6271d855c0c963785728a23e3d06 | Add regex for hexColor (rgb and rgba) | commonregex.py | commonregex.py | import re
class CommonRegex:
def __init__(self, text=""):
self.text = text
if text:
self.dates = self.dates()
self.times = self.times()
self.phones = self.phones()
self.links = self.links()
self.emails = self.emails()
... | Python | 0.000001 | @@ -386,16 +386,60 @@
.money()
+%0A self.hexColor = self.hexColor()
%0A%0A de
@@ -2952,16 +2952,223 @@
text)%0A%0A
+ @_strip%0A def hexColor(self, text=None):%0A text = text or self.text%0A hexColor_regex = u'(#(?:%5B0-9a-fA-F%5D%7B8%7D)%7C#(?:%5B0-9a-fA-F%5D%7B3%7D)%7B1,2%7D)%5C%5... |
17d095914b095ccc370922aa9b42aed7d6b473f9 | add player `__repr__` | src/pawn/player.py | src/pawn/player.py | class Player(object):
def __init__(self, name='John Doe'):
self.name = name
| Python | 0 | @@ -81,8 +81,95 @@
= name%0A
+%0A def __repr__(self):%0A return 'Player(name=%7Bname!r%7D)'.format(name=self.name)%0A
|
fffc5c201bb84c4c545528e7e674a17119885b0d | clean up | EvalPrinter.py | EvalPrinter.py | import sublime, sublime_plugin
import subprocess
import os
class EvalPrintCommand(sublime_plugin.TextCommand):
def run(self, edit, entireFile=False):
view = self.view
if entireFile:
contentRegion = sublime.Region(0, self.view.size())
codeStr = self.view.substr(contentRegion)
else:
code... | Python | 0.000001 | @@ -1950,36 +1950,8 @@
r)%0D%0A
-%09%09%09print(%22output%22, output)%0D%0A
%09%09el
@@ -3274,43 +3274,8 @@
%0D%0A%0D%0A
-%09%09print(%22resultStr%22, resultStr)%0D%0A%0D%0A
%09%09if
@@ -5333,19 +5333,20 @@
%0D%0A%0D%0A%09%09re
-s =
+turn
a + %22%5C
@@ -5375,36 +5375,4 @@
+ b
-%0D%0A%0D%0A%09%09print(res)%0D%... |
1d31b2ef4323abc45e0b0b01a1196a3ba1b85ca7 | fix transform bug | gbmgeometry/gbm_frame.py | gbmgeometry/gbm_frame.py | import astropy.coordinates as coord
import astropy.units as u
import numpy as np
from astropy.coordinates import BaseCoordinateFrame, Attribute, RepresentationMapping
from astropy.coordinates import frame_transform_graph
class GBMFrame(BaseCoordinateFrame):
"""
Fermi GBM Frame
Parameters
-------... | Python | 0.000001 | @@ -3172,16 +3172,27 @@
tesian%0A%0A
+ %0A%0A %0A
pos
@@ -3361,16 +3361,17 @@
.)%0A%0A
+#
dec = np
@@ -3379,24 +3379,60 @@
arcsin(X2)%0A%0A
+ dec = np.pi/2. - np.arccos(X2)%0A%0A
idx = np
|
1f6ec657db2a2ad51babcbb1d0d71d8845151241 | Allow cluster-status endpoint in maintenance mode (#2013) | rest-service/manager_rest/constants.py | rest-service/manager_rest/constants.py | #########
# Copyright (c) 2019 Cloudify Platform Ltd. 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 requi... | Python | 0 | @@ -2429,16 +2429,87 @@
-status'
+,%0A 'cluster-status'
%5D%0AALLOWE
|
5bc1f7e4fe5da198a37d5fc3b65357885b3b6697 | update update-hosts.py | script/update-hosts.py | script/update-hosts.py | #!/bin/python
from __future__ import print_function
import subprocess
import sys
import os
import json
from util import appendline
if __name__ == "__main__":
path = os.path.dirname(os.path.realpath(__file__))
config = json.load(open(path+'/cluster-config.json'));
for node in config['nodes']:
appendline('/etc/host... | Python | 0.000001 | @@ -373,17 +373,23 @@
ad(open(
-'
+path+'/
zookeepe
|
dfb9384355ebfad21de28719eabb740f511a748b | Move to boto3 | scripts/49-cat-logs.py | scripts/49-cat-logs.py | #!/usr/bin/env python3
# Usage:
# $0 -o log.txt products/
#
# concatenates .log files (even those in subdirs or .zip) and combines into a single combined.log
from xdfile.utils import find_files_with_time, open_output, get_args
from boto.s3.connection import S3Connection
import os
def main():
args = get_args(... | Python | 0.000002 | @@ -225,16 +225,31 @@
et_args%0A
+import boto3%0A#
from bot
@@ -391,261 +391,48 @@
-print(os.environ%5B'AWS_ACCESS_KEY'%5D,os.environ%5B'AWS_SECRET_KEY'%5D)%0A conn = S3Connection(aws_access_key_id=os.environ%5B'AWS_ACCESS_KEY'%5D, aws_secret_access_key=os.environ%5B'AWS_SECRET_KEY'%5D)%0A print(conn)%0A... |
a6062db867288c3e751f90b8652cf6f22cd3ae3b | add actionlib_tutorials for default msg gen | rosruby/scripts/gen_for_precompiled.py | rosruby/scripts/gen_for_precompiled.py | #! /usr/bin/env python
# msg/srv generator for precompiled system
# It is useful if you are using precompiled ROS system,
# because it needs root access and there are ROS_NOBUILD file in the packages.
# This script generates *.rb files in the rosruby dir.
import genmsg_ruby
import gensrv_ruby
from roslib.packages imp... | Python | 0 | @@ -1220,16 +1220,39 @@
torials'
+, 'actionlib_tutorials'
%5D%0A el
|
8dcd64c347a47c55b22997990271468976a2d896 | Update comment | plots/json2loss.py | plots/json2loss.py |
# JSON TO LOSS
# NOTE: Run this with './json2table loss' (shell script wrapper)
# Converts a directory of runs into a simple loss over time table
# The output file format for each line is
# timestamp load
# where the timestamp is floating point Unix hours
# relative to first event
# and the loss is the validation ... | Python | 0 | @@ -641,25 +641,45 @@
undirs))%0A%0A#
-L
+Initially unordered l
ist of event
@@ -680,16 +680,20 @@
events,
+%0A#
each a
@@ -719,16 +719,28 @@
val_loss
+, debug_data
)%0Aevents
|
9ffca3ddc50f6402f3dfb3a300667bc97d84e2e5 | Add missing 'priority' argument for GLib.io_add_watch() | src/pyudev/glib.py | src/pyudev/glib.py | # -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011, 2012, 2013 Sebastian Wiesner <lunaryorn@gmail.com>
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 2.1 of the License, ... | Python | 0 | @@ -2340,20 +2340,91 @@
tor,
- GLib.IO_IN,
+%0A GLib.PRIORITY_DEFAULT,%0A GLib.IO_IN,%0A
sel
@@ -2444,16 +2444,17 @@
ev_event
+,
%0A
|
43c8819fb7f8b79f10f97e1785ce0f3121b38754 | fix changed variable name | readux/dyndzi/views.py | readux/dyndzi/views.py | import logging
from django.http import HttpResponse, HttpResponseBadRequest, Http404
from django.views.decorators.http import condition, last_modified
from deepzoom import DeepZoomImageDescriptor
from eulfedora.server import TypeInferringRepository
from eulfedora.views import datastream_etag
from readux.books.models... | Python | 0.000009 | @@ -846,17 +846,16 @@
_object(
-p
id)%0A
|
37984a616fcd05f159c52d70e658a1268e4f5904 | Update expressions.py | scripts/expressions.py | scripts/expressions.py | # ... integers
1
+1
-1
a + 2
3*a + 1
3*(4+a) + 1
3/(4+a) + 1
# ...
# ... floats
1.
+1.
-1.
a + 2.
3.*a + 1.
3.*(4.+a) + 1.
3./(4.+a) + 1.
# ...
# ... booleans
True
False
not a
a and b
a or b
# ...
# ... relationals
a == b
a != b
a < b
a > b
a <= b
a >= b
# ...
| Python | 0.000001 | @@ -1,18 +1,21 @@
#
-... integers
+coding: utf-8%0A%0A
%0A1%0A+
@@ -61,27 +61,9 @@
+ 1%0A
-#%C2%A0...%0A%0A#%C2%A0... floats
+%0A
%0A1.%0A
@@ -121,29 +121,8 @@
1.%0A
-#%C2%A0...%0A%0A#%C2%A0... booleans
%0ATru
@@ -154,32 +154,8 @@
r b%0A
-#%C2%A0...%0A%0A#%C2%A0... relationals
%0Aa =
@@ -195,10 +195,4 @@
= b... |
492e2ed044d9f2d758c70466977cf568fdc7dc91 | Add __del__ for FqCreator. | rnftools/rnfformat/FqCreator.py | rnftools/rnfformat/FqCreator.py | import snakemake
import smbl
import rnftools
import os
class FqCreator:
"""Class for writing RNF reads to FASTQ files.
Every new read is added to the internal buffer. If read tuple ID is different,
buffer is flushed. Hence, reads from the same tuple must be added in a series.
It does not matter in which order are... | Python | 0.000001 | @@ -1452,24 +1452,71 @@
lf.empty()%0A%0A
+%09def __del__(self):%0A%09%09self.flush_read_tuple()%0A%0A
%09def flush_r
@@ -1583,26 +1583,8 @@
%22%22%22%0A
-%09%09#print(%22flush%22)%0A
%09%09if
@@ -3638,51 +3638,8 @@
e_id
- and self.current_read_tuple_id is not None
:%0A%09%09
|
e725febb4db96be2df6ab12e5c795a12387a4352 | allow plotting for agg | priv/jun_pandas.py | priv/jun_pandas.py | import sys
import scipy as sp
import numpy as np
import matplotlib as mpl
import pandas as pd
import sklearn as skl
import operator as opt
from erlport.erlterms import Atom
mpl.use('Agg')
opers = {'<': opt.lt,
'>': opt.gt,
'<=': opt.le,
'>=': opt.ge,
'==': opt.eq,
'!=': opt.... | Python | 0 | @@ -4227,32 +4227,305 @@
dict(keywords)%0A
+ # IMPORTANT: check if columns has the x and y, otherwise remove to plot%0A x = kwargs.get('x')%0A y = kwargs.get('y')%0A columns = list(df)%0A if x not in columns:%0A del kwargs%5B'x'%5D%0A if y not in columns:%0A ... |
f5e6a4a85c0b23287ce88f659a3fd7d4cc8415bc | add info_columns to get dataframe info for columns in csv format | priv/jun_pandas.py | priv/jun_pandas.py | import sys
import scipy as sp
import numpy as np
import matplotlib as mpl
import pandas as pd
import sklearn as skl
from erlport.erlterms import Atom
# simple return sys version
def version():
return sys.version
# descriptive stats over a dataframe
# this is used with a dynamical assignment since
# data frame wil... | Python | 0 | @@ -2586,16 +2586,474 @@
valid'%0A%0A
+# columns description (in a csv format) helper%0Adef info_columns(df):%0A if isinstance(df, pd.core.frame.DataFrame):%0A lines = %22%22%0A counts = df.count() # for non-null values%0A for i, column in enumerate(df.columns):%0A dtype = df.dtypes.... |
4eec776b5b647b0f3a0b61f7e7500c81a9c0e138 | Remove unnecessary imports | buzzmobile/sense/lidar/lidar.py | buzzmobile/sense/lidar/lidar.py | #!/usr/bin/env python
import cv2
import numpy as np
import time
from cv_bridge import CvBridge, CvBridgeError
from sensor_msgs.msg import Image
from sensor_msgs.msg import LaserScan
from math import sin, cos, pi, atan2
import rospy
image_width = rospy.get_param("image_width")
image_height = rospy.get_param("image_he... | Python | 0.000033 | @@ -49,20 +49,8 @@
s np
-%0Aimport time
%0A%0Afr
@@ -198,15 +198,8 @@
, pi
-, atan2
%0Aimp
|
8ce7a90218788174234176113defb602c9ebb87d | Format compose file | sparkinabox/compose/__init__.py | sparkinabox/compose/__init__.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import yaml
def _image(context, role):
return "{0}/{1}-{2}".format(context["DOCKER_PREFIX"], context["DOCKER_NAME"], role)
def _interactive(context):
return context["CLIENT_ENTRYPOINT"] != "spar... | Python | 0 | @@ -734,16 +734,21 @@
: %5B%228080
+:8080
%22%5D,%0A
@@ -1197,10 +1197,36 @@
s%7D%0A %7D
+, default_flow_style=False
)%0A
|
9ddc456108eeb981cd0bdbbd74b6955397554063 | Allow specifying a custom env to twisted commands | sparts/tasks/twisted_command.py | sparts/tasks/twisted_command.py | # Copyright (c) 2014, Facebook, Inc. All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
"""Module that provides an API f... | Python | 0 | @@ -1570,16 +1570,26 @@
out=None
+, env=None
):%0A
@@ -2943,16 +2943,25 @@
=command
+, env=env
)%0A%0A
|
0fc60550af021fdf062a588378ac2fcb34e826be | Add check that a detector filth is really a Filth subclass | scrubadub/scrubbers.py | scrubadub/scrubbers.py | import operator
import sys
from . import exceptions
from . import detectors
from .filth import Filth
class Scrubber(object):
"""The Scrubber class is used to clean personal information out of dirty
dirty text. It manages a set of ``Detector``'s that are each responsible
for identifying their particular k... | Python | 0.000001 | @@ -1002,96 +1002,251 @@
-# TODO: should add tests to make sure filth_cls is actually a proper%0A # filth_cls
+if not issubclass(detector_cls.filth_cls, Filth):%0A raise TypeError((%0A 'The filth_cls %22%7B%7D%22 in the detector %22%7B%7D%22 is not a subclass '%0A '... |
01ebc8fe45dbcbfd665a586c6a3f2aa56ea35f9c | add a test to demonstrate recursive behavior | merfi/tests/test_repocollector.py | merfi/tests/test_repocollector.py | from merfi.collector import RepoCollector
from os.path import join
class TestRepoCollector(object):
def setup(self):
self.paths = RepoCollector(path='/', _eager=False)
def test_simple_tree(self, repotree):
paths = RepoCollector(path=repotree)
# The root of the repotree fixture is its... | Python | 0 | @@ -59,16 +59,25 @@
ort join
+, dirname
%0A%0A%0Aclass
@@ -957,28 +957,406 @@
set(paths) == set(expected)%0A
+%0A def test_debian_nested_release_files(self, repotree):%0A path = dirname(repotree)%0A paths = RepoCollector(path)%0A release_files = paths.debian_release_files%0A expected =... |
e723d4a3e42ce564c13dade1ecd869d364964a6b | Add rotate method. | drivers/display/ssd1306.py | drivers/display/ssd1306.py | # MicroPython SSD1306 OLED driver, I2C and SPI interfaces
from micropython import const
import framebuf
# register definitions
SET_CONTRAST = const(0x81)
SET_ENTIRE_ON = const(0xA4)
SET_NORM_INV = const(0xA6)
SET_DISP = const(0xAE)
SET_MEM_ADDR = const(0x20)
SET_COL_ADDR = const(0x21)
SET_PAGE_ADDR = const(0x22)
SET... | Python | 0 | @@ -1213,19 +1213,20 @@
DISP
- %7C 0x00, #
+, # display
off
@@ -1385,16 +1385,28 @@
LINE
- %7C 0x00,
+, # start at line 0
%0A
@@ -2257,17 +2257,31 @@
%7C 0x01,
+ # display on
%0A
-
@@ -2422,15 +2422,8 @@
DISP
- %7C 0x00
)%0A%0A
@@ -2616,24 +2616,24 @@
f, invert):%0A
-
self
@@ -2673... |
fefa00e92f63a8b80263711c7141fa4d12adfad9 | Support for storing txt data | agr/schema.py | agr/schema.py | from psycopg2 import connect
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
import agr
tables = [
('biom', """create table biom (
sample varchar,
biom json,
constraint pk_biom primary key(sample)
)"""),
('metadata', """create table me... | Python | 0 | @@ -200,16 +200,46 @@
m json,%0A
+ biomtxt text,%0A
|
7a41f92396d0e039dafe52f8474500203919897e | Validate that topic names are not "." or ".." | sentry_kafka/models.py | sentry_kafka/models.py | """
sentry_kafka.models
~~~~~~~~~~~~~~~~~~~~~
"""
from django import forms
from django.conf import settings
from django.core import validators
from kafka import KafkaClient, SimpleProducer
from sentry.plugins.bases.notify import NotifyPlugin
import sentry_kafka
import json
import re
import types
class KafkaOptions... | Python | 0.999938 | @@ -126,16 +126,17 @@
import
+(
validato
@@ -137,16 +137,29 @@
lidators
+, exceptions)
%0Afrom ka
@@ -309,16 +309,168 @@
types%0A%0A
+def KafkaOptionsFormValidateDots(value):%0A if value == '.' or value == '..':%0A raise exceptions.ValidationError('Topic cannot be %22.%22 or %22..%22')%0A%0A
class Ka... |
977a13ec9078aacba2156a74c1adce2f32fd00a6 | Remove auto doc string. | am/am/urls.py | am/am/urls.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
am URL Configuration.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: u... | Python | 0.000001 | @@ -68,621 +68,14 @@
ion.
-%0A%0AThe %60urlpatterns%60 list routes URLs to views. For more information please see:%0A https://docs.djangoproject.com/en/1.10/topics/http/urls/%0AExamples:%0AFunction views%0A 1. Add an import: from my_app import views%0A 2. Add a URL to urlpatterns: url(r'%5E$', views.home, n... |
f6f6af4369367e0f770dc6a57ff4a1cac2af4994 | Implement python completions from test_kernel | metakernel/magics/python_magic.py | metakernel/magics/python_magic.py | # Copyright (c) Metakernel Development Team.
# Distributed under the terms of the Modified BSD License.
import sys
import os
from metakernel import Magic, option
try:
import jedi
except ImportError:
jedi = None
else:
from jedi import Interpreter
from jedi.api.helpers import completion_parts
from je... | Python | 0.00025 | @@ -102,29 +102,8 @@
e.%0A%0A
-import sys%0Aimport os%0A
from
@@ -3268,16 +3268,71 @@
lf.env%5D)
+%0A%0A position = (info%5B'line_num'%5D, info%5B'column'%5D)
%0A
@@ -3361,22 +3361,16 @@
xt,
-(1, len(text))
+position
).ge
@@ -3486,16 +3486,17 @@
(like)%5D%0A
+%0A
@@ -3610,16 +3610,17 @@
... |
d825b11868c37877660149ebc4b21d7429d6eaf0 | remove unnecessary python2 fallback | metaopt/core/arg/util/modifier.py | metaopt/core/arg/util/modifier.py | # Future
from __future__ import absolute_import, division, print_function, \
unicode_literals, with_statement
# Standard Library
import sys
if sys.version_info[0] == 2:
# python 3 has an iterative zip built in
from itertools import izip as zip
class ArgsModifier(object):
'''
Modifies args in us... | Python | 0.000084 | @@ -112,153 +112,8 @@
nt%0A%0A
-# Standard Library%0Aimport sys%0A%0A%0Aif sys.version_info%5B0%5D == 2:%0A # python 3 has an iterative zip built in%0A from itertools import izip as zip%0A%0A
%0Acla
|
889f1b6dca057c0f921b5eacb94a7e64f348a6db | Fix unique_slug: Force queryset to be iterable. | shared/utils/fields.py | shared/utils/fields.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Erik Stein <code@classlibrary.net>, 2008-2015
import re
from django.db.models import fields
from django.utils import six
from django.utils.translation import ugettext_lazy as _
if six.PY3:
from functools import reduce
from .text import slugify_long... | Python | 0.000001 | @@ -991,32 +991,37 @@
similar_slugs =
+list(
get_similar_slug
@@ -1023,24 +1023,25 @@
_slugs(slug)
+)
%0A while s
|
c17e0f804a446ed0135730045ca96954c8967a48 | Bump version to 0.5.3 | simpleflow/__init__.py | simpleflow/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.5.2'
__author__ = 'Greg Leclercq'
__license__ = "MIT"
from .activity import Activity
from .workflow import Workflow
| Python | 0.000001 | @@ -41,9 +41,9 @@
0.5.
-2
+3
'%0A__
|
885da31fe513295292bd71c9f4edb48614d2c146 | Move `init_logging` most far on top of `init_app` | sipa/initialization.py | sipa/initialization.py | # -*- coding: utf-8 -*-
import logging.config
import os
import os.path
from flask import Flask
from raven import setup_logging
from raven.contrib.flask import Sentry
from raven.handlers.logging import SentryHandler
from flask.ext.babel import get_locale
from model import init_context, init_datasources_dormitories, ... | Python | 0 | @@ -1175,24 +1175,46 @@
config(app)%0A
+ init_logging(app)%0A
logger.d
@@ -1807,38 +1807,16 @@
bp_news)
-%0A init_logging(app)
%0A%0A fr
|
47b14cc87c83242286fa3a77735140de1c4969a6 | Top level error is SirBotError | sirbot/slack/errors.py | sirbot/slack/errors.py | from sirbot.core.errors import SirBotALotError
class SlackError(SirBotALotError):
"""Generic slack error"""
class SlackSetupError(SlackError):
"""Error during slack plugin configuration"""
class SlackClientError(SlackError):
"""Error with the slack API"""
class SlackConnectionError(SlackClientError)... | Python | 0.999959 | @@ -26,28 +26,24 @@
mport SirBot
-ALot
Error%0A%0A%0Aclas
@@ -65,12 +65,8 @@
rBot
-ALot
Erro
|
9f6cec50da24860e6fd536e8df4d8817c8811c25 | Add io.rancher.host.kvm=true for VM hosts | cattle/plugins/host_info/cpu.py | cattle/plugins/host_info/cpu.py | import platform
import os
import math
import re
from cattle.utils import CadvisorAPIClient
from cattle import Config
class CpuCollector(object):
def __init__(self):
self.cadvisor = CadvisorAPIClient(Config.cadvisor_ip(),
Config.cadvisor_port())
def _get_cpui... | Python | 0.000004 | @@ -2453,28 +2453,197 @@
ges())%0A%0A return data%0A
+%0A def get_labels(self, pfx=%22rancher%22):%0A if os.path.exists('/dev/kvm'):%0A return %7B%22.%22.join(%5Bpfx, %22kvm%22%5D): %22true%22%7D%0A else:%0A return %7B%7D%0A
|
cd63a21a2153f638301187b5fa6caa8b8c459740 | remove logger | email_confirm_la/models.py | email_confirm_la/models.py | # coding: utf-8
from __future__ import unicode_literals
import datetime
try:
# for Django 1.7+
from django.contrib.contenttypes.fields import GenericForeignKey
except ImportError:
from django.contrib.contenttypes.generic import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
... | Python | 0.000372 | @@ -771,75 +771,8 @@
d%0A%0A%0A
-import logging%0Alogger = logging.getLogger(name='log_to_console')%0A%0A%0A
clas
@@ -1974,92 +1974,8 @@
ry()
-%0A logger.error('confirmation.is_primary: %25s' %25 (confirmation.is_primary))
%0A%0A
@@ -2108,91 +2108,8 @@
%5D)%0A%0A
- logger.error('confirmation.is... |
4146551d191152ae486f079911f53086f3a60a07 | Rename version field in Choice to question | api/models.py | api/models.py | from django.db import models
from rest_framework import serializers
class Question(models.Model):
version = models.CharField(primary_key=True, max_length=8)
text = models.TextField()
created_on = models.DateTimeField(auto_now_add=True)
updated_on = models.DateTimeField(auto_now=True)
class Choice(mode... | Python | 0 | @@ -354,28 +354,29 @@
Field()%0A
-vers
+quest
ion = models
|
b9d54da73e5c4d859aa5ad8e9d8b96bb7527ae6d | Add position table and add field mid in box tables | api/models.py | api/models.py | from django.db import models
# Create your models here.
class User(models.Model):
uid = models.AutoField(primary_key=True)
uname = models.CharField(max_length=128)
session = models.CharField(max_length=35,unique=True)
class Box(models.Model):
bid = models.AutoField(primary_key=True)
level = models... | Python | 0 | @@ -325,24 +325,63 @@
egerField()%0A
+ mid = models.ForeignKey(%22Monster%22)%0A
owner =
@@ -693,24 +693,214 @@
=%22fourth%22)%0A%0A
+class Position(models.Model):%0A uid = models.ForeignKey(%22User%22)%0A latitude = models.FloatField()%0A longitude = models.FloatField()%0A time = models.DateFiel... |
73c4f9978e5d3ac56ff4a09879f2eba7199284b6 | Support "main = MyApp" convention | compapp/cli.py | compapp/cli.py | from __future__ import print_function
import os
from .apps import Computer
from .utils.importer import import_object
def _guess_module(path):
if not os.path.exists(path):
raise RuntimeError('{} is not an importable path nor a file path'
.format(path))
rootpath = path
... | Python | 0.000001 | @@ -1174,17 +1174,20 @@
for
-_
+name
, can in
@@ -1206,16 +1206,94 @@
tems():%0A
+ if name == 'main' and issubclass(can, supcls):%0A return can%0A
@@ -2282,16 +2282,183 @@
_plots%0A%0A
+ If there are multiple classes, a %22main%22 class for a module can be%0A declared simply b... |
7ca720af29353ca21d9081ae43128d844c3878c4 | Drop write batch usage | pigeon.py | pigeon.py |
"""
Pigeon, fast IP Geo lookup
"""
import csv
from itertools import chain, count, groupby, tee
import logging
from math import ceil
import struct
import socket
try:
from itertools import imap, izip
except ImportError:
# Python 3
imap = map
izip = zip
xrange = range
import plyvel
import simplejso... | Python | 0 | @@ -45,57 +45,8 @@
csv%0A
-from itertools import chain, count, groupby, tee%0A
impo
@@ -111,135 +111,8 @@
et%0A%0A
-try:%0A from itertools import imap, izip%0Aexcept ImportError:%0A # Python 3%0A imap = map%0A izip = zip%0A xrange = range%0A%0A
impo
@@ -153,40 +153,8 @@
n%0A%0A%0A
-from operator imp... |
67f85b58ee44efe77a7170071b18b1831987fcce | raise probability | player.py | player.py | import converters
import parser
import sys
# // test bot logic
def bot_logic(game_state):
return 0
# // todo: need parsing game_state: is_someone_allin(), is_someone_rise(), get_active_players(), get_all_money_in_game()
# // todo: get_probabillity()
# // todo:
#fold = 0
#someone_allin = True # is_someone_all... | Python | 0.00387 | @@ -794,9 +794,9 @@
%221.
-4
+5
%22%0A
@@ -3781,16 +3781,17 @@
ility %3C
+1
5.0:%0A
@@ -3858,16 +3858,17 @@
lity %3E=
+1
5.0 and
@@ -3889,17 +3889,17 @@
ility %3C
-1
+2
0.0:%0A
@@ -3967,17 +3967,17 @@
lity %3E=
-1
+2
0.0 and
@@ -3998,18 +3998,18 @@
ility %3C
-35
+40
.0:%0A
@@ -4078,10 +4... |
317166bf7d35f617fc49d1043fc2a1308579eeb5 | Add timeout for wifi connection | esp32/modules/installer.py | esp32/modules/installer.py | import ugfx, badge, sys, gc
import uos as os
import uerrno as errno
import ujson as json
import network, wifi
import machine, esp, time
import urequests as requests
import appglue
wifi.init()
ugfx.clear(ugfx.BLACK)
ugfx.string(20,25,"Connecting to:","Roboto_BlackItalic24",ugfx.WHITE)
ugfx.string(140,75, "WiFi","Perma... | Python | 0.000001 | @@ -424,16 +424,236 @@
ep(0.1)%0A
+ timeout = timeout - 1%0A if (timeout%3C1):%0A ugfx.clear(ugfx.BLACK)%0A ugfx.string(5,5,%22Failure.%22,%22Roboto_BlackItalic24%22,ugfx.WHITE)%0A ugfx.flush()%0A time.sleep(2)%0A appglue.start_app(%22%22)%0A
pass
|
5822fd465c69834774dabdc6d417e9712136f0d6 | Use count as option | admin/pwgen.py | admin/pwgen.py | #!/bin/env python3
# generate passwords
# TODO: generate passwords first then build aligned output table format
import sys
import random
import click
import string
@click.command("pwgen.py")
@click.argument("count", default=30)
@click.argument("length", default=12)
@click.option("character_filter", "-f","--filter", ... | Python | 0.000001 | @@ -191,45 +191,8 @@
y%22)%0A
-@click.argument(%22count%22, default=30)%0A
@cli
@@ -222,17 +222,17 @@
efault=1
-2
+6
)%0A@click
@@ -324,16 +324,82 @@
tring%22)%0A
+@click.option(%22-c%22,%22--count%22, default=30, help=%22Password count%22)%0A
@click.o
@@ -1148,15 +1148,8 @@
gth,
- count,
cha
@@ -1162,16 +116... |
d1655e583c5012e09269a300d9d49bcab7266119 | Create prueba.py | prueba.py | prueba.py | from flask import Flask
from flask import request
import os
import xml.etree.ElementTree as ET
from threading import Thread
import email_lib
app = Flask(__name__)
global xml = ""
def send_email(xml):
print "2"
email_lib.prueba()
print xml
return None
@app.route('/webhook', methods=['POST','GE... | Python | 0.000008 | @@ -164,16 +164,8 @@
_)%0A%0A
-%0Aglobal
xml
@@ -359,16 +359,24 @@
obal xml
+%0A xml
= %22hola
|
e7cef2f5ab71f1841a1649f8838a48f5ba2130ae | Create prueba.py | prueba.py | prueba.py | from flask import Flask
from flask import request
import os
import xml.etree.ElementTree as ET
from threading import Thread
import email_lib
app = Flask(__name__)
xml =""
def send_email(xml):
print "2"
email_lib.prueba()
print xml
return None
@app.route('/webhook', methods=['POST','GET'])
de... | Python | 0.000008 | @@ -169,10 +169,13 @@
ml =
-%22%22
+ None
%0A%0Ade
|
797d357e63529029f9efe6f43bc1a8a50a316bff | Fix alarm handle test | alarm/tests.py | alarm/tests.py | from test.testcase import AngelikaAPITestCase
from alarm.models import Alarm
from patient.models import Patient
from measurement.models import Measurement
from django.utils import timezone
from datetime import timedelta
from motivation_text.models import MotivationText
class PermissionTests(AngelikaAPITestCase):
... | Python | 0.000001 | @@ -4715,16 +4715,46 @@
n_text':
+ %7B%0A 'text':
'Ta en
@@ -4775,16 +4775,34 @@
Petter'%0A
+ %7D%0A
|
10d0bc9eab527922d8ae1d805eda18e852904e57 | Allow overriding the PyPI config file | pypi.wsgi | pypi.wsgi | #!/usr/bin/python
import sys
import os
prefix = os.path.dirname(__file__)
sys.path.insert(0, prefix)
import cStringIO
import webui
import store
import config
import re
from functools import partial
store.keep_conn = True
CONFIG_FILE = os.path.join(prefix, 'config.ini')
class Request:
def __init__(self, environ... | Python | 0.000001 | @@ -229,16 +229,46 @@
G_FILE =
+ os.environ.get(%22PYPI_CONFIG%22,
os.path
@@ -294,16 +294,17 @@
ig.ini')
+)
%0A%0A%0Aclass
|
002f53ac48fced0ba5575d99e685ef785494b701 | Edit task feature | pytodo.py | pytodo.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2013-2014, Adrian Matejov
import sys
import pynotify
import os
TASKS_PATH = os.path.join(os.path.dirname(__file__), "tasks.txt")
class Task:
def __init__(self, text, ID, priority):
self.text = text
self.ID = ID
self.priority = p... | Python | 0.000005 | @@ -1015,39 +1015,43 @@
()%0A self.
-f.
+_
close
+_file
()%0A%0A for
@@ -1279,16 +1279,39 @@
%25 int(i)
+%0A return
%0A%0A
@@ -1466,16 +1466,712 @@
file()%0A%0A
+ def edit_task(self, number, task):%0A %22%22%22Edits current task%22%22%22%0A self._open_file('r')... |
857d660f8908128aa320a6f303f34bced224c651 | Switch to python3 | pywrap.py | pywrap.py | #!/usr/bin/python
import sys, time, traceback, pprint
sys.stdout.close()
while True:
line = sys.stdin.readline()
if line:
i = open(line[:-1] + ".in", "r")
sys.stdout = open(line[:-1] + ".out", "w")
try:
for l in i:
exec(l)
except:
traceba... | Python | 0.000139 | @@ -10,16 +10,17 @@
n/python
+3
%0Aimport
|
50c5a52f5a04251b14489675239e60d0d8303597 | Update to version -> 3.1.0 | XIA2Version.py | XIA2Version.py | #!/usr/bin/env python
# XIA2Version.py
# Copyright (C) 2006 CCLRC, Graeme Winter
#
# This code is distributed under the BSD license, a copy of which is
# included in the root directory of this package.
#
# 6th June 2006
#
# A file containing the version number of the current xia2.
#
# History:
#
# 0.0.1 - ini... | Python | 0 | @@ -5010,16 +5010,73 @@
y cases.
+%0A#%0A# 0.3.1.0 - included xia2html, chef running and so on.
%0A%0AVersio
@@ -5090,19 +5090,19 @@
= %220.3.
-0.6
+1.0
%22%0AVersio
|
b50a7a5ff9f044475bcc877338f97a21c6e5039e | Fix in rate fetching on get item details, when using inclusive rate | erpnext/stock/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.py | erpnext/stock/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.py | # ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# 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 Foundation, either version 3 of the License, or
# (at yo... | Python | 0 | @@ -2133,21 +2133,43 @@
uom, t2.
-basic
+export_rate * t3.conversion
_rate, t
@@ -2631,13 +2631,35 @@
t1.
-basic
+export_rate * t2.conversion
_rat
|
ecf68c5d095a4f85856e012409e8dde4567376e2 | Fix negative values | reaper.py | reaper.py | #!/usr/bin/env python
import boto
import base64
import json
from datetime import datetime
def seconds_from_hours(hours):
return hours * 60 * 60
def should_kill(instance):
attributes = instance.get_attribute("userData")
if attributes['userData'] == None:
print "Instance has no userdata"
... | Python | 1 | @@ -813,19 +813,19 @@
e =
-start - end
+end - start
%0A%0A
@@ -1195,16 +1195,64 @@
tances:%0A
+ print %22Checking %7B%7D%22.format(instance.id)%0A
|
9c4f927f9565fc158dea8a7840842839b986ca64 | Improve rest api | remote.py | remote.py | from flask import Flask, render_template, request
from flask_restful import Resource, Api
import unicornhat as unicorn
import argparse
import json
import subprocess
import sys
app = Flask(__name__)
api = Api(app)
class State:
''' Handle Unicorn HAT state'''
def __init__(self, brightness, program_name):
... | Python | 0.000001 | @@ -935,16 +935,79 @@
, path%5D)
+%0A return True%0A else:%0A return False
%0A%0A# Init
@@ -1690,32 +1690,38 @@
s%7D%0A def p
-os
+u
t(self
+, level
):%0A s
@@ -1748,34 +1748,13 @@
int(
-request.form%5B'brightness'%5D
+level
))%0A
@@ -1905,16 +1905,21 @@
ef p
-os
+u
t(se... |
97140ae5183c82c0da7817d09e6aaa5d3c74cb4a | Fix indentation in routes | routes.py | routes.py | from flask import Flask, render_template, redirect, request
import psycopg2
from functools import wraps
import os
import urlparse
app = Flask(__name__)
def connectDB(wrapped):
@wraps(wrapped)
def inner(*args, **kwargs):
urlparse.uses_netloc.append("postgres")
url = urlparse.urlparse(os.envir... | Python | 0.0001 | @@ -1228,16 +1228,17 @@
gs):%0A
+
cur = ar
@@ -1434,24 +1434,25 @@
umber.%22)%0A
+
cur.execute(
@@ -1486,16 +1486,17 @@
TS')%0A
+
complete
@@ -1513,16 +1513,17 @@
chall()%0A
+
cur.e
@@ -1589,16 +1589,17 @@
ue')%0A
+
register
@@ -1618,16 +1618,17 @@
chall()%0A
+
if re
|
c39ed35ce4c21c6a7341ff81ab8cf186692c1845 | Read Guardian API key from positional argument. | scrape.py | scrape.py | #!/usr/bin/env python
from datetime import datetime
from json import loads
from bs4 import BeautifulSoup
from ebooklib import epub
import requests
def get_todays_news():
api_key = ''
payload = {'api-key': api_key,
'section': 'world',
'from-date': '2015-03-22'}
r = requests... | Python | 0 | @@ -17,16 +17,32 @@
ython%0A%0A%0A
+import argparse%0A
from dat
@@ -185,27 +185,17 @@
ews(
-):%0A
api_key
- = ''
+):
%0A
@@ -1848,16 +1848,195 @@
main():%0A
+ parser = argparse.ArgumentParser(%22Transform news from The Guardian's website into an epub file.%22)%0A parser.add_argument('api_key', type=s... |
5d51479eaf6b03d6b86faa4fe4ac79dda609f44d | Add code to clean_code function to clean quotes and emoticons. | script.py | script.py | '''
Dataset source: https://nlds.soe.ucsc.edu/sarcasm2
By Shereen Oraby, Vrindavan Harrison, Lena Reed, Ernesto Hernandez, Ellen Riloff and Marilyn Walker. "Creating and Characterizing a Diverse Corpus of Sarcasm in Dialogue." In The 17th Annual SIGdial Meeting on Discourse and Dialogue (SIGDIAL), Los Angeles, Califor... | Python | 0 | @@ -500,16 +500,37 @@
quotes%0A
+%093. Remove emoticons%0A
%093. Fix
@@ -918,16 +918,284 @@
step 2%0A
+%09data%5B:, 3%5D = np.array(%5Bclean_quotes(x) for x in data%5B:, 3%5D%5D)%0A%09data%5B:, 4%5D = np.array(%5Bclean_quotes(x) for x in data%5B:, 4%5D%5D)%0A%0A%09# step 3%0A%09data%5B:, 3%5D = np.array(%5Bremove... |
1015e1ff12d1ad72820d1aa67cd13ee4bf071c0a | Update to variables extracted from NetCDF file and minor changes to the file being loaded | co2_budget.py | co2_budget.py | #!/usr/bin/env python
# Stardard library
import numpy as np
import matplotlib.pyplot as plt
from glob import glob
# Custom functions
import read_fvcom_results as rfvcom
import plot_unstruct_grid as gp
from readFVCOM import readFVCOM
from range_test_fit import calculateRegression
if __name__ == '__main__':
# Be v... | Python | 0 | @@ -379,16 +379,8 @@
yc',
- 'zeta',
'ar
@@ -394,20 +394,30 @@
', '
-time', 'TCO2
+zeta', 'siglev', 'time
', '
@@ -426,26 +426,16 @@
', 'DYE'
-, 'siglev'
%5D%0A%0A #
@@ -770,32 +770,84 @@
o2_S
-5_low_run_fvcom_noairsea
+7_high_run_0001.nc')%0A fileNames = glob(base + '/output/rate_ranges/co2_S1
_000
|
d8308ee0a240d0a16c067fc6654f2ccc6dfbe429 | do need nonzero | code/VIMCO.py | code/VIMCO.py | """
The MIT License (MIT)
Copyright (c) 2016 Evan Archer
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, p... | Python | 0.999999 | @@ -4086,16 +4086,26 @@
i = ff%5Bi
+.nonzero()
%5D %0A
|
0439be287093a8423d1e142dc5f87f962a6b794a | Remove unused getlist and getkey filters | netbox/utilities/templatetags/helpers.py | netbox/utilities/templatetags/helpers.py | import datetime
import json
import re
import yaml
from django import template
from django.conf import settings
from django.urls import NoReverseMatch, reverse
from django.utils.html import strip_tags
from django.utils.safestring import mark_safe
from markdown import markdown
from utilities.choices import unpack_group... | Python | 0 | @@ -669,268 +669,8 @@
)%0A%0A%0A
-@register.filter()%0Adef getlist(value, arg):%0A %22%22%22%0A Return all values of a QueryDict key%0A %22%22%22%0A return value.getlist(arg)%0A%0A%0A@register.filter%0Adef getkey(value, key):%0A %22%22%22%0A Return a dictionary item specified by key%0A %22%22%22%0... |
bb31064dab5cdf1c78d1a9e9a135bc88623bda98 | Use slice on posts only, for more predictible results. | nikola/plugins/compile/rest/post_list.py | nikola/plugins/compile/rest/post_list.py | # -*- coding: utf-8 -*-
# Copyright © 2013 Udo Spallek, Roberto Alsina and others.
# 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 ... | Python | 0 | @@ -3731,16 +3731,27 @@
+timeline = %5Bp
for p
-ost
in
@@ -3772,50 +3772,13 @@
line
-%5Bfirst:last:step%5D:%0A if not post
+ if p
.use
@@ -3786,31 +3786,26 @@
in_feeds
-:%0A
+%5D%0A
conti
@@ -3792,36 +3792,62 @@
ds%5D%0A
- continue%0A
+for post in timeline%5Bfirst:... |
e4131cbfbd168f0d32947036d78bf82704120504 | use create not get or create for indicator mapping | source_data/etl_tasks/shared_utils.py | source_data/etl_tasks/shared_utils.py | import pprint as pp
import traceback
from django.core.exceptions import ObjectDoesNotExist
from django.db import IntegrityError
from source_data.models import *
def map_indicators(indicator_strings,document_id):
indicator_mapping = {}
distinct_indicator_strings = list(set(indicator_strings))
for indi... | Python | 0 | @@ -431,15 +431,8 @@
cts.
-get_or_
crea
@@ -691,16 +691,17 @@
tring)%0A%0A
+%0A
@@ -895,32 +895,33 @@
= indicator_id%0A%0A
+%0A
except O
@@ -929,33 +929,58 @@
jectDoesNotExist
-:
+ as e:%0A print e
%0A pas
@@ -1002,33 +1002,58 @@
t AttributeError
-:
+ as e:%0A ... |
967b612cbaaf7c6bda07cf86d860febc8cd26c87 | use base app name for figshare | project/settings.py | project/settings.py | """
Django settings for share project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# B... | Python | 0 | @@ -1274,28 +1274,8 @@
hare
-.apps.FigshareConfig
',%0A%5D
|
73bccf55b9d6882fed29ab38e0188d7c62370664 | Create prueba.py | prueba.py | prueba.py | from flask import Flask
from flask import request
import xml.etree.ElementTree as ET
from threading import Thread
app = Flask(__name__)
def send_email(xml):
print "2"
prueba()
print xml
return None
@app.route('/webhook', methods=['POST','GET'])
def webhook():
print "webhook"
xml = "... | Python | 0.000008 | @@ -43,16 +43,26 @@
request%0A
+import os%0A
import x
|
b9261b8be00d431bdfe4b3090d0d21904ba29620 | Fix ulozto account | module/plugins/accounts/UlozTo.py | module/plugins/accounts/UlozTo.py | # -*- coding: utf-8 -*-
import re
import urlparse
from module.plugins.internal.Account import Account
class UlozTo(Account):
__name__ = "UlozTo"
__type__ = "account"
__version__ = "0.22"
__status__ = "testing"
__description__ = """Uloz.to account plugin"""
__license__ = "GPLv3"
... | Python | 0.000002 | @@ -744,24 +744,8 @@
tml)
-%0A print m
%0A%0A
|
a1983b65af22a5ef5884fc91eea23704f0ba7e75 | Order nodes when getting subtree to make sure that only two passes are necessary to get all parent-child relationships. | pruner.py | pruner.py | import Bio.Phylo as bp
def mrca(taxa, treestore, graph):
assert len(taxa) > 0
cursor = treestore.get_cursor()
mrca = None
for taxon in taxa:
try: ancestors = get_ancestors(graph, cursor, taxon)
except:
taxa.remove(taxon)
continue
if not m... | Python | 0 | @@ -1621,16 +1621,28 @@
%0A %7D%0A%7D
+ ORDER BY ?n
'''%0A
|
02cb2f242cc5e6008c9329f1237a59c733d29c50 | Add documentation to em_defaults | metal/end_model/em_defaults.py | metal/end_model/em_defaults.py | em_default_config = {
### GENERAL
'seed': None,
'verbose': True,
'show_plots': True,
# Network
'batchnorm': False,
'dropout': 0.0,
'layer_output_dims': [100, 50],
# The first value is the output dim of the input module
# The final output dim will be the cardinality of th... | Python | 0 | @@ -271,66 +271,318 @@
The
-final output dim will be the cardinality of the classifier
+remaining values are the output dims of intermediate layers%0A # The task head attached to the final intermediate layer and has an%0A # output dim equal to the cardinality of the classifier.%0A # So the total ... |
06fb12aa2ca703aeb6305a581bdf1a2a1d1771ec | change attributes | chandra_suli/check_hot_pixel.py | chandra_suli/check_hot_pixel.py | #!/usr/bin/env python
"""
Check each candidate transient from Bayesian Block algorithm to see if it is actually a hot pixel
"""
import subprocess
import argparse
import os
import sys
import numpy as np
import astropy.io.fits as pyfits
from chandra_suli.run_command import CommandRunner
from chandra_suli import loggin... | Python | 0.000001 | |
7fcdec4e42133040256f9d370eea1335c97f0cee | Debug print entire resp | cogs/books.py | cogs/books.py | from datetime import datetime
from pprint import pprint
import re
import discord
import aiohttp
from typing import Dict, List
from urllib.parse import quote_plus
from bs4 import BeautifulSoup as bs
from discord.ext import commands
from utils import aiohttp_wrap as aw
from utils.paginate import paginate
from utils.dic... | Python | 0 | @@ -2805,39 +2805,12 @@
int(
-%5Bx%5B%22volumeInfo%22%5D for x in
resp
-%5D
)%0A
|
cc87c1049f13e26d2fcf5fe200ffe26b3ebf20b1 | Add current time to interactive sim | src/vivarium/interface/interactive.py | src/vivarium/interface/interactive.py | """
==========================
Vivarium Interactive Tools
==========================
This module provides an interface for interactive simulation usage. The main
part is the :class:`InteractiveContext`, a sub-class of the main simulation
object in ``vivarium`` that has been extended to include convenience
methods for ... | Python | 0.000001 | @@ -1246,24 +1246,158 @@
lf.setup()%0A%0A
+ @property%0A def current_time(self) -%3E Time:%0A %22%22%22Returns the current simulation time.%22%22%22%0A return self._clock.time%0A%0A
def setu
|
2e0536d04b148a17e065aa5929edff22565bbd7e | fix test | src/wordpress/tests/test_wordpress.py | src/wordpress/tests/test_wordpress.py | import pytest
import settings
from wordpress import WPSite, WPUser, WPConfig
from wordpress.generator import MockedWPGenerator
ROOT_PATH = '/srv/{}/localhost/'.format(settings.OPENSHIFT_ENV)
class TestWPSite:
@pytest.fixture(scope='module')
def wordpress(self):
return WPSite(
openshift_... | Python | 0.000002 | @@ -1358,20 +1358,23 @@
m_path(%22
-test
+ebraton
%22, ROOT_
|
f6cc83b465bf3904853d8d15473b55644e97f9b4 | Fix issue #1175: allow WIN32_INSERT_DEF=0 to turn off --output-def in mingw link. | src/engine/SCons/Tool/mingw.py | src/engine/SCons/Tool/mingw.py | """SCons.Tool.gcc
Tool-specific initialization for MinGW (http://www.mingw.org/)
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any per... | Python | 0.000023 | @@ -2237,16 +2237,50 @@
%0A if
+env.get(%22WIN32_INSERT_DEF%22,1) and
def_targ
@@ -2282,16 +2282,26 @@
_target:
+ %5C%0A
cmd.app
|
3a4a8f8533267387768b9f17cb805c1924cd93bb | remove silly clearing and passing of adapter to applychanges | src/zeit/content/cp/browser/teaser.py | src/zeit/content/cp/browser/teaser.py | # Copyright (c) 2009 gocept gmbh & co. kg
# See also LICENSE.txt
from zeit.content.cp.i18n import MessageFactory as _
import zeit.cms.checkout.interfaces
import zeit.cms.content.browser.commonmetadata
import zeit.cms.content.browser.form
import zeit.cms.content.interfaces
import zeit.cms.interfaces
import zeit.content... | Python | 0 | @@ -4838,142 +4838,8 @@
_%5D%0A%0A
- # Don't cache the adapter lookups because we want to apply changes to%0A # another object.%0A self.adapters.clear()%0A
@@ -4922,39 +4922,24 @@
fields, data
-, self.adapters
)%0A if
|
105609cf4b32d2232dd71864364e737f50be719b | remove useless debug code | migration/part-04-jsontosql.py | migration/part-04-jsontosql.py | #!/usr/bin/python
import json
import sys
import os
#sys.path += os.path.join(os.path.realpath(os.path.curdir
sys.path += ["/home/psycojoker/code/django/sqlmemopol2/apps/"]
sys.path += ["/home/psycojoker/code/django/sqlmemopol2/"]
from meps.models import Deleguation, Committe, Country, Group, Opinion
MEPS = "meps.xm... | Python | 0.000001 | @@ -2252,25 +2252,8 @@
ns:%0A
- try:%0A
@@ -2315,36 +2315,32 @@
%5D):%0A
-
print %22 new o
@@ -2366,20 +2366,16 @@
title%22%5D%0A
-
@@ -2477,82 +2477,8 @@
%22%5D)%0A
- except KeyError, e:%0A print opinion%0A raise e%0A
%0A%0Ade
|
4ff8693a3d38b12b29a0a5856819b482482e627c | version bump to 0.9.4 | src/environmentbase/version.py | src/environmentbase/version.py | __version__ = '0.9.3'
| Python | 0 | @@ -16,7 +16,7 @@
0.9.
-3
+4
'%0A
|
cb28c2670dc036094fa2edff5bf0aef1c24f41ab | update regexp to check for one of two conditions | pyWipe.py | pyWipe.py | #!/usr/bin/env python
""" Python 2.7 disk wiping utility for use on Linux operating systems. """
""" Import Python modules """
import sys # For use of interpreter variables & associated functions
import os # For use of operating system-dependent functions
import re # For ... | Python | 0 | @@ -1151,16 +1151,26 @@
%22%5E%5Ba-z%5D$
+%7C%5E%5Ba-z%5D%5Cd$
%22, block
|
7fbeb4c9823b03c00ad73acd53085caab304917c | upgrade will now detect if the installation is from git and update accordingly | proscli/upgrade.py | proscli/upgrade.py | import click
from proscli.utils import default_cfg
import os
import os.path
import subprocess
import sys
import json
@click.group()
def upgrade_cli():
pass
def get_upgrade_command():
if getattr(sys, 'frozen', False):
cmd = os.path.abspath(os.path.join(sys.executable, '..', '..', 'updater.exe'))
... | Python | 0 | @@ -695,98 +695,105 @@
-if subprocess.run('where git').returncode == 0:%0A return %5B'git', 'pull'%5D
+click.echo('Development environment detected.')%0A with open(os.devnull) as devnull:
%0A
@@ -805,18 +805,20 @@
-el
+
if subpr
@@ -834,21 +834,36 @@
('where
... |
8c93043e4e3c27fd42873766b6cc677cd60818db | Remove now obsolete comment. | st2common/st2common/models/db/pack.py | st2common/st2common/models/db/pack.py | # Licensed to the StackStorm, Inc ('StackStorm') 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 th... | Python | 0 | @@ -1452,32 +1452,8 @@
rue)
- # TODO: Enforce format
%0A
|
a6787efd4084324f956e1e07a77bef9c9740fa7d | Index search improvements | st2common/st2common/services/packs.py | st2common/st2common/services/packs.py | # Licensed to the StackStorm, Inc ('StackStorm') 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 th... | Python | 0 | @@ -1754,16 +1754,33 @@
x_urls:%0A
+ try:%0A
@@ -1825,16 +1825,136 @@
json())%0A
+ except ValueError:%0A raise ValueError(%22Malformed index: %25s does not contain valid JSON.%22 %25 index_url)%0A
retu
@@ -2684,24 +2684,188 @@
tems(pack):%0A
+ if not hasattr(val... |
3d025a97162b3a5d3bd4dfeef7f834eedc8c5889 | move gtk imports out to global scope | pyrana.py | pyrana.py | #!/usr/bin/env python
"""
Pyrana -- a minimalist music player.
This little script was written out of frustration with larger music
players. Pretty much all I've ever wanted out of a music player was one that
played random albums by picking a random artist, then picking a random album,
then playing that album, then pic... | Python | 0 | @@ -1623,16 +1623,103 @@
mixer%0A%0A
+import pygtk%0Apygtk.require('2.0')%0Aimport gtk%0A%0Aimport pynotify%0Apynotify.init(%22Basics%22)%0A%0A
config =
@@ -1904,114 +1904,8 @@
y':%0A
- import pygtk%0A pygtk.require('2.0')%0A import pynotify%0A pynotify.init(%22Basics%22)%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.