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 |
|---|---|---|---|---|---|---|---|
9c5531c5adccf1d6cc8194e3ed83a8f30210b91b | add variable Admin API method name | qubesadmin/events/__init__.py | qubesadmin/events/__init__.py | # -*- encoding: utf8 -*-
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2017 Marek Marczykowski-Górecki
# <marmarek@invisiblethingslab.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public Li... | Python | 0 | @@ -1156,16 +1156,43 @@
elf, app
+, api_method='admin.Events'
):%0A
@@ -1278,16 +1278,55 @@
= app%0A%0A
+ self._api_method = api_method%0A%0A
@@ -2901,22 +2901,38 @@
ite(
-b'admin.Events
+self._api_method.encode() + b'
%5C0')
@@ -3350,30 +3350,32 @@
, dest,
-'admin.Events'
+self._api_metho... |
61890f3f6def74a6867a51366e9ee54bbe338407 | Use a list comprehension instead of a new SQL query | src/dal_select2/views.py | src/dal_select2/views.py | """Select2 view implementation."""
import collections
import json
from dal.views import BaseQuerySetView, ViewMixin
from django import http
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from django.utils.translation import ugettext as _
from django.views.generic.list import Vie... | Python | 0 | @@ -1207,18 +1207,31 @@
ion if a
+%0A #
-(
case-ins
@@ -1285,84 +1285,180 @@
-if self.get_queryset().filter(**%7Bself.create_field +'__iexact': q%7D).exists()
+existing_options = (self.get_result_label(result).lower()%0A for result in context%5B'object_list'%5D)%0A ... |
e20faf0486d981b3aaed72487150e00ec99730b0 | Use a UK/Europe standard format of dates | lowfat/settings.py | lowfat/settings.py | """
Django settings for lowfat 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
fro... | Python | 0.999994 | @@ -3886,14 +3886,96 @@
= %22
-Y-m-d%22
+l, d F Y%22 # British English style%0ADATETIME_FORMAT = %22l, d F Y%22 # British English style
%0A%0ACR
|
11f13dd6fc3321e4b3e1fde7e85065392cecc988 | Revise comments | lc0236_lowest_common_ancestor_of_a_binary_tree.py | lc0236_lowest_common_ancestor_of_a_binary_tree.py | """Leetcode 236. Lowest Common Ancestor of a Binary Tree
Medium
URL: https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes
in the tree.
According to the definition of LCA on Wikipedia: "The lowest common ancestor
is define... | Python | 0 | @@ -1946,47 +1946,8 @@
q)%0A%0A
- if not left and not right:%0A
@@ -1990,35 +1990,14 @@
- return None%0A%0A if
+if not
lef
@@ -2002,16 +2002,20 @@
eft and
+not
right:%0A
@@ -2019,22 +2019,43 @@
:%0A
+
+ return None%0A%0A
+
# p and
@@ -2064,32 +2064,59 @@
... |
fd426f479748826b4987f9037483686da5e344ec | Bump version to `1.0.2` | pomodoro_calculator/__init__.py | pomodoro_calculator/__init__.py | """
A pretty command line tool to calculate the number
of Pomodori available between two points in time.
"""
__author__ = 'Matt Deacalion Stevens'
__version__ = '1.0.1'
import datetime
from itertools import cycle
class PomodoroCalculator:
"""
Calculates the number of Pomodori available in an amount of time.
... | Python | 0 | @@ -159,17 +159,17 @@
= '1.0.
-1
+2
'%0A%0Aimpor
|
59ec603a7bcaabd7bac5901bc265920682d4cfcf | Add another missing self | tictactoe.py | tictactoe.py | from logishort import *
from getch import *
from logipy import logi_led
from logimap import logimap
import time
class TicTacToe:
def __init__(self):
init()
time.sleep(1)
self.accepted_keys = {
't':[0x14, 0, 0],
'y':[0x15, 0, 1],
'u':[0x16, 0, 2],
... | Python | 0.001914 | @@ -772,16 +772,21 @@
e_won =
+self.
play(c)%0A
|
7523ff90cadcefe3d51682d3301f7ceb51c70ced | Revert "Corrige a resolução" | timelapse.py | timelapse.py | import os
import datetime
import time
import picamera
from PIL import Image, ImageStat, ImageFont, ImageDraw
with picamera.PiCamera() as camera:
camera.resolution = (1024, 728)
camera.rotation = 180
time.sleep(2) # camera warm-up time
for filename in camera.capture_continuous('images/img_{timesta... | Python | 0 | @@ -174,17 +174,17 @@
(1024, 7
-2
+6
8)%0A c
@@ -549,17 +549,36 @@
ing...')
-%0A
+ %0A
%0A
@@ -664,16 +664,28 @@
pass%0A
+
%0A
|
60f89131b8f18046e4504b20c64f95cb3b30085a | Make sure we allow https flv files | apps/videos/types/flv.py | apps/videos/types/flv.py | # Universal Subtitles, universalsubtitles.org
#
# Copyright (C) 2010 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License... | Python | 0 | @@ -851,16 +851,20 @@
e('%5Ehttp
+(s)?
://.+/.+
@@ -1089,16 +1089,17 @@
h(url))
+%0A
|
2d7306be270738de5e3c2e66d18706c9e530a000 | fix some bugs | handlers/displaygroup.py | handlers/displaygroup.py | import tornado.web
import tornado.gen
import tornado.httpclient
import json
import io
import logging
import datetime
import motor
from bson.objectid import ObjectId
import mickey.userfetcher
from mickey.basehandler import BaseHandler
import mickey.commonconf
import mickey.tp
class DisplayGroupHandler(BaseHandler):
... | Python | 0.000008 | @@ -257,25 +257,8 @@
conf
-%0Aimport mickey.tp
%0A%0Acl
@@ -1286,232 +1286,8 @@
lt:%0A
- #check tp chat id%0A tp_chatid = result.get('tp_chatid', None)%0A if not tp_chatid:%0A owner = result.get('owner', '')%0A mickey.tp.addgroup(groupid, owner, %22%22, ... |
b856016182a9a0c97ccb5e6593aa16f3a269bf79 | fix ToDoList class method add_todo to pass non_boolean test | todo_list.py | todo_list.py | import todo_item
class ToDoList(object):
def __init__(self, name, description, todo_items):
self.name = name
self.description = description
self.todo_items = todo_items
def add_todo(self, content, complete = False, *args):
item = todo_item.ToDoItem(content, complete, *args)
self.todo_items.append(item)
d... | Python | 0.000002 | @@ -225,16 +225,86 @@
*args):%0A
+%09%09if type(complete) != type(True):%0A%09%09%09self.complete = False%0A%09%09%09return%0A
%09%09item =
|
c000dd1d0940b47c13761bb09e0cb50a2adc6a2e | Handle token_endpoint auth type in osc plugin | heatclient/osc/plugin.py | heatclient/osc/plugin.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distrib... | Python | 0.000044 | @@ -1370,16 +1370,180 @@
_NAME%7D)%0A
+ elif instance.auth_plugin_name == 'token_endpoint':%0A kwargs.update(%7B'endpoint': instance.auth.url,%0A 'token': instance.auth.token%7D)%0A
else
@@ -1723,17 +1723,16 @@
)%0A
-%0A
|
ab365a6fdf39feed6f529a4a5170c2d9f674b706 | fix unicode issue | weboob/backends/orange/pages/compose.py | weboob/backends/orange/pages/compose.py | # -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Nicolas Duhamel
#
# 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 yo... | Python | 0.000099 | @@ -1883,16 +1883,32 @@
.content
+.encode('utf-8')
%0A
|
41b532c882446d855b48d730fdd7f804668eab7e | Fix problem with Django Admin -> It always uses username as the username field | axes/utils.py | axes/utils.py | from __future__ import unicode_literals
try:
import win_inet_pton # pylint: disable=unused-import
except ImportError:
pass
from socket import error, inet_pton, AF_INET6
from django.core.cache import caches
from django.utils import six
import ipware.ip2
from axes.conf import settings
from axes.models impor... | Python | 0.000002 | @@ -2352,41 +2352,18 @@
get(
-settings.AXES_USERNAME_FORM_FIELD
+'username'
, No
|
54b319a09c71e707eb87195ce79e59bfb2b0daaa | Fix scene management | ezpygame.py | ezpygame.py | """Easier and more pythonic usage of :mod:`pygame`."""
import pygame
class Application:
"""The class for creating a :mod:`pygame` application.
A simple wrapper around :mod:`pygame`, which initializes and quits
:mod:`pygame` as the application starts/ends. Also makes the scene
management seamless and... | Python | 0.000061 | @@ -864,45 +864,8 @@
e=30
-,%0A initial_scene=None
):%0A
@@ -1137,75 +1137,8 @@
ate%0A
- :param Scene%7CNone initial_scene: scene where to start from%0A
@@ -1232,19 +1232,10 @@
e =
-initial_sce
+No
ne%0A
@@ -2890,30 +2890,35 @@
self.
+change
_scene
- =
+(
scene
+)
%0A%0A ... |
ca327b35c2e45329962da0dc04cfe2354ffd8b35 | add lcm gl support to testDrakeVisualizer.py | src/python/tests/testDrakeVisualizer.py | src/python/tests/testDrakeVisualizer.py | from ddapp.consoleapp import ConsoleApp
from ddapp.screengrabberpanel import ScreenGrabberPanel
from ddapp.drakevisualizer import DrakeVisualizer
from ddapp import objectmodel as om
from ddapp import applogic
from PythonQt import QtCore, QtGui
class DrakeVisualizerApp(ConsoleApp):
def __init__(self):
C... | Python | 0 | @@ -139,16 +139,53 @@
ualizer%0A
+from ddapp.lcmgl import LCMGLManager%0A
from dda
@@ -239,17 +239,16 @@
pplogic%0A
-%0A
from Pyt
@@ -759,16 +759,68 @@
lf.view)
+%0A self.lcmglManager = LCMGLManager(self.view)
%0A%0A
|
d73d1ab8844ac0048c3ad0ebd2d2b6c12b8c606c | Make cli for getting files from google folder | featured.py | featured.py | import httplib2
import os
import datetime
import argparse
import io
import sys
import datetime
from apiclient import discovery
import oauth2client
from oauth2client import client
from oauth2client import tools
from googleapiclient.http import MediaIoBaseDownload
from flask import Flask
from flask_restful import Resour... | Python | 0 | @@ -3368,37 +3368,321 @@
%0A
- %0A %0A
+%0Aif __name__ == '__main__':%0A srv = get_service(get_credentials())%0A try:%0A last = datetime.datetime.fromtimestamp(float(open('last').readline()))%0A except IOError:%0A last = None%0A get_files(srv, last)%0A with o... |
38939635530223ef7d736c19c9c2d666c67baca4 | fix file format generated by ffhlwiki.py | ffhlwiki.py | ffhlwiki.py | #!/usr/bin/env python3
import json
import argparse
from itertools import zip_longest
from urllib.request import urlopen
from bs4 import BeautifulSoup
def import_wikigps(url):
def fetch_wikitable(url):
f = urlopen(url)
soup = BeautifulSoup(f)
table = soup.find_all("table")[0]
rows = table.find_all... | Python | 0 | @@ -848,26 +848,26 @@
aliases =
-%5B%5D
+%7B%7D
%0A%0A for node
@@ -1268,20 +1268,11 @@
-alias%5B'
mac
-'%5D
= d
@@ -1421,22 +1421,21 @@
ases
-.append(
+%5Bmac%5D =
alias
-)
%0A%0A
|
ce2c34fc9dc010429047613b6bdfc513c799987d | update projecs with voting status and check deadline | bluebottle/projects/management/commands/cron_status_realised.py | bluebottle/projects/management/commands/cron_status_realised.py | from django.core.management.base import BaseCommand, CommandError
from django.utils.timezone import now
from django.db import connection
from bluebottle.clients.models import Client
from bluebottle.projects.models import Project
from bluebottle.bb_projects.models import ProjectPhase
from bluebottle.tasks.models import... | Python | 0 | @@ -410,16 +410,57 @@
lTenant%0A
+from bluebottle.votes.models import Vote%0A
%0A%0Aclass
@@ -3832,16 +3832,530 @@
models.%5Cn%5Cn%22)%0A
+%0A self.stdout.write(%22Checking projects with voting deadlines%5Cn%5Cn%22)%0A%0A vote_phase = ProjectPhase.objects.get(slug='voting')%0A vot... |
6192a8ed74e80e0a6b2c18292bd87ba2b44a6f44 | Split format dictionary | audiorename/rename.py | audiorename/rename.py | # -*- coding: utf-8 -*-
"""Rename a single audio file."""
import os
import six
from ansicolor import green
from ansicolor import red
import shutil
from phrydy import as_string
from tmep import Functions
from tmep import Template
from .meta import Meta
formats = {
'default': '$artist_initial/' +
'%shorten{... | Python | 0.000003 | @@ -262,21 +262,27 @@
mats = %7B
-%0A
+%7D%0A%0Aformats%5B
'default
@@ -282,17 +282,19 @@
default'
-:
+%5D =
'$artis
@@ -298,32 +298,34 @@
tist_initial/' +
+ %5C
%0A '%25shorten%7B$
@@ -340,24 +340,27 @@
fe_sort%7D/' +
+ %5C
%0A '%25short
@@ -402,32 +402,35 @@
%7Byear_safe%7D%7D/' +
+ %5C
%0A ... |
47c76074e010107fb3bfe3fc0f74482058efac50 | Add support for constructor keyword arguments (i.e. pass them through to FilesystemCollection). | src/sheared/web/collections/entwined.py | src/sheared/web/collections/entwined.py | #
# 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 Foundation; either version 2... | Python | 0.000047 | @@ -1843,16 +1843,22 @@
ates, *a
+, **kw
):%0A
@@ -1898,16 +1898,22 @@
self, *a
+, **kw
)%0A
|
89acbe756359f7ebc3bc25bf2e53264d9b951333 | fix test failure on windows: process names can also ends with '.bin', not only '.exe' | test/_windows.py | test/_windows.py | #!/usr/bin/env python
#
# $Id$
#
import os
import unittest
import platform
import subprocess
import signal
import time
import warnings
import psutil
from test_psutil import reap_children, get_test_subprocess
try:
from psutil import wmi
except ImportError:
warnings.warn("Can't import WMI module; Windows speci... | Python | 0.000003 | @@ -1598,16 +1598,43 @@
(%22.exe%22)
+ or p.name.endswith(%22.bin%22)
)%0A%0A i
|
15ab20faa2ae7e9b5f30d57458b12e11722bb63f | Remove debugging | flickrpc.py | flickrpc.py | from twisted.python.failure import Failure
from twisted.internet import defer
from twisted.web.xmlrpc import Proxy
from elementtree import ElementTree
import os, md5
class FlickrError(Exception):
def __init__(self, code, message):
Exception.__init__(self)
self.code = int(code)
self.message ... | Python | 0.000005 | @@ -1975,51 +1975,8 @@
d):%0A
- print %22generating %25s%22 %25 method%0A
|
9824144e9a7f8558e3ca0836ad30613ed2baeb08 | remove left-over debug bash | pprof/projects/gentoo/crafty.py | pprof/projects/gentoo/crafty.py | """
crafty experiment within gentoo chroot.
"""
from os import path
from pprof.projects.gentoo.gentoo import GentooGroup
from pprof.utils.downloader import Wget
from pprof.utils.run import run, uchroot
from plumbum import local
from plumbum.cmd import cat # pylint: disable=E0401
class Crafty(GentooGroup):
"""
... | Python | 0 | @@ -1082,46 +1082,8 @@
ath%5D
-%0A bash = uchroot()%5B%22/bin/bash%22%5D
%0A%0A
|
b0d23f375a224b60ad7e57e35864cc9e140b72c2 | Remove old comment | workflows/common/python/model_runner.py | workflows/common/python/model_runner.py |
# MODEL RUNNER PY
# Currently only supports NT3_TC1 # Not true? -Justin 2018/02/28
# See __main__ section for usage
import sys
import json
import os
import numpy as np
import importlib
import runner_utils
import log_tools
import math
logger = None
print("MODEL RUNNER...")
# Adding the following line in order to ap... | Python | 0 | @@ -17,73 +17,8 @@
PY%0A%0A
-# Currently only supports NT3_TC1 # Not true? -Justin 2018/02/28%0A
# Se
|
c6dc5e6a25e6a7154728e38dd174cc65bce00a61 | Add build support for bzip2 | pprof/projects/gentoo/gentoo.py | pprof/projects/gentoo/gentoo.py | """
The Gentoo module for running tests on builds from the portage tree.
This will install a stage3 image of gentoo together with a recent snapshot
of the portage tree. For building / executing arbitrary projects successfully it
is necessary to keep the installed image as close to the host system as
possible.
In order... | Python | 0 | @@ -5247,28 +5247,279 @@
, experiment):%0A pass%0A
+%0A%0Aclass BZip2(GentooGroup):%0A NAME = %22gentoo-bzip2%22%0A DOMAIN = %22app-arch%22%0A%0A def build(self):%0A with local.cwd(self.builddir):%0A emerge_in_chroot = uchroot()%5B%22/usr/bin/emerge%22%5D%0A run(emerge_in_c... |
829d32fa8f1724bf2e8a738567f48e7047ce11b6 | handle error again | cmsplugin_remote_form/cms_plugins.py | cmsplugin_remote_form/cms_plugins.py | import requests
from django.core.mail import EmailMultiAlternatives
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
try:
from django.urls import reverse
except ImportError:
# handle Django < 1.10
from django.core.urlresolvers import reverse
from cms.plugin_base impo... | Python | 0 | @@ -2666,16 +2666,117 @@
emails:%0A
+ error = self.remote_response.content if self.remote_response else %22Connection Error%22%0A
@@ -3322,36 +3322,13 @@
-self.remote_response.content
+error
%0A
|
dcda5039755841ee5eb7faa6d45e763fbede3ee0 | update serializer api | hwt/synthesizer/utils.py | hwt/synthesizer/utils.py | # -*- coding: utf-8 -*-
from io import StringIO
import os
from hwt.serializer.store_manager import SaveToStream, StoreManager
from hwt.serializer.vhdl.serializer import Vhdl2008Serializer
from hwt.synthesizer.dummyPlatform import DummyPlatform
from hwt.synthesizer.unit import Unit
from hwt.serializer.generic.to_hdl_a... | Python | 0 | @@ -2493,16 +2493,20 @@
rializer
+_cls
=Vhdl200
@@ -2738,16 +2738,20 @@
rializer
+_cls
=seriali
@@ -2745,32 +2745,36 @@
r_cls=serializer
+_cls
,%0A
|
6fcce1bcecb15000c671c706588d6fd0d92145e5 | Add windbg info to header | voltron/entry.py | voltron/entry.py | """
This is the main entry point for Voltron from the debugger host's perspective.
This file is loaded into the debugger through whatever means the given host
supports.
In LLDB:
(lldb) command script import /path/to/voltron/entry.py
In GDB:
(gdb) source /path/to/voltron/entry.py
In VDB:
(vdb) script /... | Python | 0 | @@ -163,19 +163,16 @@
ports.%0A%0A
-In
LLDB:%0A%0A
@@ -230,19 +230,16 @@
try.py%0A%0A
-In
GDB:%0A%0A
@@ -284,11 +284,8 @@
py%0A%0A
-In
VDB:
@@ -328,16 +328,109 @@
entry.py
+%0A%0AWinDbg/CDB (via PyKD):%0A%0A %3E .load pykd.pyd%0A %3E !py --global C:%5Cpath%5Cto%5Cvoltron%5Centry.py
%0A%22%22%22%0A%0... |
2f1df9024ae4a0a070bb058ce075acdb8bcf0474 | Include date in email send | weekly-update.py | weekly-update.py | #!/usr/bin/python
import sys
import xmlrpclib
import subprocess
import yaml
import smtplib
import json
from datetime import datetime
print 'Weekly update started at ' + str(datetime.now())
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import render
from config import *
def send... | Python | 0.000003 | @@ -333,16 +333,22 @@
ss, html
+, date
):%0A w
@@ -766,17 +766,29 @@
ly Recap
-'
+ for ' + date
%0A msg
@@ -2440,24 +2440,30 @@
.com', email
+, date
)%0A%0A with
|
3275827ef5578142e07747f9feacc4f47fc22006 | Update factorial.py | problems/factorial/factorial.py | problems/factorial/factorial.py | def fac(n):
return 1 if n == 1 else n * fac(n-1)
print fac(3)
print fac(33)
| Python | 0.000002 | @@ -1,8 +1,30 @@
+# Recursive factorial%0A
def fac(
@@ -78,26 +78,264 @@
rint
- fac(3)%0Aprint fac(33)
+(fac(3)) # 6%0Aprint(fac(33)) # 8683317618811886495518194401280000000%0A%0A# Iterative factorial%0Adef fac(n):%0A res = i = 1%0A while i %3C= n:%0A res *= i%0A i += 1%0A return res%0A%0Aprin... |
20fc5e0cb1bce4e4e1a69e3f7158f1ceec29c1d0 | Version bump | be/version.py | be/version.py |
VERSION_MAJOR = 0
VERSION_MINOR = 2
VERSION_PATCH = 1
version_info = (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
version = '%i.%i.%i' % version_info
__version__ = version
__all__ = ['version', 'version_info', '__version__']
| Python | 0.000001 | @@ -50,9 +50,9 @@
H =
-1
+2
%0A%0Ave
|
b250cfacdb45d85bf6ef7f0a1f28b89935c24b9b | Update settings.py | project-name/my_app/settings.py | project-name/my_app/settings.py | # Snippets from Actual Settings.py
TEMPLATES = [
{
'BACKEND': 'django_jinja.backend.Jinja2',
"DIRS": "PROJECT_ROOT_DIRECTORY",
'APP_DIRS': True,
'OPTIONS': {
'match_extension': '.html',
'context_processors': [
'django.template.context_processo... | Python | 0.000001 | @@ -115,16 +115,17 @@
%22DIRS%22:
+%5B
%22PROJECT
@@ -141,16 +141,24 @@
ECTORY%22,
+ %22...%22%5D,
%0A
|
94e85fb24a9b2c327094b880e05251ffb00c1335 | Add urls for list by topic and by location | bills/urls.py | bills/urls.py | from . import views
from django.conf.urls import url
urlpatterns = [
url(r'^list/', views.bill_list),
url(r'^latest_activity/', views.latest_bill_activity),
url(r'^latest/', views.latest_bill_actions),
url(r'^detail/(?P<bill_id>(.*))/$', views.bill_detail, name='bill_detail'),
]
| Python | 0 | @@ -79,13 +79,69 @@
(r'%5E
-list/
+by_topic/', views.bill_list_by_topic),%0A url(r'%5Eby_location
', v
@@ -154,16 +154,28 @@
ill_list
+_by_location
),%0A u
|
f3a80a66dbfde1e762dd241e182a7ce66fd77e5f | Add is_active boolean to serializer | project/apps/api/serializers.py | project/apps/api/serializers.py | from rest_framework import serializers
from .models import (
Convention,
Contest,
Contestant,
Group,
Performance,
Note,
)
from django.contrib.auth import get_user_model
User = get_user_model()
class PerformanceSerializer(serializers.ModelSerializer):
round = serializers.CharField(
... | Python | 0.002324 | @@ -3539,24 +3539,49 @@
formances',%0A
+ 'is_active',%0A
)%0A%0A%0A
@@ -4320,32 +4320,57 @@
'contestants',%0A
+ 'is_active',%0A
)%0A%0A%0Aclas
|
67fe36b7a733af9fb68b8ac96d5c1c0a471bc2b8 | version bump | malcolm/version.py | malcolm/version.py | __version__ = '0.5'
| Python | 0.000001 | @@ -14,7 +14,7 @@
'0.
-5
+6
'%0A
|
9bfd47801b476158b94d10c74ecd6a4120162704 | Fix AttributeError: 'super' object has no attribute 'capture_traffic' | malware/sandbox.py | malware/sandbox.py | import virtualbox
import os
import time
import threading
import logging
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-10s) %(message)s',)
class Sandbox(object):
def __init__(self, name):
vbox = virtualbox.VirtualBox()
self.vm = vbox.find_machine(name)
... | Python | 0.022124 | @@ -3890,16 +3890,21 @@
super(
+Win32
Sandbox,
|
318bf52453055ce00fc1d66006d25ef81f013dfa | change output format a little | bin/evtest.py | bin/evtest.py | #!/usr/bin/env python
# encoding: utf-8
'''
evdev example - input device event monitor
'''
from sys import argv, exit
from select import select
from evdev import ecodes, InputDevice, list_devices, AbsInfo
usage = 'usage: evtest <device> [<type> <value>]'
evfmt = 'time {:<16} type {} ({}), code {:<4} ({}), value {}... | Python | 0.000002 | @@ -2008,16 +2008,18 @@
ings: %7B%7D
+%5Cn
'.format
@@ -2084,41 +2084,15 @@
-print('Active LEDs: %7B%7D%5Cn'.format(
+leds =
','.
@@ -2132,55 +2132,60 @@
ue))
-))%0A%0A
+%0A
print('
-Currently
+Active LEDs: %25s' %25 leds)%0A%0A
active
-
+_
keys
-: %7B%7D%5Cn'.format(
+ =
','.
@@ -2228,17 +2228,56... |
b183a200d2e546de955e5190fefe7b7a61a1fc55 | check if no devices were found | bin/evtest.py | bin/evtest.py | #!/usr/bin/env python
# encoding: utf-8
'''
evdev example - input device event monitor
'''
from sys import argv, exit
from select import select
from evdev import ecodes, InputDevice, list_devices, AbsInfo
usage = 'usage: evtest <device> [<type> <value>]'
evfmt = 'time {:<16} type {} ({}), code {:<4} ({}), value {}... | Python | 0.000002 | @@ -409,17 +409,16 @@
%0A '''
-
Select a
@@ -467,17 +467,17 @@
devices
-
+.
'''%0A%0A
@@ -547,16 +547,144 @@
e_dir))%5D
+%0A if not devices:%0A print('error: no input devices found (do you have rw permission on /dev/input/*?)')%0A exit(1)
%0A%0A de
|
1bc7937bf0c4c65996e586aef997250869bf5ed1 | Use python from env. | bin/pylama.py | bin/pylama.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
import os
from pylama.main import shell
if __name__ == '__main__':
try:
virtual_env = os.environ.get('VIRTUAL_ENV', '')
activate_this = os.path.join(virtual_env, 'bin', 'activate_this.py')
with open(activate_this) as f:
... | Python | 0 | @@ -4,16 +4,20 @@
usr/bin/
+env
python%0A%0A
|
4ca9d012495de07ab0127582145fd16db0e03a28 | Add health URL when in maintenance mode | gem/urls.py | gem/urls.py | import os
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
from django.views.generic.base import TemplateView
from django.contrib.auth.decorators import login_required
from django_cas_ng import views as cas_views
fro... | Python | 0 | @@ -4816,24 +4816,105 @@
atterns = %5B%0A
+ url(%0A r'%5Ehealth/$',%0A core_views.health,%0A ),%0A
url(
|
d6294ce0629c8ab59333db4b87c471448ad4d7e9 | Allow rebuild to reinstall transition. | lib/python2.6/aquilon/aqdb/model/hostlifecycle.py | lib/python2.6/aquilon/aqdb/model/hostlifecycle.py | # ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
#
# Copyright (C) 2008,2009,2010,2011 Contributor
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the EU DataGrid Software License. You should
# have received a copy of t... | Python | 0 | @@ -2745,32 +2745,45 @@
ready', 'ready',
+ 'reinstall',
'failed',%0A
|
8de815513df691d24fb0b32504d025a022e4c61b | fix execute query with unicode | bin/sql_db.py | bin/sql_db.py | ##############################################################################
#
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id: pooler.py 1310 2005-09-08 20:40:15Z pinky $
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsabi... | Python | 0.000885 | @@ -2506,16 +2506,211 @@
*args)%0A%0A
+%09def execute(self, sql, params=()):%0A%09%09def base_string(s):%0A%09%09%09if isinstance(s, unicode):%0A%09%09%09%09return s.encode('utf-8')%0A%09%09%09return s%0A%09%09return self.obj.execute(sql, %5Bbase_string(s) for s in params%5D)%0A%0A
%09def clo
|
c3f14716bc646db003b7852c8f718203ae7a3c3c | Use floor division to ensure result is always an integer | truecolor.py | truecolor.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
if os.getenv('COLORTERM') is None:
raise RuntimeError('Not a true color terminal')
COLORS = {
'white': (127, 127, 127),
'grey': (64, 64, 64),
'black': (0, 0, 0),
'red': (127, 0, 0),
'green': (0, 127, 0),
'blue': (0, 0, 127),
'y... | Python | 0.000007 | @@ -1165,17 +1165,13 @@
le(i
-nt(i
+/
/ 2
-)
for
|
8a6f8cccaca16bf5f6027e75e84772542b2c2231 | add doc strings to util.py | bolt/utils.py | bolt/utils.py | from numpy import ndarray, asarray, prod
from numpy import any as npany
from collections import Iterable
def tupleize(arg):
"""
Coerce singletons and lists and ndarrays to tuples.
Parameters
----------
args : tuple, list, ndarray, or singleton
Item to coerce
"""
if not isinstance(a... | Python | 0.000001 | @@ -212,33 +212,32 @@
--------%0A arg
-s
: tuple, list,
@@ -3409,16 +3409,291 @@
w, old):
+%0A %22%22%22%0A Check to see if a proposed tuple of axes is a valid permutation%0A of an old set of axes. Checks length, axis repetion, and bounds.%0A%0A Parameters%0A ----------%0A new : tuple%0A ... |
3ceed6569b0028c20425a3e179bb7a4889915d9d | fix some bugs | uctrl/lib.py | uctrl/lib.py | #!/usr/bin/env python
import json
import logging
import os
import sys
import copy
from collections import namedtuple
from netaddr import IPNetwork
isdx_folder = "iSDX"
home = os.path.expanduser("~/")
isdx_path = home + isdx_folder
if isdx_path not in sys.path:
sys.path.append(isdx_path)
#import util.log
class Co... | Python | 0.000008 | @@ -1703,21 +1703,16 @@
-self.
datapath
@@ -1868,29 +1868,24 @@
-self.
cores = %7Bx:d
|
a79fb72dc852fb7e47a78d5d444290f0033e84bd | Make error available to context processors through flask.g | udata/app.py | udata/app.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import bson
import datetime
import logging
import os
import types
from os.path import abspath, join, dirname, isfile, exists
from flask import Flask, abort, send_from_directory, json, Blueprint as BaseBlueprint
from flask.ext.cache import Cache
from spe... | Python | 0.000001 | @@ -216,16 +216,19 @@
, abort,
+ g,
send_fr
@@ -1645,16 +1645,241 @@
t(404)%0A%0A
+ def handle_http_exception(self, e):%0A # Make exception/HTTPError available for context processors%0A if 'error' not in g:%0A g.error = e%0A return super(UDataApp, self).handle_http_exception(e)%0A... |
b2bc2f50c9866e758c242a6c8b57a86153cc418a | bump version | infi/conf/__version__.py | infi/conf/__version__.py | __version__ = "0.0.10"
| Python | 0 | @@ -13,11 +13,11 @@
= %220.0.1
-0
+1
%22%0A
|
24033ffcabc9e88d160a4c16503dcba9440c03fa | Copy full source directory (including sub directories) when compiling | publisher/build_paper.py | publisher/build_paper.py | #!/usr/bin/env python
from __future__ import print_function
import docutils.core as dc
import os.path
import sys
import re
import tempfile
import glob
import shutil
from writer import writer
from conf import papers_dir, output_dir
import options
header = r'''
.. role:: ref
.. role:: label
.. role:: cite
.. raw::... | Python | 0 | @@ -158,16 +158,47 @@
t shutil
+%0Afrom distutils import dir_util
%0A%0Afrom w
@@ -711,113 +711,34 @@
-options.mkdir_p(out_path)%0A for file in glob.glob(os.path.join(in_path, '*')):%0A shutil.copy(file
+dir_util.copy_tree(in_path
, ou
|
4b555b9d42fe95dbd93e33755b0f690b4773d8f8 | Update redmonster.py | py/desispec/zfind/redmonster.py | py/desispec/zfind/redmonster.py | """
desispec.zfind.redmonster
=========================
Classes for use with the redmonster package.
"""
from __future__ import division, absolute_import
import os
import numpy as np
from desispec.zfind import ZfindBase
from desispec.interpolation import resample_flux
from desispec.log import get_logger
class RedM... | Python | 0 | @@ -832,16 +832,17 @@
.zpicker
+2
import
@@ -2648,16 +2648,17 @@
z_refine
+2
()%0A%0A
@@ -3112,28 +3112,16 @@
specobj,
-%0A
self.zf
@@ -3126,19 +3126,16 @@
zfinders
-%5B0%5D
, self.z
@@ -3145,137 +3145,15 @@
ters
-%5B0%5D
, flags
-%5B0%5D,%0A self.zfinders%5B1%5D, self.zfitters%5B... |
2f8a4a8f36f8e2360f8fa629c750e381d1d7b79e | Set tooltips for the mods in the QListView's. | python/moodloader/moodloader.py | python/moodloader/moodloader.py | #! /usr/bin/python3
import re
import os
import sys
import shutil
from PyQt4 import QtGui, QtCore
from moodloader_ui import MoodLoader
class MainWindow(MoodLoader):
"""
Subclass the GUI for the main window. We implement '__init__()' here, and
also set up connections for the widgets.
"""
def __init... | Python | 0 | @@ -3205,32 +3205,73 @@
eHint(mod_size)%0A
+ mod_item.setToolTip(mod)%0A
@@ -3290,32 +3290,32 @@
Editable(False)%0A
-
@@ -3699,32 +3699,73 @@
eHint(mod_size)%0A
+ mod_item.setToolTip(mod)%0A
@@ -4150,32 +4150,32 @@
andardItem(mod)%0... |
583a6319230b89a5f19c26e5bab83e28a5a4792e | Fix the but There is an error (cannot concatenate str and int objects) when the user does not specify the inputs. | pywps/processes/dummyprocess.py | pywps/processes/dummyprocess.py | """
DummyProcess to check the WPS structure
Author: Jorge de Jesus (jorge.de-jesus@jrc.it) as suggested by Kor de Jong
"""
from pywps.Process import WPSProcess
class Process(WPSProcess):
def __init__(self):
# init process
WPSProcess.__init__(self,
i... | Python | 0.000002 | @@ -72,23 +72,23 @@
rge.
-de-
jesus@
-jrc.it
+gmail.com
) as
@@ -153,16 +153,31 @@
SProcess
+%0Aimport types
@@ -906,32 +906,96 @@
%22Input1 number%22,
+%0A type=types.IntType,
%0A
@@ -1169,16 +1169,79 @@
number%22,
+%0A ... |
cc7ffbe88b7b71b32e036be6080f03a353fdbafe | Revert to using get_task_logger | rapidsms/router/celery/tasks.py | rapidsms/router/celery/tasks.py | import celery
import logging
from rapidsms.errors import MessageSendingError
logger = logging.getLogger(__name__)
@celery.task
def receive_async(text, connection_id, message_id, fields):
"""Task used to send inbound message through router phases."""
from rapidsms.models import Connection
from rapidsms.r... | Python | 0 | @@ -11,22 +11,52 @@
ery%0A
-import
+from celery.utils.log import get_task_
logg
-ing
+er
%0Afro
@@ -115,20 +115,18 @@
r =
-logging.getL
+get_task_l
ogge
|
c231d24d9f51757adba183eb02d968d09ce2df47 | Fix missing slash in when displaying /info_x | VocaBot/contentparser.py | VocaBot/contentparser.py | import math
from collections import defaultdict
from constants import Context, VOCADB_BASE_URL
from i18n import _
from util import non_phone
from vocadb import voca_db
# I'm not exactly proud of this module's code.. but it does the job.
def names_text(song):
if len(song['names']) > 1:
names = _('<b>Add... | Python | 0.000006 | @@ -6732,16 +6732,17 @@
:') + '
+/
' + link
|
74b8aeba66a77b34eacfb1bcaac3f66caa0d8dd7 | Fix Python script | CI/runTests.py | CI/runTests.py | import sys
import os
from OMPython import OMCSession
class CITests():
'''
Python class used to run CI tests
'''
def __init__(self, rootPath):
'''
Constructor starts omc and loads MSL
'''
self.rootPath = rootPath
self.omc = OMCSession()
os.chdir(self.root... | Python | 0.999949 | @@ -763,16 +763,21 @@
+self.
loadLib(
|
83f2fe37c6eda993d6b9e2cf2d187646a366f6d8 | Make timer daemon | playserver/trackchecker.py | playserver/trackchecker.py | from threading import Timer
from . import track
_listeners = []
class TrackChecker():
def __init__(self, interval = 5):
self.listeners = []
self.CHECK_INTERVAL = interval
self.currentSong = ""
self.currentArtist = ""
self.currentAlbum = ""
self.timer = None
def checkSong(self):
song = track.getCurren... | Python | 0.000004 | @@ -876,16 +876,38 @@
ckSong)%0A
+%09%09timer.daemon = True%0A
%09%09self.t
|
0d3082f46f0ffccaca10d3f53f22e6403783d874 | change the range of the mean transmittance plot. | plot_mean_transmittance.py | plot_mean_transmittance.py | import matplotlib.pyplot as plt
import common_settings
import mean_flux
lya_center = 1215.67
settings = common_settings.Settings()
m = mean_flux.MeanFlux.from_file(settings.get_mean_transmittance_npy())
fig = plt.figure()
ax1 = fig.add_subplot(2, 1, 1)
ax2 = ax1.twiny()
ax1.plot(m.ar_z, m.get_weighted_mean())
# pl... | Python | 0 | @@ -415,14 +415,14 @@
m(0.
-5
+0
, 1.
-5
+2
)%0A#
|
7e8f8b7ba96ade849eaed239751ef3d00c57d0bd | Update plots_digits_classification.py | examples/classification/plot_digits_classification.py | examples/classification/plot_digits_classification.py | """
================================
Recognizing hand-written digits
================================
An example showing how the scikit-learn can be used to recognize images of
hand-written digits.
This example is commented in the
:ref:`tutorial section of the user manual <introduction>`.
"""
print(__doc__)
# Autho... | Python | 0.000001 | @@ -725,17 +725,17 @@
e first
-3
+4
images,
|
a906b07afd331872752ffe2325674d6f3f8f938c | Allow points with missing r_chromium | experimental/soundwave/soundwave/tables/timeseries.py | experimental/soundwave/soundwave/tables/timeseries.py | # Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import pandas # pylint: disable=import-error
TABLE_NAME = 'timeseries'
COLUMN_TYPES = (
# Index columns.
('test_suite', str), # benchmark name ('... | Python | 0.000027 | @@ -2630,17 +2630,21 @@
'%5D = row
-%5B
+.get(
'r_chrom
@@ -2647,17 +2647,17 @@
hromium'
-%5D
+)
%0A row
|
746eace7e4677b034743b25e0f8d53aabd07dd5c | Fix bugs? | autopoke.py | autopoke.py | #!/bin/env python
from selenium import webdriver
from selenium.common.exceptions import StaleElementReferenceException
from time import sleep
from getpass import getpass
if __name__ == '__main__':
driver = webdriver.phantomjs.webdriver.WebDriver()
driver.get('https://facebook.com')
driver.find_element_by_... | Python | 0 | @@ -578,26 +578,25 @@
c = 0%0A
-c2
+e
= 0%0A whi
@@ -739,31 +739,8 @@
= 1%0A
- c2 = 0%0A
@@ -833,16 +833,63 @@
eption:%0A
+ e += 1%0A if e == 10:%0A
@@ -933,16 +933,20 @@
page%22)%0A
+
@@ -991,25 +991,24 @@
okes/')%0A
-%0A
... |
434379f80ace9d3f99277adb567c447f870e6cf6 | clean print and manual blacken | zou/app/blueprints/source/csv/assets.py | zou/app/blueprints/source/csv/assets.py | from zou.app.blueprints.source.csv.base import BaseCsvProjectImportResource
from zou.app.models.project import ProjectTaskTypeLink
from zou.app.models.task import Task
from zou.app.models.task_type import TaskType
from zou.app.services import assets_service, projects_service, shots_service
from zou.app.models.entity i... | Python | 0 | @@ -3588,16 +3588,37 @@
.append(
+%0A
create_t
@@ -3663,16 +3663,33 @@
alize())
+%0A
)%0A%0A
@@ -4379,97 +4379,112 @@
-print(status)%0A if task_status_name.lower() in (status%5B%22name%22%5D.lower(),
+if task_status_name.lower() in (%0A ... |
d9fb8d20948e76d4df176d083e4284d3c99258ca | return int index for userid's in the Netflix dataset | polara/datasets/netflix.py | polara/datasets/netflix.py | import pandas as pd
import tarfile
def get_netflix_data(gz_file):
movie_data = []
movie_name = []
with tarfile.open(gz_file) as tar:
training_data = tar.getmember('download/training_set.tar')
with tarfile.open(fileobj=tar.extractfile(training_data)) as inner:
for item in inner.... | Python | 0.000011 | @@ -91,20 +91,20 @@
movie_
-name
+inds
= %5B%5D%0A
@@ -528,20 +528,20 @@
vie_
-name
+inds
.append(
movi
@@ -536,23 +536,33 @@
.append(
+int(
movieid
+%5B:-1%5D)
)%0A
@@ -651,20 +651,20 @@
s=movie_
-name
+inds
)%0A da
|
17b0fcf279c6dc8552a45e9cebde97317212fc14 | Fix UnboundLocalError | atomicwrites/__init__.py | atomicwrites/__init__.py | import contextlib
import errno
import os
import sys
import tempfile
__version__ = '0.1.8'
PY2 = sys.version_info[0] == 2
text_type = unicode if PY2 else str
def _path_to_unicode(x):
if not isinstance(x, text_type):
return x.decode(sys.getfilesystemencoding())
return x
if sys.platform != 'win32':... | Python | 0 | @@ -3170,24 +3170,94 @@
ileobject):%0A
+ f = None # make sure f exists even if get_fileobject() fails%0A
try:
|
5e4b661c446ad3fc9d27e55c7b0cfc9b17e4d8f9 | add comment | pyalaocl/useocl/state.py | pyalaocl/useocl/state.py | # coding=utf-8
from collections import OrderedDict
class State(object):
def __init__(self):
self.objects = OrderedDict()
self.links = OrderedDict()
self.linkObject = OrderedDict()
class StateElement(object):
def __init__(self, state):
self.state = state
class Object(StateE... | Python | 0 | @@ -9,16 +9,129 @@
=utf-8%0A%0A
+%22%22%22%0ASimple metamodel for object states. Contains definitions for:%0A%0A- State,%0A- Object,%0A- Link,%0A- LinkObject.%0A%22%22%22%0A%0A
from col
|
64357fbd3c32c112bdae471e538f1a5b65a74fff | Remove unused module. | pybossa/cache/helpers.py | pybossa/cache/helpers.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa 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... | Python | 0 | @@ -800,18 +800,8 @@
t db
-, timeouts
%0Afro
|
8469053ba83dd344c41eebfdee8dfee6591d1560 | Rename app to project. PEP8 and 257. | pybossa/cache/helpers.py | pybossa/cache/helpers.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa 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... | Python | 0 | @@ -735,16 +735,58 @@
enses/%3E.
+%0A%22%22%22Cache module with helper functions.%22%22%22
%0A%0Afrom s
@@ -3208,16 +3208,73 @@
project,
+%0A
**user_
@@ -3604,16 +3604,17 @@
n True%0A%0A
+%0A
def _has
@@ -3767,19 +3767,23 @@
app_id=:
-app
+project
_id;'''... |
c3f1d0f14b85dae26f36734406ff19a6a40b1239 | remove unused imports | pyfarm/models/jobtype.py | pyfarm/models/jobtype.py | # No shebang line, this module is meant to be imported
#
# Copyright 2013 Oliver Palmer
# Copyright 2014 Ambient Entertainment GmbH & Co. KG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
... | Python | 0.000001 | @@ -891,101 +891,36 @@
%22%22%0A%0A
-import ast%0Afrom hashlib import sha1%0Afrom textwrap import dedent%0A%0Afrom sqlalchemy import event
+from textwrap import dedent%0A
%0Afro
|
2fa942eb985295a2e7a573cb294680d8139929a2 | Add documentation to overwrite modes | pygimplib/pgoverwrite.py | pygimplib/pgoverwrite.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2017 khalim19
#
# 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 applicab... | Python | 0 | @@ -4777,16 +4777,344 @@
nience.%0A
+ %0A %60SKIP%60 should be used if a file path already exists and no action should be%0A taken.%0A %60DO_NOTHING%60 should be used if a file path does not exist and no action should%0A be taken.%0A %60CANCEL%60 should be used if the user terminated the overwrite chooser (e.g.%... |
078621494eb9981733412446aa4eabd9bc54fa52 | Update URL for pymssql | lib/sqlalchemy/dialects/mssql/pymssql.py | lib/sqlalchemy/dialects/mssql/pymssql.py | # mssql/pymssql.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: mssql+pymssql
:name: pymssql
:dbapi: pymssql
:connectstr... | Python | 0 | @@ -413,23 +413,11 @@
sql.
-sourceforge.net
+org
/%0A%0AL
|
da1fe9244c697b69ecc3ebf9e203edf4322f00be | make cholesky_grad a primitive | autograd/numpy/linalg.py | autograd/numpy/linalg.py | from __future__ import absolute_import
from functools import partial
import numpy.linalg as npla
from .numpy_wrapper import wrap_namespace, dot
from . import numpy_wrapper as anp
wrap_namespace(npla.__dict__, globals())
def atleast_2d_col(x):
# Promotes a 1D array into a column rather than a row.
return x if ... | Python | 0.999391 | @@ -61,16 +61,23 @@
partial
+, wraps
%0Aimport
@@ -178,16 +178,45 @@
r as anp
+%0Afrom ..core import primitive
%0A%0Awrap_n
@@ -3589,16 +3589,44 @@
_grad =
+wraps(cython_cholesky_grad)(
partial(
@@ -3655,16 +3655,17 @@
L.value)
+)
%0A exc
@@ -3738,16 +3738,26 @@
return
+primitive(
cholesky
@@ -3761,16... |
c824120ea5a33d3ee4cebc61b5bdf6b8258cf11f | remove set_printoptions call from debugging | autograd/scipy/linalg.py | autograd/scipy/linalg.py | from __future__ import division
import scipy.linalg
import autograd.numpy as anp
from autograd.numpy.numpy_wrapper import wrap_namespace
from autograd.numpy.linalg import atleast_2d_col as al2d
anp.set_printoptions(precision=3)
wrap_namespace(scipy.linalg.__dict__, globals()) # populates module namespace
def _fli... | Python | 0.000002 | @@ -193,43 +193,8 @@
2d%0A%0A
-anp.set_printoptions(precision=3)%0A%0A
wrap
|
3fb35585e498ba9b8a262e76101e3842bab3acf2 | Version added to 'precise_bbcode' package | precise_bbcode/__init__.py | precise_bbcode/__init__.py | # -*- coding: utf-8 -*-
# Standard library imports
# Third party imports
# Local application / specific library imports
from precise_bbcode.bbcode import get_parser
default_app_config = 'precise_bbcode.apps.PreciseBbCodeAppConfig'
def render_bbcodes(text):
"""
Given an input text, calls the BBCode parser t... | Python | 0 | @@ -415,8 +415,160 @@
r(text)%0A
+%0A%0Apkg_resources = __import__('pkg_resources')%0Adistribution = pkg_resources.get_distribution('django-precise-bbcode')%0A__version__ = distribution.version%0A
|
5dd8c7d2f14e6323655ca9eb879597ab8b2b0ec4 | Fix battery voltage calculation | gate_app.py | gate_app.py | from utime import sleep_ms, sleep
import webrepl
from mqtt import MQTTClient
from machine import Pin, ADC, PWM
import secrets
# Pin constants
LED1 = 16 # GPIO16, D0, Nodemcu led
LED2 = 2 # GPIO2, D4, ESP8266 led
SWITCH = 5 # GPIO5, D1
BATTERY = 0 # ADC0, A0
BUZZER = 14 # GPIO14, D5
# Resistors in voltage d... | Python | 0.000754 | @@ -327,16 +327,140 @@
(ohms)%0A
+# NodeMcu internal resister divider (from schematic)%0ANODEMCU_RESISTOR_RATIO = (220 + 100) / 100%0A# External resister divider%0A
R1 = 997
@@ -468,17 +468,18 @@
%0AR2 = 99
-4
+90
%0ARESISTO
@@ -556,50 +556,119 @@
F =
-3292 # Measured between 3.3V and GND pins
+1000%0A# Average... |
0a89c9e32e625e53cbe5ea151aff42031fb833a5 | Add canonical link | frappe/website/page_controllers/base_template_page.py | frappe/website/page_controllers/base_template_page.py | import frappe
from frappe.website.doctype.website_settings.website_settings import get_website_settings
from frappe.website.page_controllers.web_page import WebPage
from frappe.website.website_components.metatags import MetaTags
class BaseTemplatePage(WebPage):
def init_context(self):
self.context = frappe._dict()... | Python | 0 | @@ -1199,16 +1199,101 @@
.context
+%0A%09%09self.context.canonical = frappe.utils.get_url(frappe.utils.escape_html(self.path))
%0A%0A%09%09# co
|
8780619b94bf58a21eeefbd0c4e867bf0b4eb4a8 | Remove obselete params | avogadro/model_params.py | avogadro/model_params.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | Python | 0.000002 | @@ -1778,29 +1778,8 @@
65,%0A
- %22randomSP%22: 0,%0A
@@ -2005,32 +2005,8 @@
1,%0A
- %22useHighTier%22: 0,%0A
|
6a7bc9e7dacd30b27b48d37763c47b2419aca2a9 | Change the imports to be Python3 compatible | pyipinfodb/pyipinfodb.py | pyipinfodb/pyipinfodb.py | #!/usr/bin/env python
"""
Simple python wrapper around the IPInfoDB API.
"""
import json
from urllib import urlencode
import urllib2
import socket
class IPInfo() :
def __init__(self, apikey):
self.apikey = apikey
def get_ip_info(self, baseurl, ip=None):
"""
Same as get_city a... | Python | 0.99999 | @@ -88,16 +88,25 @@
rt json%0A
+try:%0A
from url
@@ -126,22 +126,147 @@
lencode%0A
-import
+except ImportError:%0A from urllib.parse import urlencode%0Atry:%0A import urllib2%0Aexcept ImportError:%0A import urllib.request as
urllib2
|
305e54c328cf212e01a3af7cec7b940894044e55 | Use float, not int for random WPM | gen_test.py | gen_test.py | import math
import numpy
import random
from demodulate.cfg import *
def gen_test_data():
pattern = [1,0,1,1,1,0,0,0,0,0,0,0] # morse code 'A'
cycles_per_sample = MORSE_FREQ/SAMPLE_FREQ
radians_per_sample = cycles_per_sample * 2 * math.pi
WPM = random.randint(2,20)
elements_per_second = WPM * 50.0 / 60.0
samples_... | Python | 0.000002 | @@ -253,15 +253,15 @@
dom.
-randint
+uniform
(2,2
|
dfb1784009549829a9a9bb1b72be51dacd44ec99 | Update auth.py | azurecloudify/auth.py | azurecloudify/auth.py |
import requests
import json
import urllib2
from cloudify import ctx
import constants
def get_token_from_client_credentials():
client_id = ctx.node.properties['client_id']
client_secret = ctx.node.properties['password']
tenant_id = ctx.node.properties['tenant_id']
endpoints = 'https://login.microsoft... | Python | 0.000001 | @@ -615,11 +615,9 @@
nse%5B
-'u'
+%22
acce
@@ -628,10 +628,11 @@
oken
-''
+ :%22
%5D%0A%0A%0A
|
2882da81b17c61e6421b96d612f31b3cfd6a88bb | Update vnet.py | azurecloudify/vnet.py | azurecloudify/vnet.py | ########
# Copyright (c) 2015 GigaSpaces Technologies 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... | Python | 0.000001 | @@ -1019,17 +1019,19 @@
_propert
-y
+ies
(propert
|
2fdbf644d0c3daf67d2bc21598df289f3e901374 | Revert ill-conceived "Allow comma-separated services for convenience" | aws_list_all/__main__.py | aws_list_all/__main__.py | #!/usr/bin/env python
from __future__ import print_function
import os
from resource import getrlimit, setrlimit, RLIMIT_NOFILE
from argparse import ArgumentParser
from sys import exit, stderr
from .introspection import (
get_listing_operations, get_services, get_verbs, introspect_regions_for_service, recreate_cac... | Python | 0.000014 | @@ -5820,132 +5820,8 @@
gs()
-%0A services = %5B%5D%0A if args.service:%0A for service in args.service:%0A services.extend(service.split(%22,%22))
%0A%0A
@@ -6049,32 +6049,82 @@
limit_nofiles()%0A
+ services = args.service or get_services()%0A
do_query
@@ -6145,34 +6145,16 @... |
206c513a49b67dfaf21531573626ba139be51b18 | Update vnet.py | azurecloudify/vnet.py | azurecloudify/vnet.py | ########
# Copyright (c) 2015 GigaSpaces Technologies 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... | Python | 0.000001 | @@ -3440,16 +3440,19 @@
ist.%22)%0A%0A
+%22%22%22
%0Adef _ge
@@ -4411,16 +4411,19 @@
rn head%0A
+%22%22%22
%0A%0A%0Adef _
|
89a18ea91fb2d095541510155dcdf94ad76b8374 | Fix broken lookdev loader | mindbender/maya/loaders/mindbender_look.py | mindbender/maya/loaders/mindbender_look.py | import json
from mindbender import api
from mindbender.maya import lib, pipeline
from maya import cmds
class LookLoader(api.Loader):
"""Specific loader for lookdev"""
families = ["mindbender.look"]
def process(self, asset, subset, version, representation):
fname = representation["path"].format... | Python | 0.000001 | @@ -201,16 +201,19 @@
der.look
+dev
%22%5D%0A%0A
@@ -1348,16 +1348,51 @@
%5B%22path%22%5D
+.format(root=api.registered_root())
,%0A
|
33fef0560e14f94bab7d74d0c6a62d2016487822 | Tidy urls.py | app/urls.py | app/urls.py | from django.conf.urls.defaults import *
from django.contrib import admin
from django.contrib.auth.views import login
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf import settings
from utils import installed
from registration.views import register
from sso.forms import Registrati... | Python | 0.000002 | @@ -1348,16 +1348,17 @@
BUG:%0A
+
urlpatte
|
d47b3722480675c971cdc0a8af4e923703fd261d | Add the not-authorized route | backdrop/admin/app.py | backdrop/admin/app.py | from os import getenv
from functools import wraps
from flask import Flask, jsonify, url_for, request, \
session, render_template, flash, redirect
from .. import statsd
from ..core import cache_control, log_handler, database
from ..core.bucket import Bucket
from ..core.errors import ParseError, ValidationError
fro... | Python | 0 | @@ -4433,24 +4433,158 @@
_route%22))%0A%0A%0A
+@app.route(%22/not-authorized%22)%0A@cache_control.nocache%0Adef not_authorized():%0A return render_template(%22signon/not_authorized.html%22)%0A%0A%0A
@app.route(%22
|
8a9422f7c323394af04f90a43a078098197076b9 | fix small bug in dynamic urls.py | app/urls.py | app/urls.py | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^about', views.about, name='about'),
url(r'^test', views.test, name='test'),
url(r'^champions/$', views.champions),
url(r'^champions/.*', views.champion),
url(r'^champions/*',... | Python | 0.000001 | @@ -516,13 +516,14 @@
ews.
-balls
+player
),%0A
|
2a1b5dbbd3e0c78df76d904602f1c4fcc6157a6b | Clean up imports | mbus/MBusHandle.py | mbus/MBusHandle.py | from ctypes import Structure, c_uint32, c_uint8, c_void_p, c_int, c_byte
class MBusHandle(Structure):
_fields_ = [("fd", c_int),
("max_data_retry", c_int),
("max_search_retry", c_int),
("purge_first_frame", c_byte),
("is_ser... | Python | 0 | @@ -26,18 +26,8 @@
ure,
- c_uint32,
c_u
|
f1e84cbc99ff77da88a78ead82d5ac0ad1cf603d | Implement the "create collection" endpoint | backdrop/write/api.py | backdrop/write/api.py | from os import getenv
from flask import Flask, request, jsonify, g
from flask_featureflags import FeatureFlag
from backdrop import statsd
from backdrop.core.bucket import Bucket
from backdrop.core.flaskutils import BucketConverter
from backdrop.core.repository import (BucketConfigRepository,
... | Python | 0.999014 | @@ -14,16 +14,28 @@
t getenv
+%0Aimport json
%0A%0Afrom f
@@ -516,16 +516,38 @@
is_valid
+, extract_bearer_token
%0A%0A%0AGOVUK
@@ -2270,24 +2270,24 @@
ucket_name)%0A
-
return _
@@ -2319,16 +2319,1387 @@
nfig)%0A%0A%0A
+@app.route('/data-sets/%3Cdataset_name%3E', methods=%5B'POST'%5D)%0A@cache_control.nocach... |
5a6a50a7b300354bc62118107ea1337f4f804b91 | Fix gramatical error in the welcome message | addons/email_confirmation/controllers.py | addons/email_confirmation/controllers.py | # -*- coding: utf-8 -*-
import logging
from openerp.addons.auth_signup.res_users import SignupError
from openerp.addons.auth_signup.controllers.main import AuthSignupHome
from openerp import http, SUPERUSER_ID
from openerp.http import request
from openerp.tools.translate import _
_logger = logging.getLogger(__name__)
... | Python | 0.000213 | @@ -1149,17 +1149,26 @@
czno%C5%9Bci!
-
+%3Cbr/%3E%3Cbr/%3E
Uda%C5%82o Ci
@@ -1200,26 +1200,25 @@
wa%C4%87
-do
+w
nasz
-ego
+ym
system
-u
+ie
.%0A
|
6c2e22cc7c0f1b43f4273464635f108ed3b03eb2 | Fix failing tests on py3k. | repobuddy/tests/arg_parser.py | repobuddy/tests/arg_parser.py | #
# Copyright (C) 2012 Ash (Tuxdude) <tuxdude.github@gmail.com>
#
# This file is part of repobuddy.
#
# This program 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 3 of the
# ... | Python | 0 | @@ -1550,32 +1550,231 @@
return%0A%0A
+ def _hook_into_logger(self):%0A self._str_stream = TestCommon.get_string_stream()%0A Logger.msg_stream = self._str_stream%0A Logger.error_stream = self._str_stream%0A return%0A%0A
def _reset_l
@@ -1778,32 +1778,32 @@
t_logger(self):%0... |
cdb3e3872ad0dfa722f9955a7beff38b2cfa3547 | remove schema form requester | backend/auth/utils.py | backend/auth/utils.py | import json
from django.http import HttpResponse
from auth.models import Token
def json_response(response_dict, status=200):
response = HttpResponse(json.dumps(response_dict), content_type="application/json", status=status)
response['Access-Control-Allow-Origin'] = 'http://memorycms.moome.net/'
response['... | Python | 0 | @@ -274,15 +274,8 @@
= '
-http://
memo
@@ -289,17 +289,16 @@
oome.net
-/
'%0A re
|
4de37b187527eaecbb8eb5f1cdc0ba67edbb4048 | Add "frameworks" to the list of audit object types | app/main/views/audits.py | app/main/views/audits.py | from flask import jsonify, abort, request, current_app
from datetime import datetime
from ...models import AuditEvent
from sqlalchemy import asc, Date, cast
from sqlalchemy.exc import IntegrityError
from sqlalchemy.sql.expression import true, false
from ...utils import pagination_links, get_valid_page_or_1
from .. impo... | Python | 0 | @@ -723,16 +723,52 @@
ervice,%0A
+ %22frameworks%22: models.Framework,%0A
%7D%0A%0AAUDIT
@@ -878,16 +878,57 @@
ice_id,%0A
+ %22frameworks%22: models.Framework.slug,%0A
%7D%0A%0A%0A@mai
|
be909a2dd461ad72d4bb7ba297c3e98af1846222 | correct api method signature | addons/sale_layout/models/sale_layout.py | addons/sale_layout/models/sale_layout.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | Python | 0 | @@ -2918,25 +2918,16 @@
id, ids,
- context,
invoice
@@ -2929,33 +2929,35 @@
voice_id
-, *args, **kwargs
+=None, context=None
):%0A
@@ -4197,42 +4197,35 @@
ds,
-context, order_id, *args, **kwargs
+order_id=None, context=None
):%0A
|
6e30c44d41c0e393859d19c32628552e3b611b3c | Add missing space. | st2reactor/st2reactor/rules/enforcer.py | st2reactor/st2reactor/rules/enforcer.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.001076 | @@ -1687,16 +1687,17 @@
contains
+
'%0A
|
2a4bbb19bf32a08e7c398558d39c201f8b089342 | change to len | backend/camservice.py | backend/camservice.py | import cherrypy
from cammodule import CamModule, get_camera_list, setup_pygame_camera
class CamService(object):
def __init__(self):
self.camera_list = []
setup_pygame_camera()
camera_list = get_camera_list()
for camera_index, camera_name in enumerate(camera_list):
self.... | Python | 0.99996 | @@ -481,17 +481,38 @@
Count%22:
-1
+len(get_camera_list())
%7D%0A%0A%0A
|
74d85b48f3451f306a31942297be93f03992586e | add a function to calculate the Inbreeding coefficient | asmvar/utils/vcfutils.py | asmvar/utils/vcfutils.py | """
A class for output VCF file. PyVCF does not able to add or update information
fields for sample's FORMAT field. That make us have to create another classes
(like these) to handle that problem
"""
import re
class Header(object):
def __init__(self, hInfo = None):
"""
VCF header information
... | Python | 0.000122 | @@ -2614,19 +2614,934 @@
le)%5D)%0A%0A%0A
-%0A
+def calcuInbreedCoeff(gt):%0A %22%22%22%0A Calculating the inbreeding coefficient by GT fields of VCF.%0A%0A Args:%0A %60gt%60: A list. Genotype fields of all the samples.%0A %22%22%22%0A ref_count, het_count, hom_count, n = 0, 0, 0, 0%0A ... |
ae7cc245938b1e02974f9b54830146019ca9c0c1 | make imports init __init__ prettier | pypeerassets/__init__.py | pypeerassets/__init__.py | from pypeerassets.kutil import Kutil
from pypeerassets.provider import *
from pypeerassets.__main__ import *
| Python | 0.999726 | @@ -92,18 +92,392 @@
__main__ import
-*
+(deck_parser,%0A find_all_valid_cards,%0A find_all_valid_decks,%0A find_deck,%0A deck_spawn,%0A deck_transf... |
28ffce4de70a74b22cf51c7bdd5b6d970cf70dfc | Update binary windows resource test to check for correct option type | csunplugged/tests/resources/views/test_binary_windows.py | csunplugged/tests/resources/views/test_binary_windows.py | from django.test import tag
from django.urls import reverse
from tests.BaseTestWithDB import BaseTestWithDB
from tests.resources.ResourcesTestDataGenerator import ResourcesTestDataGenerator
from utils.import_resource_generator import import_resource_generator
from utils.create_query_string import query_string
from util... | Python | 0 | @@ -2088,17 +2088,8 @@
ts%22%5D
- == %22yes%22
:%0A
|
3aa36ff6ef79f061158ad57b1f4a251b3eeafd7a | Add virtual shift dealer_btn method | pypoker2/engine/table.py | pypoker2/engine/table.py | from pypoker2.engine.card import Card
from pypoker2.engine.seats import Seats
from pypoker2.engine.deck import Deck
class Table:
def __init__(self, cheat_deck=None):
self.dealer_btn = 0
self.seats = Seats()
self.deck = cheat_deck if cheat_deck else Deck()
self.__community_card = []
def get_commun... | Python | 0 | @@ -771,26 +771,75 @@
ler_btn(self
-):
+, exec_shit=True):%0A dealer_pos = self.dealer_btn
%0A while T
@@ -853,42 +853,32 @@
-self.
dealer_
-btn
+pos
= (
-self.
dealer_
-btn
+pos
+ 1
@@ -927,31 +927,26 @@
players%5B
-self.
dealer_
-btn
+pos
%5D.is_act
@@ -957,16 +957,85 @@
): break
+%0A if ex... |
8431b103bd0c5459f1299707c4c305e057c197ef | Add temp/fan | barpyrus.py | barpyrus.py | import sys
import contextlib
from barpyrus import hlwm
from barpyrus import widgets as W
from barpyrus.core import Theme, Painter
from barpyrus import lemonbar
from barpyrus import conky
@contextlib.contextmanager
def maybe_orange(match, predicate='> 90'):
with cg.if_('match ${%s} %s' % (match, predicate)):
... | Python | 0 | @@ -1840,16 +1840,221 @@
('%25 ')%0A%0A
+## temp / fan%0Awith cg.temp_fg('#9fbc00'):%0A cg.symbol(0xe1c0)%0Acg.space(5)%0Acg.var('ibm_fan')%0Acg.text('rpm ')%0Awith cg.temp_fg('#9fbc00'):%0A cg.symbol(0xe01b)%0Acg.space(5)%0Acg.var('acpitemp')%0Acg.text('%C2%B0 ')%0A
%0A## Netw
|
4a62c819f65aba0f68fb07fed2777f9bc88ee2d3 | Fix return `Group.get_members()` | vk/groups.py | vk/groups.py | # coding=utf-8
from .fetch import fetch
from .users import get_users
__all__ = ("groups",)
class Group(object):
"""
Docs: https://vk.com/dev/objects/groups
"""
__slots__ = ("id", "name", "screen_name", "is_closed", "is_deactivated", "type", "has_photo",
"photo_50", "photo_100", "phot... | Python | 0.000024 | @@ -1701,13 +1701,19 @@
-yield
+for user in
get
@@ -1728,16 +1728,44 @@
ser_ids)
+:%0A yield user
%0A
|
f3ff0e909fa658d43564655213185f75860a1b56 | Remove asking for confirmation to set default menu entry | src/grub-boot-manager.py | src/grub-boot-manager.py | #!/usr/bin/env python
from gi.repository import Gtk, Gdk
import subprocess
import re
import os
import sys
class GrubBootManager:
def __init__(self):
output = subprocess.check_output(["grub-install", "--version"])
self.grub_version = output.split()[-1]
output = open("/boot/grub/grub.cfg", ... | Python | 0 | @@ -2368,27 +2368,24 @@
%22, self.
-show_dialog
+grub_set
_default
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.